Example #1
0
    def __init__(self, *args):
        QVBox.__init__(self, *args)
        self.setMargin(6)
        self.setSpacing(6)

        self.config = KConfig("network-appletrc")
        self.config.setGroup("General")

        bar = QToolBar("lala", None, self)

        self.butNew = QToolButton(getIconSet("add"), "", "lala",
                                  self.slotCreate, bar)
        self.butNew.setTextLabel(i18n("New connection"), False)
        self.butNew.setUsesTextLabel(True)
        self.butNew.setTextPosition(self.butNew.BesideIcon)

        self.butConf = QToolButton(getIconSet("configure"), "", "lala",
                                   self.slotSettings, bar)
        self.butConf.setTextLabel(i18n("Name Service Settings"), False)
        self.butConf.setUsesTextLabel(True)
        self.butConf.setTextPosition(self.butConf.BesideIcon)

        self.butAutoConnect = QToolButton(getIconSet("connect_creating"), "",
                                          "lala", self.slotAutoConnect, bar)
        self.butAutoConnect.setTextLabel(i18n("Connect Automatically"), False)
        self.butAutoConnect.setUsesTextLabel(True)
        self.butAutoConnect.setTextPosition(self.butAutoConnect.BesideIcon)

        self.helpwin = None
        self.newconnwin = None

        lab = QToolButton(bar)
        lab.setEnabled(False)
        bar.setStretchableWidget(lab)

        but = QToolButton(getIconSet("help"), "", "lala", self.slotHelp, bar)
        but.setTextLabel(i18n("Help"), False)
        but.setUsesTextLabel(True)
        but.setTextPosition(but.BesideIcon)

        self.view = ConnectionView(self)

        self.stack = nameconf.Window(self)
        self.autoCheck = QCheckBox(i18n("Try Auto Connect on startup"), self)
        self.connect(self.autoCheck, SIGNAL('clicked()'), self.setAutoConnect)
        self.autoCheck.setOn(self.config.readBoolEntry("AutoConnect", True))
        self.autoSwitch = autoswitch.autoSwitch(comlink, notifier=False)

        comlink.new_hook.append(self.view.add)
        comlink.delete_hook.append(self.view.remove)
        comlink.nowifi_hook.append(self.disableAutoConnectButtons)
        comlink.config_hook.append(self.view.configUpdate)
        comlink.state_hook.append(self.view.stateUpdate)
        comlink.hotplug_hook.append(self.view.hotPlug)
        comlink.noconn_hook.append(self.slotCreate)

        comlink.window = self

        for script in comlink.links:
            comlink.queryConnections(script)
Example #2
0
    def __init__(self, *args):
        QVBox.__init__(self, *args)
        self.setMargin(6)
        self.setSpacing(6)
        
        self.config = KConfig("network-appletrc")
        self.config.setGroup("General")
        
        bar = QToolBar("lala", None, self)
        
        self.butNew = QToolButton(getIconSet("add"), "", "lala", self.slotCreate, bar)
        self.butNew.setTextLabel(i18n("New connection"), False)
        self.butNew.setUsesTextLabel(True)
        self.butNew.setTextPosition(self.butNew.BesideIcon)
        
        self.butConf = QToolButton(getIconSet("configure"), "", "lala", self.slotSettings, bar)
        self.butConf.setTextLabel(i18n("Name Service Settings"), False)
        self.butConf.setUsesTextLabel(True)
        self.butConf.setTextPosition(self.butConf.BesideIcon)
        
        self.butAutoConnect = QToolButton(getIconSet("connect_creating"), "", "lala", self.slotAutoConnect, bar)
        self.butAutoConnect.setTextLabel(i18n("Connect Automatically"), False)
        self.butAutoConnect.setUsesTextLabel(True)
        self.butAutoConnect.setTextPosition(self.butAutoConnect.BesideIcon)

        self.helpwin = None
        self.newconnwin = None
        
        lab = QToolButton(bar)
        lab.setEnabled(False)
        bar.setStretchableWidget(lab)
        
        but = QToolButton(getIconSet("help"), "", "lala", self.slotHelp, bar)
        but.setTextLabel(i18n("Help"), False)
        but.setUsesTextLabel(True)
        but.setTextPosition(but.BesideIcon)
        
        self.view = ConnectionView(self)
        
        self.stack = nameconf.Window(self)
        self.autoCheck = QCheckBox(i18n("Try Auto Connect on startup"),self)
        self.connect(self.autoCheck, SIGNAL('clicked()'),self.setAutoConnect)
        self.autoCheck.setOn(self.config.readBoolEntry("AutoConnect",True))
        self.autoSwitch = autoswitch.autoSwitch(comlink, notifier=False)
        
        comlink.new_hook.append(self.view.add)
        comlink.delete_hook.append(self.view.remove)
        comlink.nowifi_hook.append(self.disableAutoConnectButtons)
        comlink.config_hook.append(self.view.configUpdate)
        comlink.state_hook.append(self.view.stateUpdate)
        comlink.hotplug_hook.append(self.view.hotPlug)
        comlink.noconn_hook.append(self.slotCreate)

        comlink.window = self
        
        for script in comlink.links:
            comlink.queryConnections(script)
Example #3
0
 def createNotifier(self, dry=False):
     pynotify.init("network-applet")
     self.autoSwitch = autoswitch.autoSwitch(notifier=False)
     if self.showNotifications:
         self.notifier = pynotify.Notification("Network Manager")
         iconPath = KGlobal.iconLoader().iconPath("network", KIcon.Desktop, True)
         pos = self.trays[0].getPos()
         self.notifier.set_hint("x", pos["x"])
         self.notifier.set_hint("y", pos["y"])
         self.autoSwitch.setNotifier(self.notifier, iconPath)
     if self.autoConnect and not dry:
         self.autoSwitch.scanAndConnect(force=False)