class Dan: def __init__(self): self.url = "http://www.bibud.com" self.setupWindow() self.setupBrowser() main() def setupWindow(self): self.window_title = "Bibud" self.window = Window() self.window.show() self.window.connect("destroy-event", self.browser_quit) self.window.resize(1024, 768) self.window.set_title(self.window_title) def setupBrowser(self): self.browser = WebView() self.browser.show() self.browser.open(self.url) self.scroller = ScrolledWindow() self.scroller.add(self.browser) self.window.add(self.scroller) self.browser.connect("title-changed", self.title_changed) self.scroller.show() def eTitleChanged(self, webview, frame, title): self.window.set_title(title) def eQuit(self): main_quit()
def __init__(self, bus): VBox.__init__(self) self.bus = bus logger.debug('Running...') self.label = Label('Looking for Presence Service...') self.errors = ListStore(str) errors_tree = TreeView(model=self.errors) errors_tree.insert_column_with_attributes(0, 'Log', CellRendererText(), text=0) scroller = ScrolledWindow() scroller.add(errors_tree) self.paned = VPaned() self.paned.pack1(scroller) self.pack_start(self.label, False, False) self.pack_end(self.paned) bus.watch_name_owner(PS_NAME, self.on_name_owner_change) self.ps_watcher = Label('-') self.paned.pack2(self.ps_watcher) self.show_all()
def _setup_layout(self): self.vbox = VBox(False, 0) self.vbox.show() self.terminal = terminal() self.terminal.connect("child-exited", lambda _: self.close_button.show()) self.expander = expander_new_with_mnemonic(_("_Terminal")) self.expander.set_expanded(False) self.expander.add(self.terminal) self.expander.show_all() self.close_button = Button(stock=STOCK_CLOSE) self.close_button.connect("clicked", lambda _: self.destroy()) scr = ScrolledWindow() scr.set_policy ("automatic", "automatic") scr.add (self.tree) scr.show() vpaned = VPaned() vpaned.add1(scr) vpaned.add2(self.expander) vpaned.set_position (260) vpaned.show() self.vbox.pack_start(vpaned, True, True, 0) self.vbox.pack_start(self.close_button, False, False, 0) self.add(self.vbox) return
def _setup_layout(self): self.set_default_size(600,200) label = Label(_("Are you sure you want to install/remove those packages?\n")) self.hpaned = HPaned() inst_scroll = ScrolledWindow() inst_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) rem_scroll = ScrolledWindow() rem_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) inst_scroll.add(self.install_tree) rem_scroll.add(self.remove_tree) self.hpaned.pack1(inst_scroll, False, False) self.hpaned.pack2(rem_scroll, False, False) self.vbox.pack_start( label, False, False, 0 ) self.vbox.pack_start( self.hpaned, True, True, 0 ) self.vbox.pack_start( self.expander, False, False, 0 ) self.show_all() self.expander.hide_all() self.close_button.hide()
def _setup_layout(self): hpaned = HPaned() label = Label(_("Are you sure you want to install/remove those packages?")) label.show() inst_frame = Frame(_("Packages to install")) rem_frame = Frame(_("Packages to remove")) inst_scroll = ScrolledWindow() inst_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) rem_scroll = ScrolledWindow() rem_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) inst_scroll.add(self.install_tree) rem_scroll.add(self.remove_tree) inst_frame.add(inst_scroll) rem_frame.add(rem_scroll) hpaned.pack1(inst_frame, False, False) hpaned.pack2(rem_frame, False, False) hpaned.show_all() self.vbox.pack_start(label, False, False, 0) self.vbox.pack_start(hpaned, True, True, 0) self.set_default_size(600,300) return
class Dan: def __init__(self): self.url = "http://www.bibud.com" self.setupWindow() self.setupBrowser() main() def setupWindow(self): self.window_title = "Bibud" self.window = Window() self.window.show() self.window.connect("destroy-event", self.browser_quit) self.window.resize(1024,768) self.window.set_title(self.window_title) def setupBrowser(self): self.browser = WebView() self.browser.show() self.browser.open(self.url) self.scroller = ScrolledWindow() self.scroller.add(self.browser) self.window.add(self.scroller) self.browser.connect("title-changed", self.title_changed) self.scroller.show() def eTitleChanged(self, webview, frame, title): self.window.set_title(title) def eQuit(self): main_quit()
def __init__(self): ''' Constructor ''' cellRendererText = CellRendererText() treeViewColumn = TreeViewColumn() treeViewColumn.pack_start(cellRendererText) treeView = TreeView() treeView.append_column(treeViewColumn) scrolledWindow = ScrolledWindow() scrolledWindow.add(treeView) btnAdd_Alternative = Button() btnDel_Alternative = Button() hButtonBox = HButtonBox() hButtonBox.pack_start(btnAdd_Alternative) hButtonBox.pack_start(btnDel_Alternative) vBox = VBox() vBox.pack_start(scrolledWindow) vBox.pack_start(hButtonBox) self.add(vBox)
def add_tab(self, widget, tab_name, label): """Adds a tab object to the notebook.""" log.debug('add tab: %s', tab_name) self.tabs[tab_name] = widget scrolled = ScrolledWindow() scrolled.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) scrolled.add(widget) self.notebook.insert_page(scrolled, Label(label), -1) scrolled.show_all() self.after_update()
def _setup_layout(self): self.label = Label(_("Are you sure yo want to upgrade those packages?\n")) self.label.show() self.set_default_size (300, 300) scr = ScrolledWindow() scr.set_policy("automatic", "automatic") scr.add(self.tree) scr.show() self.vbox.pack_start(self.label, False, False, 0) self.vbox.pack_start(scr, True, True, 0)
def _setup_layout(self): self.set_default_size(-1,250) label = Label(_("This packages requires one of the packages you've selected for removal.\nDo you want to remove them all?")) label.show() scr = ScrolledWindow() scr.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) scr.add(self.tree) self.vbox.pack_start(label, False, False, 0) self.vbox.pack_start(scr, True, True, 0) self.vbox.show_all() return
def _setup_layout(self): self.set_default_size (300, 300) label = Label(_("Are you sure you want to upgrade those packages?\n")) scr = ScrolledWindow() scr.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) scr.add(self.tree) self.vbox.pack_start( label, False, False, 0) self.vbox.pack_start( scr, True, True, 0) self.vbox.pack_start( self.expander, False, False, 0) self.vbox.show_all() self.expander.hide_all() self.close_button.hide()
def _setup_layout(self, conflict): self.set_default_size(-1,250) if not conflict: label = Label(_("These packages are required by package(s) you've selected for removal.\nDo you want to remove them all?")) else: label = Label("Package(s) that are about to be installed conflicts \nwith package(s) that are already installed.\nDo you want to remove them?") label.show() scr = ScrolledWindow() scr.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) scr.add(self.tree) self.vbox.pack_start(label, False, False, 0) self.vbox.pack_start(scr, True, True, 0) self.vbox.show_all() return
def _setup_layout(self): self.set_default_size(600,200) self.hpaned = HPaned() inst_scroll = ScrolledWindow() inst_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) rem_scroll = ScrolledWindow() rem_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) inst_scroll.add(self.inst_tree) rem_scroll.add(self.rem_tree) self.hpaned.pack1(inst_scroll, False, False) self.hpaned.pack2(rem_scroll, False, False) self.hpaned.show_all() self.close_button = Button(stock=STOCK_CLOSE) self.close_button.connect("clicked", lambda _: self.destroy()) self.terminal = terminal() self.terminal.connect("child-exited", lambda _: self.close_button.show()) self.expander = Expander(_("Terminal")) self.expander.connect("notify::expanded", self._set_size) self.expander.show() self.vbox = VBox(False, 0) self.vbox.show() self.vbox.pack_start(self.hpaned, True, True, 0) self.vbox.pack_start(self.expander, False, False, 0) self.vbox.pack_start(self.close_button, False, False, 0) self.add(self.vbox)
def __init__(self, bus, unique_name, log): VBox.__init__(self) self.bus = bus self.unique_name = unique_name self.proxy = bus.get_object(unique_name, PS_PATH) self.iface = dbus.Interface(self.proxy, PS_IFACE) self.log = log self.activities = None self.iface.connect_to_signal('ActivityAppeared', self._on_activity_appeared) self.iface.connect_to_signal('ActivityDisappeared', self._on_activity_disappeared) self.iface.GetActivities(reply_handler=self._on_get_activities_success, error_handler=self._on_get_activities_failure) self.buddies = None self.iface.connect_to_signal('BuddyAppeared', self._on_buddy_appeared) self.iface.connect_to_signal('BuddyDisappeared', self._on_buddy_disappeared) self.iface.GetBuddies(reply_handler=self._on_get_buddies_success, error_handler=self._on_get_buddies_failure) # keep this in sync with the ACT_COL_ constants self.activities_list_store = ListStore( str, # object path int, # weight (bold if new) bool, # strikethrough (dead) str, # ID str, # color str, # type str, # name str, # conn str, # channels str, # buddies ) self.pack_start(Label('Activities:'), False, False) self.activities_list = TreeView(self.activities_list_store) c = self.activities_list.insert_column_with_attributes( 0, 'Object path', CellRendererText(), text=ACT_COL_PATH, weight=ACT_COL_WEIGHT, strikethrough=ACT_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(ACT_COL_PATH) c = self.activities_list.insert_column_with_attributes( 1, 'ID', CellRendererText(), text=ACT_COL_ID, weight=ACT_COL_WEIGHT, strikethrough=ACT_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(ACT_COL_ID) c = self.activities_list.insert_column_with_attributes( 2, 'Color', CellRendererText(), text=ACT_COL_COLOR, weight=ACT_COL_WEIGHT, strikethrough=ACT_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(ACT_COL_COLOR) c = self.activities_list.insert_column_with_attributes( 3, 'Type', CellRendererText(), text=ACT_COL_TYPE, weight=ACT_COL_WEIGHT, strikethrough=ACT_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(ACT_COL_TYPE) c = self.activities_list.insert_column_with_attributes( 4, 'Name', CellRendererText(), text=ACT_COL_NAME, weight=ACT_COL_WEIGHT, strikethrough=ACT_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(ACT_COL_NAME) c = self.activities_list.insert_column_with_attributes( 5, 'Connection', CellRendererText(), text=ACT_COL_CONN, weight=ACT_COL_WEIGHT, strikethrough=ACT_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(ACT_COL_CONN) c = self.activities_list.insert_column_with_attributes( 6, 'Channels', CellRendererText(), text=ACT_COL_CHANNELS, weight=ACT_COL_WEIGHT, strikethrough=ACT_COL_STRIKE) c.set_resizable(True) c = self.activities_list.insert_column_with_attributes( 7, 'Buddies', CellRendererText(), text=ACT_COL_BUDDIES, weight=ACT_COL_WEIGHT, strikethrough=ACT_COL_STRIKE) c.set_resizable(True) scroller = ScrolledWindow() scroller.add(self.activities_list) self.pack_start(scroller) # keep this in sync with the BUDDY_COL_ constants self.buddies_list_store = ListStore(str, int, bool, str, bool, str, str, str, str, str, str) self.pack_start(Label('Buddies:'), False, False) self.buddies_list = TreeView(self.buddies_list_store) c = self.buddies_list.insert_column_with_attributes( 0, 'Object path', CellRendererText(), text=BUDDY_COL_PATH, weight=BUDDY_COL_WEIGHT, strikethrough=BUDDY_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(BUDDY_COL_PATH) c = self.buddies_list.insert_column_with_attributes( 1, 'Pubkey', CellRendererText(), text=BUDDY_COL_KEY_ID, weight=BUDDY_COL_WEIGHT, strikethrough=BUDDY_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(BUDDY_COL_KEY_ID) c = self.buddies_list.insert_column_with_attributes( 2, 'Nick', CellRendererText(), text=BUDDY_COL_NICK, weight=BUDDY_COL_WEIGHT, strikethrough=BUDDY_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(BUDDY_COL_NICK) c = self.buddies_list.insert_column_with_attributes( 3, 'Owner', CellRendererToggle(), active=BUDDY_COL_OWNER) c = self.buddies_list.insert_column_with_attributes( 4, 'Color', CellRendererText(), text=BUDDY_COL_COLOR, weight=BUDDY_COL_WEIGHT, strikethrough=BUDDY_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(BUDDY_COL_OWNER) c = self.buddies_list.insert_column_with_attributes( 5, 'IPv4', CellRendererText(), text=BUDDY_COL_IP4, weight=BUDDY_COL_WEIGHT, strikethrough=BUDDY_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(BUDDY_COL_IP4) c = self.buddies_list.insert_column_with_attributes( 6, 'CurAct', CellRendererText(), text=BUDDY_COL_CUR_ACT, weight=BUDDY_COL_WEIGHT, strikethrough=BUDDY_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(BUDDY_COL_CUR_ACT) c = self.buddies_list.insert_column_with_attributes( 7, 'Activities', CellRendererText(), text=BUDDY_COL_ACTIVITIES, weight=BUDDY_COL_WEIGHT, strikethrough=BUDDY_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(BUDDY_COL_ACTIVITIES) c = self.buddies_list.insert_column_with_attributes( 8, 'Handles', CellRendererText(), text=BUDDY_COL_HANDLES, weight=BUDDY_COL_WEIGHT, strikethrough=BUDDY_COL_STRIKE) c.set_resizable(True) c.set_sort_column_id(BUDDY_COL_HANDLES) scroller = ScrolledWindow() scroller.add(self.buddies_list) self.pack_start(scroller) self.iface.connect_to_signal('ActivityInvitation', self._on_activity_invitation) self.iface.connect_to_signal('PrivateInvitation', self._on_private_invitation)
def __init__(self, trans, transid, plugin, gui_parent, change_register_function, book, display_mode=TRANSACTION_ALL_EDIT_FIRST_TIME, transaction_edit_finished_function=null_function): self.trans = trans self.transid = transid self.plugin = plugin self.gui_parent = gui_parent self.change_register_function = change_register_function self.book = book self.display_mode = display_mode self.transaction_edit_finished_function = ( null_function if display_mode not in HEADLESS_MODES else transaction_edit_finished_function ) self.hide_parent = Window() self.hide_parent.hide() self.mainvbox = VBox() self.hide_parent.add(self.mainvbox) config = self.trans.get_configuration_and_provide_on_load_hook() config_module_name = self.plugin.config_module_name if not config_valid(config): # even in the case of a broken config, we should still # display all of the data we have available... self.mainvbox.pack_start(Label("no configuration")) elif not self.trans.can_safely_proceed_with_config_module(config): # should display all data that's available instead of just # this label # # and should give # user an overide option where they either pick an old config # for one time use or just blow out the memory of having used # a different config... # # should also print the checksum itself so they know # what they need... # # perhaps eventually we even put in place some archival support # for saving old glade and config files and then code into the # the transaction -- hey, code you need to be editable is # over here.. # # now hopefully there is no marking of this transaction dirty # in this mode and the extra safegaurds we put into # MultipageGladeTransaction don't get activated self.mainvbox.pack_start( Label("out of date configuration. data is read only here for " "the safety of your old information, last adler " "CRC was %s" % self.trans.config_crc_cache )) else: # if the safety cache was relied on before we need to tell the # backend that the transaction is actually dirty, # and now that we know that we have a workable config, # there's a chance that we'll actually be able to avoid # relying on the cache this time if self.trans.get_safety_cache_was_used(): self.change_register_function() self.page_label = Label("") (x_align, y_align) = self.page_label.get_alignment() self.page_label.set_alignment(0.0, y_align) self.mainvbox.pack_start(self.page_label, expand=False) # establish maincontainer, which is where the actual glade # pages are put by attach_current_page # # The order of placement here is important, we place this # after page_label has already been added to main # and we also need to do this prior to attach_current_page # being called, as it depends on self.maincontainer being # there # # when we're in headless mode the maincontainer can just be # the mainvbox itself # # but, outside headless mode we save screen real-estate and # place a scrolled window (which becomes the maincontainer) # inside the mainvbox and the glade by glade pages end up # in there instead (again, in attach_current_page) if display_mode in HEADLESS_MODES: self.maincontainer = self.mainvbox else: self.maincontainer = Viewport() sw = ScrolledWindow() sw.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) sw.add( self.maincontainer) self.mainvbox.pack_start(sw) self.glade_pages = [ self.__setup_page(glade_file, top_glade_element) for glade_file, top_glade_element in config.pages ] self.glade_pages_by_ident_index = dict( ( (key, self.glade_pages[i]) for i, key in enumerate(config.pages) ) # end generator expression ) # end dict self.__setup_auto_widgets() self.current_page = 0 self.attach_current_page() button_hbox = HBox() self.mainvbox.pack_end(button_hbox, expand=False) self.nav_buts = dict( (Button(), i) for i in range(2) ) for but, i in self.nav_buts.iteritems(): but.set_property('use-stock', True) but.set_label( STOCK_GO_BACK if i == GLADE_BACK_NAV else STOCK_GO_FORWARD ) button_hbox.pack_start(but, expand=False) but.connect("clicked", self.nav_but_clicked) config.gui_initialization_hook( self, self.trans, self.plugin, self.book) self.mainvbox.show_all() self.mainvbox.reparent(self.gui_parent)