def on_combobox_server_changed(self, combobox):
   """
   Replace the servers used by the main and update sources with
   the selected one
   """
   combobox = self.userinterface.combobox_server
   index = combobox.currentIndex()
   if index == self.active_server:
       return
   elif index == self.other_mirrors_index:
       dialogue = DialogMirror(self.userinterface, self.datadir, self.distro, self.custom_mirrors)
       res = dialogue.run()
       if res != None:
           self.distro.change_server(res)
           self.set_modified_sourceslist()
           self.init_mirrors() # update combobox
       else:
           combobox.setCurrentIndex(self.active_server)
   else:
       uri = self.mirror_urls[index]
       if uri != None and len(self.distro.used_servers) > 0:
           self.active_server = index
           self.distro.change_server(uri)
           self.set_modified_sourceslist()
       else:
           self.distro.default_server = uri
Ejemplo n.º 2
0
 def on_combobox_server_changed(self, combobox):
     """
 Replace the servers used by the main and update sources with
 the selected one
 """
     if combobox.get_active() == self.active_server:
         return
     server_store = combobox.get_model()
     iter = combobox.get_active_iter()
     uri = server_store.get_value(iter, 1)
     name = server_store.get_value(iter, 0)
     if name == _("Other..."):
         dialog = DialogMirror(self.window_main, self.datadir, self.distro,
                               self.custom_mirrors)
         res = dialog.run()
         if res != None:
             self.distro.change_server(res)
             self.set_modified_sourceslist()
         else:
             combobox.set_active(self.active_server)
     elif uri != None and len(self.distro.used_servers) > 0:
         self.active_server = combobox.get_active()
         self.distro.change_server(uri)
         self.distro.default_server = uri
         self.set_modified_sourceslist()
     else:
         self.distro.default_server = uri
Ejemplo n.º 3
0
 def on_combobox_server_changed(self, combobox):
     """
 Replace the servers used by the main and update sources with
 the selected one
 """
     combobox = self.userinterface.combobox_server
     if combobox.currentIndex() == self.active_server:
         return
     uri = self.mirror_urls[combobox.currentIndex()]
     name = unicode(combobox.currentText())
     if name == unicode(_("Other..."), 'utf-8'):
         dialogue = DialogMirror(self.userinterface, self.datadir,
                                 self.distro, self.custom_mirrors)
         self.translate_widget_children(dialogue)
         res = dialogue.run()
         if res != None:
             self.distro.change_server(res)
             self.set_modified_sourceslist()
             ##FIXME insert new URL into combo box
         else:
             combobox.setCurrentIndex(self.active_server)
     elif uri != None and len(self.distro.used_servers) > 0:
         self.active_server = combobox.currentIndex()
         self.distro.change_server(uri)
         self.set_modified_sourceslist()
     else:
         self.distro.default_server = uri
 def on_combobox_server_changed(self, combobox):
   """
   Replace the servers used by the main and update sources with
   the selected one
   """
   if combobox.get_active() == self.active_server:
       return
   server_store = combobox.get_model()
   iter = combobox.get_active_iter()
   uri = server_store.get_value(iter, 1)
   name = server_store.get_value(iter, 0)
   if name == _("Other..."):
       dialog = DialogMirror(self.window_main,
                             self.datadir,
                             self.distro,
                             self.custom_mirrors)
       res = dialog.run()
       if res != None:
           self.distro.change_server(res)
           self.set_modified_sourceslist()
       else:
           combobox.set_active(self.active_server)
   elif uri != None and len(self.distro.used_servers) > 0:
       self.active_server = combobox.get_active()
       self.distro.change_server(uri)
       self.distro.default_server = uri
       self.set_modified_sourceslist()
   else:
       self.distro.default_server = uri