def __init__(self): View.__init__(self) # sets the rb active state self["rb1"].set_active(True) for name in "rb2 rb3 rb4".split(): self[name].set_active(False)
def __init__(self, builder=None): View.__init__(self, builder=builder) # sets the rb active state self["rb1"].set_active(True) for name in "rb2 rb3 rb4".split(): self[name].set_active(False)
def __init__(self): View.__init__(self) # sets the rb active state self["rb1"].set_active(True) for name in "rb2 rb3 rb4".split(): self[name].set_active(False) return
def __init__(self): View.__init__(self) self.converter = ConverterView(False) # not a top level vbox = self['vbox_top'] vbox.pack_start(self.converter.get_top_widget()) return
def __init__(self): View.__init__(self) self.red_pb = gtk.gdk.pixbuf_new_from_file("img/red.png") self.yellow_pb = gtk.gdk.pixbuf_new_from_file("img/yellow.png") self.green_pb = gtk.gdk.pixbuf_new_from_file("img/green.png") self.show_green() return
def __init__(self): View.__init__(self) self['win_top'] = Gtk.Window() self['entry_external'] = Gtk.Entry() self['button'] = Gtk.Button("Click me to change the data source") box = Gtk.VBox() for n in ('entry_external', 'button'): box.add(self[n]) self['win_top'].add(box) self['win_top'].show_all()
def __init__(self): View.__init__(self) # creates sub views: self.part1 = Part1View() self.part2 = Part2View() self.part3 = Part3View() self.bars = BarsView(self) # this has to be the last # connects sub views: self['vbox_top'].pack_start(self.bars.get_top_widget()) self['algn_part1'].add(self.part1.get_top_widget()) self['algn_part2'].add(self.part2.get_top_widget()) self['algn_part3'].add(self.part3.get_top_widget()) return
def __init__(self): View.__init__(self) self.get_top_widget().unparent() self['window1'] = None # gets rid of the containing window # custom toolitems from spintool import SpinToolAction act = SpinToolAction("action_part2_sb_counter", "Counter", "Counter of Part2!", "Counter:", self['sb_count'].get_adjustment()) self['action_part2_sb_counter'] = act agrp = self['agrp_part2'] agrp.add_action(act) return
def __init__(self, appl_view): View.__init__(self) self.get_top_widget().unparent() self['window1'] = None # gets rid of the containing window # uim and accel group self.ui = gtk.UIManager() acc_grp = self.ui.get_accel_group() appl_view.get_top_widget().add_accel_group(acc_grp) # add action groups for view, agrp in [ (self, "agrp_bars"), (appl_view, "agrp_appl"), (appl_view.part1, "agrp_part1"), (appl_view.part2, "agrp_part2"), (appl_view.part3, "agrp_part3"), ]: self.ui.insert_action_group(view[agrp]) pass # Connects all accelerators declared in glade. This is # needed as action created in glade are connected to the # top-level window acceleration group, and that window is # not used here. Only the application Windows is used, and # in fact the agrp_appl is not needed to be connected here. for view, agrp in [ (self, "agrp_bars"), (appl_view.part1, "agrp_part1"), (appl_view.part2, "agrp_part2"), (appl_view.part3, "agrp_part3"), ]: for action in view[agrp].list_actions(): action.set_accel_group(acc_grp) action.connect_accelerator() pass pass self.ui.add_ui_from_file("ui/ui.xml") for name in "MainMenuBar MainToolBar".split(): widget = self.ui.get_widget('/' + name) assert widget self[name] = widget self['vbox_bars'].pack_start(widget, expand=False) pass return
def __init__(self, stand_alone=True): """stand_alone means that this view has a its-own windows, i.e. the converter is used as a stand alone (non embedded) application""" if stand_alone: twid = "window_converter" else: twid = "vbox_converter" View.__init__(self, top=twid) # creates and connects sub views self.source = AmountView() self.target = AmountView() self.setup_widgets() # makes target uneditable self.target.set_editable(False) return
def __init__(self): # The view here is not constructed from a glade file. View.__init__(self) # The set of widgets: w = gtk.Window() h = gtk.VBox() l = gtk.Label() b = gtk.Button("Press") h.pack_start(l) h.pack_end(b) w.add(h) w.show_all() # We add all widgets we are interested in retrieving later in # the view, by giving them a name. Suppose you need access # only to the main window, label and button. Widgets are # added like in a map: self['main_window'] = w self['label'] = l self['button'] = b return
def __init__(self): View.__init__(self, "adapters.glade", "window8") return
def __init__(self, parent_view=None): View.__init__(self, self.GLADE_FILE, self.TOP_WIDGET, parent=parent_view)
def __init__(self): View.__init__(self) self.get_top_widget().unparent() self['window1'] = None # gets rid of the containing window return
delegate = Farenheit() delegate.show() gtk.main() """ # This is the same example written with gtkmvc3 (requires 1.99.2) class MyModel (Model): temperature = 0.0 __observables__ = ("temperature", "celsius", "fahrenheit") @Model.getter(deps=["temperature"]) def celsius(self): return (self.temperature - 32) * 5/9.0 @Model.getter(deps=["temperature"]) def fahrenheit(self): return (self.temperature * 9/5.0) + 32 pass # end of class class MyController (Controller): def on_window1__delete_event(self, w, e): gtk.main_quit() def on_button_quit__clicked(self, b): gtk.main_quit() pass m = MyModel() v = View(builder="delegate.glade") c = MyController(m, v, auto_adapt=True, handlers="class") gtk.main()