def _create_ui(self): dname = self.iface.devices(self.package)[self.device] new_data = {"name":_("New Profile"), "device_id":self.device, "device_name":dname, "net_mode":"auto", "name_mode":"default"} vbox = gtk.VBox(homogeneous=False, spacing=5) self.add(vbox) self.pf = ProfileFrame(new_data) vbox.pack_start(self.pf, expand=False, fill=False) self.pf.show() if self.package == "wireless_tools": new_data["remote"] = self.data["remote"] _type = self.data["encryption"] self.wf = WirelessFrame(new_data, self.iface, package=self.package, connection="new", is_new=True, with_list=False, select_type=_type) vbox.pack_start(self.wf, expand=False, fill=False) self.wf.show() self.expander = gtk.Expander(_("Other Settings")) self.expander.set_expanded(False) vbox2 = gtk.VBox() self.expander.add(vbox2) vbox.pack_start(self.expander, expand=False, fill=False) self.expander.show() self.nf = NetworkFrame(new_data) vbox2.pack_start(self.nf, expand=False, fill=False) self.nf.show() self.nsf = NameServerFrame(new_data) vbox2.pack_start(self.nsf, expand=False, fill=False) self.nsf.show() vbox2.show() buttons = gtk.HBox(homogeneous=False, spacing=6) self.save_btn = gtk.Button(_("Save")) self.save_and_connect_btn = gtk.Button(_("Save & Connect")) self.cancel_btn = gtk.Button(_("Cancel")) buttons.pack_end(self.save_and_connect_btn, expand=False, fill=False) buttons.pack_end(self.save_btn, expand=False, fill=False) buttons.pack_end(self.cancel_btn, expand=False, fill=False) buttons.show_all() vbox.pack_end(buttons, expand=False, fill=False) vbox.show()
def _set_scanning(self, status): """disable/enable refresh btn Arguments: - `status`: if True then disable button """ if status: self._refresh_btn.set_label(_("Refreshing...")) else: self._refresh_btn.set_label(_("Refresh")) self._refresh_btn.set_sensitive(not status)
def __init__(self): """init the variables""" super(NetworkManagerAddon, self).__init__() self._uuid = "62e6a90b-52cc-4cba-86eb-56894fa7d893" self._icon_name = "applications-internet" self._label = _("Network Manager") self._widget = NetworkManager
def _connection_callback(self, widget, data): """listens ConnectionWidget's signals Arguments: - `widget`: widget - `data`: {'action':(toggle | edit | delete) 'package':package_name, 'connection':connection_name} """ action = data["action"] if action == "toggle": self.iface.toggle(data["package"], data["connection"]) elif action == "edit": EditWindow(self.iface, data["package"], data["connection"]).show() else: m = _("Do you want to delete the connection '%s' ?") % \ data['connection'] dialog = gtk.MessageDialog(type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_YES_NO, message_format=m) response = dialog.run() if response == gtk.RESPONSE_YES: try: self.iface.deleteConnection(data['package'], data['connection']) except Exception, e: print "Exception:",e dialog.destroy()
def _create_ui(self): self.data = "" self._is_new = self._connection == "new" if not self._is_new: self.data = self.iface.info(self._package, self._connection) self.is_up = self.data["state"][0:2] == "up" else: dname = self.iface.devices(self._package)[self._device_id] self.data = {"name":"", "device_id":self._device_id, "device_name":dname, "net_mode":"auto", "name_mode":"default"} self.is_up = False vbox = gtk.VBox(homogeneous=False, spacing=6) self.add(vbox) self.pf = ProfileFrame(self.data) vbox.pack_start(self.pf, expand=False, fill=False) if self.is_wireless: self.wf = WirelessFrame(self.data, self.iface, package=self._package, connection=self._connection, with_list=True, is_new=self._is_new) vbox.pack_start(self.wf, expand=True, fill=True) self.wf.show() self.nf = NetworkFrame(self.data) vbox.pack_start(self.nf, expand=False, fill=False) self.nsf = NameServerFrame(self.data) vbox.pack_start(self.nsf, expand=False, fill=False) self.nsf.show() buttons = gtk.HBox(homogeneous=False, spacing=6) self.apply_btn = gtk.Button(_("Apply")) self.cancel_btn = gtk.Button(_("Cancel")) buttons.pack_end(self.apply_btn, expand=False, fill=False) buttons.pack_end(self.cancel_btn, expand=False, fill=False) buttons.show_all() vbox.pack_end(buttons, expand=False, fill=False) vbox.show()
def _create_ui(self): #creates ui elements self._new_btn = gtk.Button(_('New Connection')) self.pack_start(self._new_btn, expand=False) self._holder = ProfilesHolder() self._holder.set_connection_signal(self._connection_callback) self.pack_start(self._holder, expand=True, fill=True) self._get_profiles()
def _set_style(self): """sets title and default size """ self.set_title(_("Edit Connection")) self.set_modal(True) if self.is_wireless: self.set_default_size(644, 400) else: self.set_default_size(483, 300)
def _set_style(self): self.set_title(_("Save Profile")) self.set_default_size(483, 300)
def _set_style(self): self.set_title(_("New Connection")) self.set_default_size(483, 300)
def _set_style(self): self.set_title(_("Network Manager")) self.set_default_size(483, 300)