Exemplo n.º 1
0
 def __init__(self, parent):
     self.parent = parent
     self.PassivePopup = KPassivePopup()
     IconLoader = KIconLoader()
     self.icoCancel = IconLoader.loadIcon('cancel', KIcon.Small)
     self.icoInfo = IconLoader.loadIcon('info', KIcon.Small)
     self.st = parent.systray
Exemplo n.º 2
0
 def __init__(self, parent):
     self.parent = parent
     self.PassivePopup = KPassivePopup()        
     IconLoader   = KIconLoader()        
     self.icoCancel = IconLoader.loadIcon('cancel', KIcon.Small)
     self.icoInfo = IconLoader.loadIcon('info', KIcon.Small)
     self.st = parent.systray
Exemplo n.º 3
0
 def setupKDE(app, wnd):
     try:
         icons = KIconLoader()
         systray = KSystemTray(wnd)
         systray.setPixmap(icons.loadIcon("kedit", 1))
         QToolTip.add(systray, "PyQLogger - Blogger GUI")
         systray.show()
     except Exception, inst:
         sys.stderr.write("setupKDE: cannot set tray, exception: %s\n" %
                          inst)
Exemplo n.º 4
0
    def __init__(self, *args):
        apply(KSystemTray.__init__, (self, ) + args)
        ''' comarInterface instance '''
        self.comarInterface = comarInterface(self.winId())
        ''' wirelessInterface instance '''
        self.wirelessInterface = wirelessInterface()
        ''' dcopInterface instance'''
        self.dcopInterface = dcopInterface(self.wirelessInterface)
        ''' Add /usr/share/PyWireless to KStandardDirs '''
        self.KStandardDirs = KStandardDirs()
        self.KStandardDirs.addResourceDir('icon', '/usr/share/PyWireless')
        ''' Create tray icon Loader '''
        self.icons = KIconLoader('PyWireless', self.KStandardDirs)
        ''' Timer event triggered every 3 second
            Until i found a way to use inotify or libfam '''
        self.time = QTimer(self)
        self.connect(self.time, SIGNAL('timeout()'), self.timeoutSlot)
        self.time.start(3000)

        self.connect(app, SIGNAL("shutDown()"), self.slotQuit)
        ''' Popup Menu '''
        connectionsMenu = KPopupMenu(self.contextMenu())
        ''' list all connections into Connections menu '''
        for entry in self.comarInterface.listConnections():
            if self.comarInterface.isActive(entry):
                id = connectionsMenu.insertItem(
                    QIconSet(
                        self.icons.loadIcon('wireless-online', KIcon.Desktop,
                                            16)), entry)
            else:
                id = connectionsMenu.insertItem(
                    QIconSet(
                        self.icons.loadIcon('wireless-offline', KIcon.Desktop,
                                            16)), entry)
        self.connect(connectionsMenu, SIGNAL("activated(int)"),
                     self.switchConnection)

        self.contextMenu().insertItem(_('Wireless Connections Profiles'),
                                      connectionsMenu)
        # FIXME: Use net-kga
        self.contextMenu().insertItem(_('Create New Wireless Connection'))

        self.show()
Exemplo n.º 5
0
 def __init__(self, app, *args):
     KMainWindow.__init__(self, *args)
     self.app = app
     self.icons = KIconLoader()
     if self.app.pgpool is not None:
         self.systray = KSystemTray(self)
         self.systray.setPixmap(self.icons.loadIcon('connect_no', 1))
         self.systray.show()
     self.initActions()
     self.initMenus()
     self.initToolbar()
     self.db = app.db
     self.cfg = app.cfg
Exemplo n.º 6
0
 def __init__(self, app, parent):
     KMainWindow.__init__(self, parent)
     self.app = app
     self.icons = KIconLoader()
     self.initActions()
     self.initMenus()
     self.initToolbar()
     self.conn = app.conn
     self.cfg = app.cfg
     self.cursor = StatementCursor(self.conn)
     self.mainView = None
     self.resize(400, 300)
     self.show()
Exemplo n.º 7
0
 def _setupTray(app, wnd):
     try:
         icons = KIconLoader()
         systray = KSystemTray(wnd["Class"])
         p = QPixmap()
         p.loadFromData(icon)
         systray.setPixmap(p)
         QToolTip.add(systray, "PyQLogger - Blogger GUI")
         systray.show()
         wnd["Impl"].systray = systray
     except Exception, inst:
         sys.stderr.write(
             "setupKDE: cannot set tray, exception: %s\n" %
             inst)
Exemplo n.º 8
0
 def __init__(self, app, *args):
     KMainWindow.__init__(self, *args)
     self.app = app
     self.icons = KIconLoader()
     self.initActions()
     self.initMenus()
     self.initToolbar()
     self.conn = app.conn
     self.cfg = app.cfg
     self.cursor = StatementCursor(self.conn)
     self.listView = KListView(self)
     self.listView.setRootIsDecorated(True)
     self.listView.addColumn('widget')
     self.setCentralWidget(self.listView)
     self.refreshListView()
     self.connect(self.listView, SIGNAL('selectionChanged()'),
                  self.selectionChanged)
Exemplo n.º 9
0
 def __init__(self, app, *args):
     KMainWindow.__init__(self, *args)
     self.app = app
     self.icons = KIconLoader()
     self._environ_types = ['default', 'current']
     self._differ_types = ['trait', 'family']
     self.conn = app.conn
     self.cfg = app.cfg
     self.cursor = StatementCursor(self.conn)
     self._suites = [x.suite for x in self.cursor.select(table='suites')]
     self.initActions()
     self.initMenus()
     self.initToolbar()
     self.listView = KListView(self)
     self.listView.setRootIsDecorated(True)
     self.listView.addColumn('widget')
     self.setCentralWidget(self.listView)
     self.refreshListView()
     self.setCaption('Main Menu')
     self.connect(self.listView,
                  SIGNAL('selectionChanged()'), self.selectionChanged)
Exemplo n.º 10
0
class KonsultantMainWindow(KMainWindow):
    def __init__(self, app, *args):
        KMainWindow.__init__(self, *args)
        self.app = app
        self.icons = KIconLoader()
        if self.app.pgpool is not None:
            self.systray = KSystemTray(self)
            self.systray.setPixmap(self.icons.loadIcon('connect_no', 1))
            self.systray.show()
        self.initActions()
        self.initMenus()
        self.initToolbar()
        self.db = app.db
        self.cfg = app.cfg
        
    def initActions(self):
        collection = self.actionCollection()
        self.editaddressAction = EditAddresses(self.slotEditAddresses, collection)
        self.manageclientsAction = ManageClients(self.slotManageClients, collection)
        self.manageticketsAction = ManageTickets(self.slotManageTickets, collection)
        self.configureAction = ConfigureKonsultant(self.slotConfigure, collection)
        self.quitAction = KStdAction.quit(self.app.quit, collection)
        
    def initMenus(self):
        mainMenu = KPopupMenu(self)
        menus = [mainMenu]
        if self.app.pgpool is not None:
            trayMenu = self.systray.contextMenu()
            menus.append(trayMenu)
        self.menuBar().insertItem('&Main', mainMenu)
        self.menuBar().insertItem('&Help', self.helpMenu(''))
        for menu in menus:
            self.editaddressAction.plug(menu)
            self.manageclientsAction.plug(menu)
            self.manageticketsAction.plug(menu)
            self.configureAction.plug(menu)
            self.quitAction.plug(menu)
            
    def initToolbar(self):
        toolbar = self.toolBar()
        actions = [self.manageclientsAction, self.manageticketsAction,
                   self.editaddressAction, self.configureAction,
                   self.quitAction]
        for action in actions:
            action.plug(toolbar)
        
    def slotEditAddresses(self):
        AddressSelector(self, self.db, 'AddressBrowser', modal=False)

    def slotManageClients(self):
        win = ClientManagerWidget(self, self.app)
        win.show()

    def slotManageTickets(self):
        win = TicketManagerWidget(self, self.db)
        win.show()

    def slotConfigure(self):
        print 'Configure Konsultant'
        c = ConfigureDialog(self, self.cfg)
        c.show()
Exemplo n.º 11
0
class SystemTray(KSystemTray):
    def __init__(self, *args):
        apply(KSystemTray.__init__, (self, ) + args)
        ''' comarInterface instance '''
        self.comarInterface = comarInterface(self.winId())
        ''' wirelessInterface instance '''
        self.wirelessInterface = wirelessInterface()
        ''' dcopInterface instance'''
        self.dcopInterface = dcopInterface(self.wirelessInterface)
        ''' Add /usr/share/PyWireless to KStandardDirs '''
        self.KStandardDirs = KStandardDirs()
        self.KStandardDirs.addResourceDir('icon', '/usr/share/PyWireless')
        ''' Create tray icon Loader '''
        self.icons = KIconLoader('PyWireless', self.KStandardDirs)
        ''' Timer event triggered every 3 second
            Until i found a way to use inotify or libfam '''
        self.time = QTimer(self)
        self.connect(self.time, SIGNAL('timeout()'), self.timeoutSlot)
        self.time.start(3000)

        self.connect(app, SIGNAL("shutDown()"), self.slotQuit)
        ''' Popup Menu '''
        connectionsMenu = KPopupMenu(self.contextMenu())
        ''' list all connections into Connections menu '''
        for entry in self.comarInterface.listConnections():
            if self.comarInterface.isActive(entry):
                id = connectionsMenu.insertItem(
                    QIconSet(
                        self.icons.loadIcon('wireless-online', KIcon.Desktop,
                                            16)), entry)
            else:
                id = connectionsMenu.insertItem(
                    QIconSet(
                        self.icons.loadIcon('wireless-offline', KIcon.Desktop,
                                            16)), entry)
        self.connect(connectionsMenu, SIGNAL("activated(int)"),
                     self.switchConnection)

        self.contextMenu().insertItem(_('Wireless Connections Profiles'),
                                      connectionsMenu)
        # FIXME: Use net-kga
        self.contextMenu().insertItem(_('Create New Wireless Connection'))

        self.show()

    def switchConnection(self, int):
        connection = self.contextMenu().text(int)

        if self.comarInterface.isActive(connection):
            ''' if selected is active then down it '''
            self.comarInterface.deactivateConnection(connection)
            self.contextMenu().changeItem(
                int,
                QIconSet(
                    self.icons.loadIcon('wireless-offline', KIcon.Desktop,
                                        16)),
                self.contextMenu().text(int))
        else:
            ''' if selected is not active then first down active one, up selected one '''
            self.comarInterface.deactivateConnection(
                self.comarInterface.activeConnection())
            self.comarInterface.activateConnection(connection)
            self.contextMenu().changeItem(
                int,
                QIconSet(
                    self.icons.loadIcon('wireless-online', KIcon.Desktop, 16)),
                self.contextMenu().text(int))

    def slotQuit(self):
        self.deleteLater()
        app.quit()

    def timeoutSlot(self):
        interfaceName = self.wirelessInterface.returnInterfaceName()
        interfaceESSID = self.wirelessInterface.returnESSID()
        interfaceMode = self.wirelessInterface.returnMode()
        linkStatus = self.wirelessInterface.returnLinkStatus()
        noiseStatus = self.wirelessInterface.returnNoiseStatus()
        signalStatus = self.wirelessInterface.returnSignalStatus()
        bitRate = self.wirelessInterface.returnBitrate()
        received = self.wirelessInterface.returnReceived()
        transferred = self.wirelessInterface.returnTransferred()
        status = self.wirelessInterface.returnInterfaceStatus()
        ''' Tray icon name '''
        if int(status):
            index = int(linkStatus) / 20
            iconName = 'pywireless_' + str(index)
            ''' Tooltip '''
            toolTip = _('''<center><img align="center" src="/usr/share/PyWireless/%s.png"></center>
            <center>
            <table border="0" bgcolor="#000000" cellspacing="1" cellpadding="1">
            <tr>
                <td colspan="2" bgcolor="#04CC1A"><center><b>Monitoring:</b> [ %s ]</b></center></td>
            <tr>
                <td bgcolor="#CCCCCC"><b>ESSID:</b></td>
                <td bgcolor="#CCCCCC"><center>%s</center></td>
            </tr>
            <tr>
                <td bgcolor="#EEEEEE"><b>Link Quality:</b></td>
                    <td bgcolor="#EEEEEE"><center>%d</center></td>
            </tr>
            <tr>
                <td bgcolor="#CCCCCC"><b>Bitrate:</b></td>
                <td bgcolor="#CCCCCC"><center>%s</center></td>
            </tr>
            <tr>
               <td bgcolor="#EEEEEE"><b>Mode:</b></td>
                <td bgcolor="#EEEEEE"><center>%s</center></td>
            </tr>
            <tr>
                <td bgcolor="#CCCCCC"><b>Noise Level:</b></td>
                <td bgcolor="#CCCCCC"><center>%d dBm</center></td>
            </tr>
            <tr>
                <td bgcolor="#EEEEEE"><b>Signal Level:</b></td>
                <td bgcolor="#EEEEEE"><center>%d dBm</center></td>
            </tr>
            <tr>
                <td bgcolor="#CCCCCC"><b>Received:</b></td>
                <td bgcolor="#CCCCCC"><center>%s</center></td>
            </tr>
            <tr>
                <td bgcolor="#EEEEEE"><b>Transferred:</b></td>
                <td bgcolor="#EEEEEE"><center>%s</center></td>
            </tr>
            </table>
            </center>
            ''') % (iconName, interfaceName, interfaceESSID, \
                    linkStatus, bitRate, interfaceMode, \
                    noiseStatus, signalStatus, received, transferred)
        else:
            iconName = 'pywireless'
            toolTip = _(
                '''<center><img align="center" src="/usr/share/PyWireless/%s.png"></center>
            <center>
            <table border="0" bgcolor="#000000" cellspacing="1" cellpadding="1">
            <tr>
                <td colspan="2" bgcolor="#DD0500"><center>[ %s ] <b>is powered off</b></center></td>
            tr>
            </table>
            </center>''') % (iconName, interfaceName)

        QToolTip.add(self, toolTip)
        self.setPixmap(self.icons.loadIcon(iconName, KIcon.Desktop, 22))
Exemplo n.º 12
0
 def __init__(self, parent):
     KSystemTray.__init__(self, parent)
     self.mainwin = parent
     icons = KIconLoader()
     self.setPixmap(icons.loadIcon('edit', KIcon.Desktop, 22))
Exemplo n.º 13
0
    def __init__(self, app, parent = None,name = "kiXdelta",fl = 0,):
        QMainWindow.__init__(self,parent,name,fl)
        self.statusBar()
        self.app = app
        icons = KIconLoader ()
        self.setIcon(icons.loadIcon("kixdelta.png", KIcon.Desktop, 22))
        
        if not name:
            self.setName("Form1")
        
        self.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Minimum,0,0,self.sizePolicy().hasHeightForWidth()))
        self.setMinimumSize(QSize(100,199))
        self.setMaximumSize(QSize(300,300))
        self.setBaseSize(QSize(0,0))

        self.setCentralWidget(QWidget(self,"qt_central_widget"))
        Form1Layout = QHBoxLayout(self.centralWidget(),11,6,"Form1Layout")
        Form1Layout.setResizeMode(QLayout.FreeResize)

        self.toolbox = QToolBox(self.centralWidget(),"toolbox")
        #self.toolbox.setCurrentIndex(0)

        self.page1 = QWidget(self.toolbox,"page1")
        self.page1.setBackgroundMode(QWidget.PaletteBackground)
        page1Layout = QGridLayout(self.page1,1,1,11,6,"page1Layout")

        self.kURLRequester2_2 = KURLRequester(self.page1,"kURLRequester2_2")


        page1Layout.addWidget(self.kURLRequester2_2,1,1)

        self.new_xdelta = QLabel(self.page1,"new_xdelta")

        page1Layout.addWidget(self.new_xdelta,2,0)

        self.kURLRequester2_3 = KURLRequester(self.page1,"kURLRequester2_3")

        page1Layout.addWidget(self.kURLRequester2_3,2,1)

        self.old = QLabel(self.page1,"old")

        page1Layout.addWidget(self.old,0,0)

        self.new = QLabel(self.page1,"new")

        page1Layout.addWidget(self.new,1,0)

        self.kURLRequester2 = KURLRequester(self.page1,"kURLRequester2")

        page1Layout.addWidget(self.kURLRequester2,0,1)

        self.create = QPushButton(self.page1,"create")

        page1Layout.addWidget(self.create,3,1)
        self.toolbox.addItem(self.page1,QString.fromLatin1(""))

        self.page2 = QWidget(self.toolbox,"page2")
        self.page2.setBackgroundMode(QWidget.PaletteBackground)
        page2Layout = QGridLayout(self.page2,1,1,11,6,"page2Layout")

        self.xdelta_file = QLabel(self.page2,"xdelta_file")

        page2Layout.addWidget(self.xdelta_file,0,0)

        self.old_file = QLabel(self.page2,"old_file")

        page2Layout.addWidget(self.old_file,1,0)

        self.new_file = QLabel(self.page2,"new_file")

        page2Layout.addWidget(self.new_file,2,0)

        self.kURLRequester5 = KURLRequester(self.page2,"kURLRequester5")

        page2Layout.addWidget(self.kURLRequester5,0,1)

        self.kURLRequester6 = KURLRequester(self.page2,"kURLRequester6")

        page2Layout.addWidget(self.kURLRequester6,1,1)

        self.kURLRequester7 = KURLRequester(self.page2,"kURLRequester7")

        page2Layout.addWidget(self.kURLRequester7,2,1)

        self.apply_patch = QPushButton(self.page2,"apply_patch")

        page2Layout.addWidget(self.apply_patch,3,1)
        self.toolbox.addItem(self.page2,QString.fromLatin1(""))
        
        self.toolbox.setCurrentIndex(1)

        Form1Layout.addWidget(self.toolbox)

        self.programAboutAction = QAction(self,"programAboutAction")
        self.programExitAction = QAction(self,"programExitAction")
        self.MenuBar = QMenuBar(self,"MenuBar")


        self.Program = QPopupMenu(self)
        self.Program.insertSeparator()
        self.Program.insertSeparator()
        self.programAboutAction.addTo(self.Program)
        self.programExitAction.addTo(self.Program)
        self.MenuBar.insertItem(QString(""),self.Program,1)

        self.MenuBar.insertSeparator(2)


        self.languageChange()

        self.resize(QSize(300,256).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

        self.connect(self.programExitAction,SIGNAL("activated()"),self.close)
        self.connect(self.programAboutAction,SIGNAL("activated()"),self.showabout)
        self.connect(self.create, SIGNAL("clicked()"),self.fcreate)
        self.connect(self.apply_patch, SIGNAL("clicked()"),self.fapply_patch)
	

        self.setTabOrder(self.kURLRequester2,self.kURLRequester2_2)
        self.setTabOrder(self.kURLRequester2_2,self.kURLRequester2_3)
        self.setTabOrder(self.kURLRequester2_3,self.create)
        self.setTabOrder(self.create,self.kURLRequester5)
        self.setTabOrder(self.kURLRequester5,self.kURLRequester6)
        self.setTabOrder(self.kURLRequester6,self.kURLRequester7)
        self.setTabOrder(self.kURLRequester7,self.apply_patch)
Exemplo n.º 14
0
Arquivo: icon.py Projeto: eboladev/etc
 def __init__(self, *args):
     apply(KMainWindow.__init__, (self, ) + args)
     self.setIcon(KIconLoader().loadIcon("kmail", KIcon.Desktop))