Beispiel #1
0
 def get_toolbar(self, globaldict):
     tb = toolbar.Toolbar()
     callbacks = {}
     for name, icon, ltext, func, args in self.get_contexts(globaldict):
         callbacks[name] = func
         tb.add_button(name, icon, ltext)
     def clicked(toolbar, name):
         callbacks[name](args)
     tb.connect('clicked', clicked)
     return tb
Beispiel #2
0
 def cmd_get_custom_toolbar(self, contextname, globaldict={}):
     group = self.__registry.get_group(contextname)
     if group is not None:
         tb = toolbar.Toolbar()
         scripts = group.get('scripts').value().split(',')
         scripts = [script.strip() for script in scripts]
         def clicked(clickedtb, name):
             self.boss.command('scripts', 'execute', scriptname=name,
                               globaldict=globaldict)
         tb.connect('clicked', clicked)
         for script in scripts:
             tb.add_button(script, 'scripts',
                 'Click to execute script: %s' % script)
         return tb
Beispiel #3
0
 def init(self):
     controls = toolbar.Toolbar()
     controls.connect('clicked', self.cb_toolbar_clicked)
     self.back_button = controls.add_button('back', 'go-back-ltr',
                                            'Go back to the previous URL')
     self.back_button.set_sensitive(False)
     self.stop_button = controls.add_button('close', 'gtk-stop',
                                            'Stop loading the current URL')
     #self.stop_button.set_sensitive(False)
     bar = gtk.HBox()
     self.widget.pack_start(bar, expand=False)
     bar.pack_start(controls, expand=False)
     self.location = gtk.Entry()
     bar.pack_start(self.location)
     self.location.connect('activate', self.cb_url_entered)
     self.__browser = web_client(self)
     self.widget.pack_start(self.__browser)
     self.status_bar = gtk.Statusbar()
     self.status_context = self.status_bar.get_context_id('web')
     self.widget.pack_start(self.status_bar, expand=False)
Beispiel #4
0
 def populate(self):
     self.fetcher = Fetcher(self)
     self.doc = gtkhtml2.Document()
     self.doc.connect('request-url', self.cb_request_url)
     self.doc.connect('link-clicked', self.cb_link_clicked)
     self.view = gtkhtml2.View()
     self.view.connect('on-url', self.ro)
     self.view.set_document(self.doc)
     self.view.set_size_request(400, 300)
     self.swin = gtk.ScrolledWindow()
     self.swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
     self.swin.add(self.view)
     controls = toolbar.Toolbar()
     controls.connect('clicked', self.cb_toolbar_clicked)
     controls.add_button('back', 'left', 'Go back to the previous URL')
     controls.add_button('close', 'close', 'Stop loading the current URL')
     self.bar_area.pack_start(controls, expand=False)
     self.location = gtk.Entry()
     self.bar_area.pack_start(self.location)
     self.location.connect('activate', self.cb_url_entered)
     self.pack_start(self.swin)
     self.urlqueue = []
     self.urlqueueposition = 0
Beispiel #5
0
 def init(self):
     self.__view = gtk.HBox()
     self.__toolbar = toolbar.Toolbar()
     self.__view.pack_start(self.__toolbar)
     self.__toolbar.connect('clicked', self.cb_clicked)
     self.__callbacks = {}