def __init__(self, name='TwinCList'): HPaned.__init__(self) self.set_name(name) self.Lbox = ListBox([], name='%s-left' % name, columns=[]) self.Rbox = ListBox([], name='%s-right' % name, columns=[]) self.add1(self.Lbox) self.add2(self.Rbox) self.show()
def __init__(self, name='TwinCList'): HPaned.__init__(self) self.set_name(name) self.Lbox = ListBox([], name='%s-left' %name, columns=[]) self.Rbox = ListBox([], name='%s-right' %name, columns=[]) self.add1(self.Lbox) self.add2(self.Rbox) self.show()
def __init__(self, name='TwinScrollCList'): HPaned.__init__(self) self.set_name(name) self.lbox = ScrollCList() self.rbox = ScrollCList() self.add1(self.lbox) self.add2(self.rbox) self.show()
def __init__(self, name='_LeftListView'): HPaned.__init__(self) self.set_name(name) self.scroll = ScrolledWindow() self.add1(self.scroll) self.scroll.show() if hasattr(self, 'menu'): HasListbox.__init__(self, self.scroll, rcmenu=self.menu) else: HasListbox.__init__(self, self.scroll) self.set_size_request(300, 200) self.set_position(140) self.show()
def __init__(self, name='_LeftListView'): HPaned.__init__(self) self.set_name(name) self.scroll = ScrolledWindow() self.add1(self.scroll) self.scroll.show() if hasattr(self, 'menu'): HasListbox.__init__(self, self.scroll, rcmenu=self.menu) else: HasListbox.__init__(self, self.scroll) self.set_size_request(300,200) self.set_position(140) self.show()
def _setup_layout(self): self.hpaned = HPaned() self.hpaned.add1(self.inst_tree) self.hpaned.add2(self.rem_tree) 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, False, False, 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 _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
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_frame.add(self.install_tree) rem_frame.add(self.remove_tree) hpaned.add1(inst_frame) hpaned.add2(rem_frame) hpaned.show_all() self.vbox.pack_start(label, False, False, 0) self.vbox.pack_start(hpaned, True, True, 0) 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)
class do_dialog(Window): def __init__(self, queues, icon): Window.__init__(self, WINDOW_TOPLEVEL) self.set_property("skip-taskbar-hint", True) self.set_property("destroy-with-parent", True) self.set_modal(True) self.connect("delete-event", self._stop_closing) self.set_position(WIN_POS_CENTER) self.set_icon(pixbuf_new_from_file(icon)) self._setup_trees(queues) self._setup_layout() self.queues = queues def _setup_trees(self, queues): self._setup_install_tree(queues["add"]) self._setup_remove_tree(queues["remove"]) def _setup_install_tree(self, add_queue): self.inst_model = ListStore(str, str, str) for pac in add_queue: if pac.isold: image = "yellow" elif pac.installed: image = "green" else: image = "red" self.inst_model.append([image, pac.name, pac.version]) continue self.inst_tree = TreeView() self.inst_tree.insert_column_with_attributes(-1, "", CellRendererPixbuf(), stock_id = 0) self.inst_tree.insert_column_with_attributes(-1, _("Package"), CellRendererText(), text = 1) self.inst_tree.insert_column_with_attributes(-1, _("Version"), CellRendererText(), text = 2) self.inst_tree.set_model(self.inst_model) def _setup_remove_tree(self, remove_queue): self.rem_model = ListStore(str, str, str) for pac in remove_queue: if pac.isold: image = "yellow" elif pac.installed: image = "green" else: image = "red" self.rem_model.append([image, pac.name, pac.inst_ver]) continue self.rem_tree = TreeView() self.rem_tree.insert_column_with_attributes(-1, "", CellRendererPixbuf(), stock_id = 0) self.rem_tree.insert_column_with_attributes(-1, _("Package"), CellRendererText(), text = 1) self.rem_tree.insert_column_with_attributes(-1, _("Installed Version"), CellRendererText(), text = 2) self.rem_tree.set_model(self.rem_model) def _set_size (self, widget, event, data=None): if self.expander.get_expanded(): self.size = self.get_size() self.expander.add(self.terminal) self.terminal.show() else: self.expander.remove(self.terminal) self.resize(self.size[0], self.size[1]) self.show_all() def _setup_layout(self): self.hpaned = HPaned() self.hpaned.add1(self.inst_tree) self.hpaned.add2(self.rem_tree) 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, False, False, 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 run(self): self.show() self.terminal.do(self.queues) return def _stop_closing(self, widget, event): self.stop_emission("delete-event") return True
class do_dialog(command_dialog): def __init__(self, parent, icon, queues): command_dialog.__init__(self, parent, icon) self.queues = queues self._setup_trees(queues) self._setup_shared_widgets() self._setup_layout() def _setup_trees(self, queues): self.install_tree = PacView(queues["add"]) self.remove_tree = PacView(queues["remove"]) def _set_size (self, widget, event, data=None): if self.expander.get_expanded(): self.size = self.get_size() self.expander.add(self.terminal) self.terminal.show() else: self.expander.remove(self.terminal) self.resize(self.size[0], self.size[1]) def _setup_shared_widgets(self): self.expander = Expander(_("Terminal")) self.expander.set_expanded(False) self.expander.hide_all() self.expander.connect("notify::expanded", self._set_size) self.yes_button = self.add_button(STOCK_YES, RESPONSE_YES) self.no_button = self.add_button(STOCK_NO, RESPONSE_NO) 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 install(self): self.expander.set_sensitive(True) self.yes_button.hide_all() self.no_button.hide_all() self.expander.show_all() self.terminal.do(self.queues)