def setUp(self): r = """ [foo] blah = 1 baz = True """ fd, self.filename = tempfile.mkstemp() os.write(fd, r) os.close(fd) self.r = registry.registry() group = self.r.add_group('foo', 'foodoc') group.new('blah', 'blahdoc', 2, registry.types.integer) group.new('baz', 'bazdoc', False, registry.types.boolean) self.r.load(self.filename)
def init(self): '''Constructor of the Paste History View.''' self.__history_tree = paste_tree() self.widget.pack_start(self.__history_tree) self.__x11_clipboard = gtk.Clipboard(selection="PRIMARY") self.__gnome_clipboard = gtk.Clipboard(selection="CLIPBOARD") self.__registry = registry.registry() self.__tree_selected = None self.__history_tree.connect('clicked', self.cb_paste_clicked) self.__history_tree.connect('double-clicked', self.cb_paste_db_clicked) self.__history_tree.connect('middle-clicked', self.cb_paste_m_clicked) self.__history_tree.connect('right-clicked', self.cb_paste_r_clicked) self.__pulse_bar = progressbar.progress_bar() self.widget.pack_start(self.__pulse_bar, expand=False) self.__pulse_bar.set_size_request(-1, 12) self.__pulse_bar.set_pulse_step(0.01)
def init_glade(self): '''Constructor of the Paste History View.''' self.__history_tree = self.get_widget('paste_tree') self.__list_sites = self.get_widget('list_sites') self.__x11_clipboard = gtk.Clipboard(selection="PRIMARY") self.__gnome_clipboard = gtk.Clipboard(selection="CLIPBOARD") self.__registry = registry.registry() for site in pastebin.BINS.keys(): self.__list_sites.append_text(site) self.__list_sites.set_active(0) self.__list_selected = self.__list_sites.get_active_text() self.__tree_selected = None self.__history_tree.connect('clicked', self.cb_paste_clicked) self.__history_tree.connect('double-clicked', self.cb_paste_db_clicked) self.__history_tree.connect('middle-clicked', self.cb_paste_m_clicked) self.__list_sites.connect('changed', self.cb_list_site_change)
def init_glade(self): '''Constructor of the Paste History View.''' self.__history_tree = self.get_widget('paste_tree') self.__x11_clipboard = gtk.Clipboard(selection="PRIMARY") self.__gnome_clipboard = gtk.Clipboard(selection="CLIPBOARD") self.__registry = registry.registry() self.__tree_selected = None self.__history_tree.connect('clicked', self.cb_paste_clicked) self.__history_tree.connect('double-clicked', self.cb_paste_db_clicked) self.__history_tree.connect('middle-clicked', self.cb_paste_m_clicked) self.__history_tree.connect('right-clicked', self.cb_paste_r_clicked) self.__uim = gtk.UIManager() self.__uim.insert_action_group(self.service.action_group, 0) self.__uim.add_ui_from_string(""" <popup> <menuitem name="1" action="pastemanager+new_paste" /> <separator /> <menuitem name="2" action="pastemanager+view_paste" /> <menuitem name="3" action="pastemanager+copy_url_to_clipboard" /> <separator /> <menuitem name="5" action="pastemanager+remove_paste" /> </popup> """) self.__popup_menu = self.__uim.get_widget('/popup')