Revision: 4659 http://geany.svn.sourceforge.net/geany/?rev=4659&view=rev Author: elextr Date: 2010-02-12 10:37:00 +0000 (Fri, 12 Feb 2010)
Log Message: ----------- Commit version with details sub-dialog
Modified Paths: -------------- branches/bs2/scripts/build_dialog_prototype.py
Modified: branches/bs2/scripts/build_dialog_prototype.py =================================================================== --- branches/bs2/scripts/build_dialog_prototype.py 2010-02-10 21:54:23 UTC (rev 4658) +++ branches/bs2/scripts/build_dialog_prototype.py 2010-02-12 10:37:00 UTC (rev 4659) @@ -96,6 +96,111 @@ else: w.hide_all()
+class detail_dialog: + def resp(self, widget, respid ): + print respid + if respid != gtk.RESPONSE_APPLY : + self.dl.hide_all() + + def __init__(self, parent, name, wingrp): + self.dl = gtk.Dialog(name, parent, gtk.DIALOG_DESTROY_WITH_PARENT, + ( gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, + gtk.STOCK_APPLY, gtk.RESPONSE_APPLY, + gtk.STOCK_OK, gtk.RESPONSE_OK)) + vbl = gtk.VBox() + vbr = gtk.VBox() + vbl.pack_start(gtk.Label("Type: ")) + self.ic = gtk.combo_box_new_text() + self.ic.append_text("External") + self.ic.append_text("Next Error") + self.ic.append_text("Prev Error") + self.ic.append_text("Show Config") + vbr.pack_start(self.ic) + vbl.pack_start(gtk.Label("Label: ")) + self.lb = gtk.Entry() + vbr.pack_start(self.lb) + vbl.pack_start(gtk.Label("Command:")) + self.cm = gtk.Entry() + vbr.pack_start(self.cm) + vbl.pack_start(gtk.Label("Working Dir:")) + self.wd = gtk.Entry() + vbr.pack_start(self.wd) + vbl.pack_start(gtk.Label("Output:")) + self.op = gtk.combo_box_new_text() + self.op.append_text("Parsed") + self.op.append_text("Terminal") + self.op.append_text("Shell") + vbr.pack_start(self.op) + vbl.pack_start(gtk.Label("Regex:")) + self.rs = gtk.combo_box_new_text() + self.rs.append_text("Local") + self.rs.append_text(name) + self.rs.append_text("From filetype") + hb = gtk.HBox() + hb.pack_start(self.rs) + self.rv = gtk.Entry() + hb.pack_start(self.rv) + vbr.pack_start(hb) + self.st = gtk.CheckButton("Stopable") + vbl.pack_start(self.st) + self.slab = gtk.Label("Stop Label:") + hb = gtk.HBox() + hb.pack_start(self.slab) + self.sl = gtk.Entry() + hb.pack_start(self.sl) + vbr.pack_start(hb) + self.glab = gtk.Label("Group:") + vbl.pack_start(self.glab) + self.sg = gtk.combo_box_entry_new_text() + self.sg.append_text("Parsed") + self.sg.append_text("Single") + vbr.pack_start(self.sg) + hb = gtk.HBox() + hb.pack_start(vbl) + hb.pack_start(vbr) + self.dl.vbox.pack_start(hb) + self.dl.connect("response", self.resp) + wingrp.add_window(self.dl) + self.dl.show_all() + +class simple_data: + def show_detail(self, widget, data): + if self.ddialog == None: + self.ddialog = detail_dialog(data, self.name, self.wingrp) + else: + self.ddialog.show_all() + + def __init__(self, name, ft, sens, parent, wingrp ): + xp = 6 #padding + yp = 6 + self.name = name+ft + self.wingrp = wingrp + self.frame = gtk.Frame( self.name ) + self.tab = gtk.Table(4, 5, False) + self.llab = gtk.Label("Label:") + self.tab.attach(self.llab, 0,1, 0, 1,0,0) + self.lb = gtk.Entry() + self.tab.attach(self.lb, 1,5,0,1) + self.clab = gtk.Label("Command:") + self.tab.attach(self.clab, 0,1, 1,2,0,0) + self.cm = gtk.Entry() + self.tab.attach(self.cm, 1,5, 1,2) + self.wlab = gtk.Label("Working Dir:") + self.tab.attach(self.wlab, 0,1, 2,3,0,0) + self.wd = gtk.Entry() + self.tab.attach(self.wd, 1,5, 2,3) + self.sens = sens + if sens : + self.clr = gtk.Button(stock=gtk.STOCK_CLEAR) + self.tab.attach(self.clr, 4,5,3,4,0,0) + self.detail = gtk.Button("Advanced Settings") + self.tab.attach(self.detail, 0,1,3,4,0,0) + self.ddialog = None + self.detail.connect("clicked", self.show_detail, parent) + else: + self.frame.set_sensitive(False) + self.frame.add(self.tab) + class menu_list: def is_separator(self, model, iter, data=None): return model.get_value(iter,1)<0 @@ -122,7 +227,89 @@ self.view.set_row_separator_func(self.is_separator) self.col = gtk.TreeViewColumn("Menu", gtk.CellRendererText(), text=0) self.view.append_column(self.col) - + +class dialog2: + def __init__(self): + self.proj = True + self.win = gtk.Dialog("Build Menu Configuration", + None, + gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, + ( gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, + gtk.STOCK_OK, gtk.RESPONSE_ACCEPT, + gtk.STOCK_APPLY, gtk.RESPONSE_ACCEPT)) + self.win.set_size_request(800,600) + self.panes = gtk.HPaned() + self.left = menu_list() + self.panes.pack1(self.left.view) + self.right = gtk.VBox() + self.d = [] + self.wingrp = gtk.WindowGroup() + self.dif = simple_data("Internal Preferences", " for Filetype XXX", False, self.win, self.wingrp) + self.right.pack_start(self.dif.frame,False,False) + self.d.append(self.dif) + self.di = simple_data("Internal Preferences", " Filetype Independent", False, self.win, self.wingrp) + self.right.pack_start(self.di.frame,False,False) + self.d.append(self.di) + self.dpf = simple_data("Project Preferences", " for Filetype XXX", True, self.win, self.wingrp) + self.right.pack_start(self.dpf.frame,False,False) + self.d.append(self.dpf) + self.dp = simple_data("Project Preferences", " Filetype Independent", True, self.win, self.wingrp) + self.right.pack_start(self.dp.frame,False,False) + self.d.append(self.dp) + self.duf = simple_data("User Preferences", " for Filetype XXX", True, self.win, self.wingrp) + self.right.pack_start(self.duf.frame,False,False) + self.d.append(self.duf) + l = self.duf.frame.get_label_widget() + x = pango.AttrWeight(pango.WEIGHT_BOLD,0,len(l.get_label())) + a = pango.AttrList(); a.insert(x) + l.set_attributes(a) + self.du = simple_data("User Preferences", " Filetype Independent", True, self.win, self.wingrp) + self.right.pack_start(self.du.frame,False,False) + self.d.append(self.du) + self.dsf = simple_data("System", " for Filetype XXX", False, self.win, self.wingrp) + self.right.pack_start(self.dsf.frame,False,False) + self.d.append(self.dsf) + self.df = simple_data("System", " Filetype Independent", False, self.win, self.wingrp) + self.right.pack_start(self.df.frame,False,False) + self.d.append(self.df) + self.swin = gtk.ScrolledWindow() + self.swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + self.swin.add_with_viewport(self.right) + self.rt = gtk.VBox() + self.rt.pack_start(self.swin) + self.ba = gtk.HBox() + self.shall = gtk.ToggleButton("Show all Sources") + self.shall.connect("toggled", self.show_sources) + self.ba.pack_end(self.shall, False, False) + self.rt.pack_start(self.ba, False, False) + self.panes.pack2(self.rt) + self.panes.show_all() + self.win.vbox.pack_start(self.panes) + self.win.connect("destroy", the_end) + self.shall.set_active(False) + self.show_sources(self.shall) + + def show_sources(self, widget, data=None): + val = widget.get_active() + for d in self.d: + if not d.sens: + if val: + d.frame.show_all() + else: + d.frame.hide_all() + + def show_as(self, proj): + self.proj = proj + if proj: + self.dpf.frame.show_all() + self.dp.frame.show_all() + else: + self.dpf.frame.hide_all() + self.dp.frame.hide_all() + ret = self.win.run() + self.win.hide() + return ret + class dialog: def show_sources(self, widget, data=None): val = widget.get_active() @@ -228,7 +415,7 @@ def show_dialog(widget, val): global the_dialog if the_dialog == None: - the_dialog = dialog() + the_dialog = dialog2() print the_dialog.show_as(val)
def main():
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.