示例#1
0
文件: uimain.py 项目: lycying/seeking
    def __evt_showContextMenu(self, point):
        _tabbar = self.tabBar()
        for index in range(_tabbar.count()):
            rect = _tabbar.tabRect(index)
            if rect.contains(point):
                menu = QMenu(self)
                action = QAction(
                    "close",
                    self,
                    triggered=lambda: self.__evt_close_tab_click(index))
                action.setEnabled(self.count() > 1 and index is not 0)
                menu.addAction(action)

                action = QAction(
                    "close others",
                    self,
                    triggered=lambda: self.__evt_contextMenuCloseOthers(index))
                action.setEnabled(self.count() > 1)
                menu.addAction(action)

                action = QAction(
                    "close all",
                    self,
                    triggered=lambda: self.__evt_contextMenuCloseOthers(0))
                action.setEnabled(self.count() > 1)
                menu.addAction(action)

                menu.exec_(self.mapToGlobal(point))
示例#2
0
class Trayer(QSystemTrayIcon):
    __instance = None

    @staticmethod
    def new():
        if not Trayer.__instance:
            Trayer.__instance = Trayer()
        return Trayer.__instance

    def __init__(self):
        QSystemTrayIcon.__init__(self)

        self.trayIconMenu = QMenu(Seeking.new())
        self.trayIconMenu.addAction(
            QAction("Mi&nimize", self, triggered=Seeking.new().hide))
        self.trayIconMenu.addAction(
            QAction("Ma&ximize", self, triggered=Seeking.new().showMaximized))
        self.trayIconMenu.addAction(
            QAction("&Restore", self, triggered=Seeking.new().showNormal))
        self.trayIconMenu.addSeparator()
        self.trayIconMenu.addAction(QAction("&Quit", self,
                                            triggered=qApp.quit))
        self.setContextMenu(self.trayIconMenu)

        self.setIcon(QIcon(getPath("iconDir", "logo.png")))
        self.show()
示例#3
0
文件: uimain.py 项目: lycying/seeking
 def __evt_navigation(self):
     menu = QMenu()
     actions = {}
     for i in range(self.count()):
         actions[i] = QAction(self.tabBar().tabIcon(i),self.tabBar().tabText(i),self,\
                         triggered=lambda re,i=i:self.setCurrentIndex(i) and self.navigationButton)
     for key in actions.keys():
         actions[key].setIconVisibleInMenu(True)
         menu.addAction(actions[key])
     self.navigationButton.setMenu(menu)
     self.navigationButton.showMenu()
     menu.clear()
示例#4
0
    def __init__(self, parent):
        QAction.__init__(self, parent)
        self.webview = parent
        self.setIcon(QIcon(getPath('iconDir', 'heditor/table.png')))
        self.setIconVisibleInMenu(True)
        self.setText("table")

        self.infolabel = QLabel("Insert a table")
        menu = QMenu(self.webview)

        action = QWidgetAction(self)
        action.setDefaultWidget(self.infolabel)
        menu.addAction(action)

        action = QWidgetAction(self)
        action.setDefaultWidget(RichHtmlTableQWidget(self))
        menu.addAction(action)

        #action = QAction(QIcon(getPath('iconDir','heditor/table1.png')),"insert styled table",self)
        #action.setIconVisibleInMenu(True)
        #menu.addAction(action)

        action = QAction(
            "insert table...",
            self,
            triggered=lambda: RichHtmlTableQDialog(self.webview).show())
        action.setIconVisibleInMenu(True)
        action.setIcon(QIcon(getPath('iconDir', 'heditor/table.png')))

        menu.addAction(action)

        self.setMenu(menu)
示例#5
0
 def setActionButton(self):
     self.actionButton.setEnabled(False)
     if self.state.state == self.state.ALL:
         menu = QMenu(self.actionButton)
         self.__install_action = menu.addAction(
             self.state.getActionIcon(self.state.INSTALL),
             self.state.getActionName(self.state.INSTALL), self.showBasket)
         self.__remove_action = menu.addAction(
             self.state.getActionIcon(self.state.REMOVE),
             self.state.getActionName(self.state.REMOVE), self.showBasket)
         self.actionButton.setMenu(menu)
     else:
         self.actionButton.setMenu(None)
     self.actionButton.setIcon(self.state.getActionIcon())
     self.actionButton.setText(self.state.getActionName())
示例#6
0
 def setActionButton(self):
     self.actionButton.setEnabled(False)
     if self.state.state == self.state.ALL:
         menu = QMenu(self.actionButton)
         self.__install_action = menu.addAction(self.state.getActionIcon(self.state.INSTALL),
                                                self.state.getActionName(self.state.INSTALL),
                                                self.showBasket)
         self.__remove_action = menu.addAction(self.state.getActionIcon(self.state.REMOVE),
                                               self.state.getActionName(self.state.REMOVE),
                                               self.showBasket)
         self.actionButton.setMenu(menu)
     else:
         self.actionButton.setMenu(None)
     self.actionButton.setIcon(self.state.getActionIcon())
     self.actionButton.setText(self.state.getActionName())
示例#7
0
    def __init__(self):
        QSystemTrayIcon.__init__(self)

        self.trayIconMenu = QMenu(Seeking.new())
        self.trayIconMenu.addAction(
            QAction("Mi&nimize", self, triggered=Seeking.new().hide))
        self.trayIconMenu.addAction(
            QAction("Ma&ximize", self, triggered=Seeking.new().showMaximized))
        self.trayIconMenu.addAction(
            QAction("&Restore", self, triggered=Seeking.new().showNormal))
        self.trayIconMenu.addSeparator()
        self.trayIconMenu.addAction(QAction("&Quit", self,
                                            triggered=qApp.quit))
        self.setContextMenu(self.trayIconMenu)

        self.setIcon(QIcon(getPath("iconDir", "logo.png")))
        self.show()
示例#8
0
 def __init__(self,parent):
     QAction.__init__(self,parent)
     self.webview = parent
     self.setIcon(QIcon(getPath('iconDir','heditor/table.png')))
     self.setIconVisibleInMenu(True)
     self.setText("table")
     
     self.infolabel = QLabel("Insert a table")
     menu = QMenu(self.webview)
     
     action = QWidgetAction(self)
     action.setDefaultWidget(self.infolabel)
     menu.addAction(action)
     
     
     action = QWidgetAction(self)
     action.setDefaultWidget(RichHtmlTableQWidget(self))
     menu.addAction(action)
     
     
     #action = QAction(QIcon(getPath('iconDir','heditor/table1.png')),"insert styled table",self)
     #action.setIconVisibleInMenu(True)
     #menu.addAction(action)
     
     action = QAction("insert table...",self,triggered=lambda:RichHtmlTableQDialog(self.webview).show())
     action.setIconVisibleInMenu(True)
     action.setIcon(QIcon(getPath('iconDir','heditor/table.png')))
     
     menu.addAction(action)
     
     self.setMenu(menu)
示例#9
0
 def __init__(self,parent,attr="forecolor"):
     QAction.__init__(self,parent)
     self.webview = parent
     self.attr = attr
     self.setIcon(QIcon(getPath('iconDir','heditor/paintbrush.png')))
     self.setIconVisibleInMenu(True)
     self.setText("fgcolor")
     
     menu = QMenu(self.webview)
     
     action = QWidgetAction(self)
     action.setDefaultWidget(RichHtmlColorSelectorQWidget(self,self.webview))
     
     menu.addAction(action)
     
     action = QAction("more...",self,triggered = self.__evt_color)
     menu.addAction(action)
     
     self.setMenu(menu)
示例#10
0
 def __evt_contextmenu(self,point):
     """
     show the right menu
     """
     item = self.pluginList.currentItem()
     if item:
         menu = QMenu(self)
        
         
         if item.text(4)=="True":
             
             action = QAction(QApplication.translate("PluginInfoDialog", "DeActive"),self,\
                              triggered=lambda re,name=item.text(0):self.__evt_toggle_active(name, False))
             #core plugin not allowed disabled
             action.setEnabled(not PluginAdapter.new().getPluginByName(item.text(0)).packageName == "__core__")
         else:
             action = QAction(QApplication.translate("PluginInfoDialog", "Active"),self,\
                              triggered=lambda re,name=item.text(0):self.__evt_toggle_active(name, True))
             
         menu.addAction(action)
         menu.exec_(self.mapToGlobal(self.pluginList.mapTo(self,point)))
示例#11
0
文件: tray.py 项目: lycying/seeking
class Trayer(QSystemTrayIcon):
    __instance =  None
    @staticmethod
    def new():
        if not Trayer.__instance:
            Trayer.__instance = Trayer()
        return Trayer.__instance
    
    def __init__(self):
        QSystemTrayIcon.__init__(self)

        self.trayIconMenu = QMenu(Seeking.new())
        self.trayIconMenu.addAction(QAction("Mi&nimize", self, triggered=Seeking.new().hide))
        self.trayIconMenu.addAction(QAction("Ma&ximize", self, triggered=Seeking.new().showMaximized))
        self.trayIconMenu.addAction(QAction("&Restore", self,  triggered=Seeking.new().showNormal))
        self.trayIconMenu.addSeparator()
        self.trayIconMenu.addAction(QAction("&Quit", self,triggered= qApp.quit))
        self.setContextMenu(self.trayIconMenu)
        
        self.setIcon(QIcon(getPath("iconDir","logo.png")))
        self.show()
示例#12
0
文件: tray.py 项目: lycying/seeking
    def __init__(self):
        QSystemTrayIcon.__init__(self)

        self.trayIconMenu = QMenu(Seeking.new())
        self.trayIconMenu.addAction(QAction("Mi&nimize", self, triggered=Seeking.new().hide))
        self.trayIconMenu.addAction(QAction("Ma&ximize", self, triggered=Seeking.new().showMaximized))
        self.trayIconMenu.addAction(QAction("&Restore", self,  triggered=Seeking.new().showNormal))
        self.trayIconMenu.addSeparator()
        self.trayIconMenu.addAction(QAction("&Quit", self,triggered= qApp.quit))
        self.setContextMenu(self.trayIconMenu)
        
        self.setIcon(QIcon(getPath("iconDir","logo.png")))
        self.show()
示例#13
0
 def __evt_contextmenu(self,point):
     """
     show the right menu
     """
     item = self.pluginList.currentItem()
     if item:
         menu = QMenu(self)
         action = QAction(QApplication.translate("default","Install plugins..."),self,triggered=lambda:self.__evt_install_plugin(item))
         menu.addAction(action)
         action = QAction(QApplication.translate("default","Uninstall plugins..."),self)
         menu.addAction(action)
         menu.exec_(self.mapToGlobal(self.pluginList.mapTo(self,point)))
示例#14
0
文件: uimain.py 项目: lycying/seeking
 def __evt_showContextMenu(self,point):
     _tabbar = self.tabBar()
     for index in range(_tabbar.count()):
         rect = _tabbar.tabRect(index)
         if rect.contains(point):
             menu = QMenu(self)
             action = QAction("close",self,triggered=lambda:self.__evt_close_tab_click(index))
             action.setEnabled(self.count()>1 and index is not 0)
             menu.addAction(action)
             
             action = QAction("close others",self,triggered=lambda:self.__evt_contextMenuCloseOthers(index))
             action.setEnabled(self.count()>1)
             menu.addAction(action)
             
             action = QAction("close all",self,triggered=lambda:self.__evt_contextMenuCloseOthers(0))
             action.setEnabled(self.count()>1)
             menu.addAction(action)
             
             menu.exec_(self.mapToGlobal(point))
示例#15
0
 def __evt_contextmenu(self, point):
     """
     show the right menu
     """
     item = self.pluginList.currentItem()
     if item:
         menu = QMenu(self)
         action = QAction(QApplication.translate("default",
                                                 "Install plugins..."),
                          self,
                          triggered=lambda: self.__evt_install_plugin(item))
         menu.addAction(action)
         action = QAction(
             QApplication.translate("default", "Uninstall plugins..."),
             self)
         menu.addAction(action)
         menu.exec_(self.mapToGlobal(self.pluginList.mapTo(self, point)))
示例#16
0
文件: uimain.py 项目: lycying/seeking
 def __evt_navigation(self):
     menu = QMenu()
     actions = {}
     for i in range(self.count()):
         actions[i] = QAction(self.tabBar().tabIcon(i),self.tabBar().tabText(i),self,\
                         triggered=lambda re,i=i:self.setCurrentIndex(i) and self.navigationButton)
     for key in actions.keys():
         actions[key].setIconVisibleInMenu(True)
         menu.addAction(actions[key])
     self.navigationButton.setMenu(menu)
     self.navigationButton.showMenu()
     menu.clear()
示例#17
0
    def __init__(self, parent, attr="forecolor"):
        QAction.__init__(self, parent)
        self.webview = parent
        self.attr = attr
        self.setIcon(QIcon(getPath('iconDir', 'heditor/paintbrush.png')))
        self.setIconVisibleInMenu(True)
        self.setText("fgcolor")

        menu = QMenu(self.webview)

        action = QWidgetAction(self)
        action.setDefaultWidget(
            RichHtmlColorSelectorQWidget(self, self.webview))

        menu.addAction(action)

        action = QAction("more...", self, triggered=self.__evt_color)
        menu.addAction(action)

        self.setMenu(menu)
示例#18
0
    def __evt_contextmenu(self, point):
        """
        show the right menu
        """
        item = self.pluginList.currentItem()
        if item:
            menu = QMenu(self)

            if item.text(4) == "True":

                action = QAction(QApplication.translate("PluginInfoDialog", "DeActive"),self,\
                                 triggered=lambda re,name=item.text(0):self.__evt_toggle_active(name, False))
                #core plugin not allowed disabled
                action.setEnabled(not PluginAdapter.new().getPluginByName(
                    item.text(0)).packageName == "__core__")
            else:
                action = QAction(QApplication.translate("PluginInfoDialog", "Active"),self,\
                                 triggered=lambda re,name=item.text(0):self.__evt_toggle_active(name, True))

            menu.addAction(action)
            menu.exec_(self.mapToGlobal(self.pluginList.mapTo(self, point)))
示例#19
0
    def test_lineedit(self):
        """test LineEdit
        """
        line = LineEdit()
        line.show()

        action1 = QAction(
            QIcon(line.style().standardPixmap(QStyle.SP_ArrowBack)), "Search",
            line)
        menu = QMenu()
        menu.addAction("Regex")
        menu.addAction("Wildcard")
        action1.setMenu(menu)

        line.setAction(action1, LineEdit.LeftPosition)
        self.assertIs(line.actionAt(LineEdit.LeftPosition), action1)
        self.assertTrue(line.button(LineEdit.LeftPosition) is not None)
        self.assertTrue(line.button(LineEdit.RightPosition) is None)

        with self.assertRaises(ValueError):
            line.removeActionAt(100)

        line.removeActionAt(LineEdit.LeftPosition)
        self.assertIs(line.actionAt(LineEdit.LeftPosition), None)

        line.setAction(action1, LineEdit.LeftPosition)

        action2 = QAction(
            QIcon(line.style().standardPixmap(QStyle.SP_TitleBarCloseButton)),
            "Delete", line)
        line.setAction(action2, LineEdit.RightPosition)

        line.setPlaceholderText("Search")
        self.assertEqual(line.placeholderText(), "Search")

        b = line.button(LineEdit.RightPosition)
        b.setFlat(False)
        self.app.exec_()
示例#20
0
文件: uimain.py 项目: lycying/seeking
    def beginFinalInit(self):
        """
        @see: startup
        Notice the __init__ method . we just setup the basic widget.
        And after the language , style ,plugins etc had loaded .
        we call this method . 
        
        Never call it unless you know what's it
        """
        #when at linux platform . the icon is not visible at menu .
        for key in self.__actions.keys():
            self.__actions.get(key).setIconVisibleInMenu(True)

        #--------------->>Seeking init <<-----------------#
        # __init__ menu
        self.getMenu("settings").addAction(self.getAction("perferences"))

        #i18n , must restart program to make it in use
        action_languages = QAction(
            QIcon(getPath('iconDir', 'languages.png')),
            QApplication.translate("default", "Languages"), self)
        action_languages.setIconVisibleInMenu(True)
        menu_languages = QMenu(self)

        trans_dir = QDir(getPrccisePath("transDir", "", "coredir"))
        fileNames = trans_dir.entryList(['i18n*.qm'], QDir.Files, QDir.Name)
        qmFiles = [trans_dir.filePath(fn) for fn in fileNames]

        for qmf in qmFiles:
            translator = QTranslator()
            translator.load(qmf)
            action = menu_languages.addAction(
                translator.translate("default", "English"))
            action.triggered.connect(lambda re, locale=translator.translate(
                "default", "locale"): self.__evt_changeLanguage(locale))

        action_languages.setMenu(menu_languages)
        self.getMenu("settings").addAction(action_languages)

        #style menu use signalmapper
        action_style = QAction(QIcon(getPath('iconDir', 'style.png')),
                               QApplication.translate("default", "Style"),
                               self)
        action_style.setIconVisibleInMenu(True)
        menu_style = QMenu(self)
        for style_item in QStyleFactory.keys():
            action = menu_style.addAction(style_item)
            action.triggered.connect(
                lambda re, style_item=style_item: changeStyle(style_item))
        action_style.setMenu(menu_style)
        self.getMenu("settings").addAction(action_style)

        menu_plugin = self.getMenu("plugins")

        menu_plugin.addAction(self.getAction("plguinInfos"))

        menu_plugin.addSeparator()
        menu_plugin.addAction(self.getAction("plguinRequest"))

        #--------------->>Seeking init <<-----------------#
        # __init__ toolbar
        toolBar = self.addToolBar(QApplication.translate("default", "common"))

        toolBar.addAction(self.getAction("perferences"))
        toolBar.addAction(self.getAction("close"))
        toolBar.addAction(self.getAction("gotohome"))
        toolBar.addAction(self.getAction("help"))

        #--------------->>Seeking init <<-----------------#
        # __init__ status bar
        self.statusBar().showMessage("Seeking ...")

        #--------------->>Seeking init <<-----------------#
        #Effects of a loading progress .
        #Results appear in the tab of the interior, the window has no effect on the global
        self.overlay = Overlay(self.centralWidget())
        self.overlay.hide()

        #--------------->>Seeking init <<-----------------#
        #other
        self.emit(SIGNAL('updateWindows()'))
示例#21
0
 def contextMenuEvent (self, e):
     """
     right click . table oprerators etc...
     """
     menu = QMenu(self)
     
     tag = self.page().mainFrame().hitTestContent(e.pos()).element()
     
     #some table operations
     if tag and tag.tagName().lower() == "td":
         hasPre =  tag.parent().previousSibling().tagName().lower()=="tr"
         hasNext =  tag.parent().nextSibling().tagName().lower()=="tr"
         #move up
         action = QAction(QIcon(getPath('iconDir','heditor/row_up.png')),"Move row up",self,triggered=lambda :self._table_tr_moveup(tag))
         action.setDisabled(not hasPre)
         action.setIconVisibleInMenu(True)
         menu.addAction(action)
         #move down
         action = QAction(QIcon(getPath('iconDir','heditor/row_down.png')),"Move row down",self,triggered=lambda :self._table_tr_movedown(tag))
         action.setDisabled(not hasNext)
         action.setIconVisibleInMenu(True)
         menu.addAction(action)
 
         
         menu.addAction(QAction("Copy row to above",self,triggered=lambda :self._table_tr_insert_above(tag)))
         menu.addAction(QAction("Copy row to below",self,triggered=lambda :self._table_tr_insert_below(tag)))
         menu.addAction(QAction(QIcon(getPath('iconDir','heditor/col_left.png')),"Insert column left",self,triggered=lambda :self._table_column_left(tag)))
         menu.addAction(QAction(QIcon(getPath('iconDir','heditor/col_right.png')),"Insert column right",self,triggered=lambda :self._table_column_right(tag)))
         
         action = QAction("Delete row",self,triggered=lambda :self._table_tr_remove(tag))
         action.setDisabled(not hasPre and not hasNext)
         menu.addAction(action)
         
         menu.addAction(QAction("Delete column",self,triggered=lambda :self._table_column_remove(tag)))
         
         action = QAction("Set Table Style",self,triggered=lambda :self._table_style_change(tag))
         menu.addAction(action)
         
         action = QAction(QIcon(getPath('iconDir','heditor/delete.png')),"Delete table",self,triggered=lambda :self._table_delete(tag))
         action.setIconVisibleInMenu(True)
         menu.addAction(action)
         
         menu.addSeparator()
          
     #Common content menu
     menu.addAction(self.__editActions["selectall"])
     menu.addAction(self.__editActions["copy"])
     menu.addAction(self.__editActions["cut"])
     menu.addAction(self.__editActions["paste"])
     menu.addSeparator()
     
     menuEdit = QMenu("Edit")
     menuEdit.addAction(self.__editActions["bold"])
     menuEdit.addAction(self.__editActions["italic"])
     menuEdit.addAction(self.__editActions["underline"])
     menuEdit.addAction(self.__editActions["strikethrough"])
     menuEdit.addAction(self.__editActions["removeformat"])
     menuEdit.addSeparator()
     menuEdit.addAction(self.__editActions["left"])
     menuEdit.addAction(self.__editActions["center"])
     menuEdit.addAction(self.__editActions["right"])
     menuEdit.addAction(self.__editActions["justify"])
     menuEdit.addSeparator()
     menuEdit.addAction(self.__editActions["indent"])
     menuEdit.addAction(self.__editActions["outdent"]) 
     menuEdit.addAction(self.__editActions["subscript"])
     menuEdit.addAction(self.__editActions["superscript"])
     
     
     menu.addMenu(menuEdit)
     menu.addSeparator()
     
     menuInsert = QMenu("Insert")
     menuInsert.addAction(self.__editActions["image"])
     menuInsert.addAction(self.__editActions["table"])
     menuInsert.addAction(self.__editActions["linkpage"])
     
     menu.addMenu(menuInsert)
     
         
     menu.exec_(e.globalPos())
示例#22
0
 def contextMenuEvent (self, e):
     """
     right click
     """
     menu = QMenu(self)
     
     menu.addAction(self.__editActions["zoomin"])
     menu.addAction(self.__editActions["zoomreset"])
     menu.addAction(self.__editActions["zoomout"])
     menu.addAction(self.__editActions["reload"])
     
     menu.exec_(e.globalPos())
示例#23
0
文件: uimain.py 项目: lycying/seeking
    def beginFinalInit(self):
        """
        @see: startup
        Notice the __init__ method . we just setup the basic widget.
        And after the language , style ,plugins etc had loaded .
        we call this method . 
        
        Never call it unless you know what's it
        """
        #when at linux platform . the icon is not visible at menu .
        for key in self.__actions.keys():
            self.__actions.get(key).setIconVisibleInMenu(True)
            
        #--------------->>Seeking init <<-----------------#
        # __init__ menu
        self.getMenu("settings").addAction(self.getAction("perferences"))
        
        
        #i18n , must restart program to make it in use
        action_languages = QAction(QIcon(getPath('iconDir','languages.png')),QApplication.translate("default", "Languages"),self)
        action_languages.setIconVisibleInMenu(True)
        menu_languages = QMenu(self)
        
        trans_dir = QDir(getPrccisePath("transDir","","coredir"))
        fileNames = trans_dir.entryList(['i18n*.qm'], QDir.Files,QDir.Name)
        qmFiles = [trans_dir.filePath(fn) for fn in fileNames]
    
        for qmf in qmFiles: 
            translator = QTranslator() 
            translator.load(qmf)
            action = menu_languages.addAction(translator.translate("default", "English"))
            action.triggered.connect(lambda re,locale=translator.translate("default", "locale"):self.__evt_changeLanguage(locale))
        
        action_languages.setMenu(menu_languages)
        self.getMenu("settings").addAction(action_languages)
        
        #style menu use signalmapper
        action_style = QAction(QIcon(getPath('iconDir','style.png')),QApplication.translate("default", "Style"),self)
        action_style.setIconVisibleInMenu(True)
        menu_style = QMenu(self)
        for style_item in QStyleFactory.keys():
            action = menu_style.addAction(style_item)
            action.triggered.connect(lambda re,style_item=style_item:changeStyle(style_item))
        action_style.setMenu(menu_style)
        self.getMenu("settings").addAction(action_style)
        
        menu_plugin = self.getMenu("plugins")
        
        menu_plugin.addAction(self.getAction("plguinInfos"))
        
        menu_plugin.addSeparator()
        menu_plugin.addAction(self.getAction("plguinRequest"))
        
        #--------------->>Seeking init <<-----------------#
        # __init__ toolbar
        toolBar = self.addToolBar(QApplication.translate("default","common"))
        
        toolBar.addAction(self.getAction("perferences"))
        toolBar.addAction(self.getAction("close"))
        toolBar.addAction(self.getAction("gotohome"))
        toolBar.addAction(self.getAction("help"))
        
        #--------------->>Seeking init <<-----------------#
        # __init__ status bar
        self.statusBar().showMessage("Seeking ...")
        
        
        #--------------->>Seeking init <<-----------------#
        #Effects of a loading progress .
        #Results appear in the tab of the interior, the window has no effect on the global
        self.overlay = Overlay(self.centralWidget())
        self.overlay.hide()

        #--------------->>Seeking init <<-----------------#
        #other
        self.emit(SIGNAL('updateWindows()'))
示例#24
0
    def initializeOperationActions(self):

        self.showAllAction = QAction(
            KIcon(("applications-other", "package_applications")),
            i18n("All Packages"), self)
        self.connect(self.showAllAction, SIGNAL("triggered()"),
                     lambda: self.cw.switchState(StateManager.ALL))
        self.cw.stateTab.addTab(
            QWidget(), KIcon(("applications-other", "package_applications")),
            i18n("All Packages"))

        self.showInstallAction = QAction(KIcon(("list-add", "add")),
                                         i18n("Installable Packages"), self)
        self.connect(self.showInstallAction, SIGNAL("triggered()"),
                     lambda: self.cw.switchState(StateManager.INSTALL))
        self.cw.stateTab.addTab(QWidget(), KIcon(("list-add", "add")),
                                i18n("Installable Packages"))

        self.showRemoveAction = QAction(KIcon(("list-remove", "remove")),
                                        i18n("Installed Packages"), self)
        self.connect(self.showRemoveAction, SIGNAL("triggered()"),
                     lambda: self.cw.switchState(StateManager.REMOVE))
        self.cw.stateTab.addTab(QWidget(), KIcon(("list-remove", "remove")),
                                i18n("Installed Packages"))

        self.showUpgradeAction = QAction(
            KIcon(("system-software-update", "gear")), i18n("Updates"), self)
        self.connect(self.showUpgradeAction, SIGNAL("triggered()"),
                     lambda: self.cw.switchState(StateManager.UPGRADE))
        self.cw.stateTab.addTab(QWidget(),
                                KIcon(("system-software-update", "gear")),
                                i18n("Updates"))

        self.showPreferences = QAction(
            KIcon(("preferences-system", "package_settings")),
            i18n("Settings"), self)
        self.connect(self.showPreferences, SIGNAL("triggered()"),
                     self.settingsDialog.show)

        self.actionHelp = QAction(KIcon("help"), i18n("Help"), self)
        self.actionHelp.setShortcuts(QKeySequence.HelpContents)
        self.connect(self.actionHelp, SIGNAL("triggered()"), self.showHelp)

        self.actionQuit = QAction(KIcon("exit"), i18n("Quit"), self)
        self.actionQuit.setShortcuts(QKeySequence.Quit)
        self.connect(self.actionQuit, SIGNAL("triggered()"), qApp.exit)

        self.cw.menuButton.setMenu(QMenu('MainMenu', self.cw.menuButton))
        self.cw.menuButton.setIcon(
            KIcon(("preferences-system", "package_settings")))
        self.cw.menuButton.menu().clear()

        self.cw.contentHistory.hide()

        self.cw.menuButton.menu().addAction(self.showPreferences)
        self.cw.menuButton.menu().addSeparator()
        self.cw.menuButton.menu().addAction(self.actionHelp)
        self.cw.menuButton.menu().addAction(self.actionQuit)

        self.cw._states = {
            self.cw.state.ALL: (0, self.showAllAction),
            self.cw.state.INSTALL: (1, self.showInstallAction),
            self.cw.state.REMOVE: (2, self.showRemoveAction),
            self.cw.state.UPGRADE: (3, self.showUpgradeAction)
        }

        self.showAllAction.setChecked(True)
        self.cw.checkUpdatesButton.hide()
        self.cw.checkUpdatesButton.setIcon(KIcon(("view-refresh", "reload")))
        self.cw.showBasketButton.clicked.connect(self.cw.showBasket)

        # Little time left for the new ui
        self.menuBar().setVisible(False)
        self.cw.switchState(self.cw.state.ALL)
示例#25
0
    def contextMenuEvent(self, e):
        """
        right click . table oprerators etc...
        """
        menu = QMenu(self)

        tag = self.page().mainFrame().hitTestContent(e.pos()).element()

        #some table operations
        if tag and tag.tagName().lower() == "td":
            hasPre = tag.parent().previousSibling().tagName().lower() == "tr"
            hasNext = tag.parent().nextSibling().tagName().lower() == "tr"
            #move up
            action = QAction(QIcon(getPath('iconDir', 'heditor/row_up.png')),
                             "Move row up",
                             self,
                             triggered=lambda: self._table_tr_moveup(tag))
            action.setDisabled(not hasPre)
            action.setIconVisibleInMenu(True)
            menu.addAction(action)
            #move down
            action = QAction(QIcon(getPath('iconDir', 'heditor/row_down.png')),
                             "Move row down",
                             self,
                             triggered=lambda: self._table_tr_movedown(tag))
            action.setDisabled(not hasNext)
            action.setIconVisibleInMenu(True)
            menu.addAction(action)

            menu.addAction(
                QAction("Copy row to above",
                        self,
                        triggered=lambda: self._table_tr_insert_above(tag)))
            menu.addAction(
                QAction("Copy row to below",
                        self,
                        triggered=lambda: self._table_tr_insert_below(tag)))
            menu.addAction(
                QAction(QIcon(getPath('iconDir', 'heditor/col_left.png')),
                        "Insert column left",
                        self,
                        triggered=lambda: self._table_column_left(tag)))
            menu.addAction(
                QAction(QIcon(getPath('iconDir', 'heditor/col_right.png')),
                        "Insert column right",
                        self,
                        triggered=lambda: self._table_column_right(tag)))

            action = QAction("Delete row",
                             self,
                             triggered=lambda: self._table_tr_remove(tag))
            action.setDisabled(not hasPre and not hasNext)
            menu.addAction(action)

            menu.addAction(
                QAction("Delete column",
                        self,
                        triggered=lambda: self._table_column_remove(tag)))

            action = QAction("Set Table Style",
                             self,
                             triggered=lambda: self._table_style_change(tag))
            menu.addAction(action)

            action = QAction(QIcon(getPath('iconDir', 'heditor/delete.png')),
                             "Delete table",
                             self,
                             triggered=lambda: self._table_delete(tag))
            action.setIconVisibleInMenu(True)
            menu.addAction(action)

            menu.addSeparator()

        #Common content menu
        menu.addAction(self.__editActions["selectall"])
        menu.addAction(self.__editActions["copy"])
        menu.addAction(self.__editActions["cut"])
        menu.addAction(self.__editActions["paste"])
        menu.addSeparator()

        menuEdit = QMenu("Edit")
        menuEdit.addAction(self.__editActions["bold"])
        menuEdit.addAction(self.__editActions["italic"])
        menuEdit.addAction(self.__editActions["underline"])
        menuEdit.addAction(self.__editActions["strikethrough"])
        menuEdit.addAction(self.__editActions["removeformat"])
        menuEdit.addSeparator()
        menuEdit.addAction(self.__editActions["left"])
        menuEdit.addAction(self.__editActions["center"])
        menuEdit.addAction(self.__editActions["right"])
        menuEdit.addAction(self.__editActions["justify"])
        menuEdit.addSeparator()
        menuEdit.addAction(self.__editActions["indent"])
        menuEdit.addAction(self.__editActions["outdent"])
        menuEdit.addAction(self.__editActions["subscript"])
        menuEdit.addAction(self.__editActions["superscript"])

        menu.addMenu(menuEdit)
        menu.addSeparator()

        menuInsert = QMenu("Insert")
        menuInsert.addAction(self.__editActions["image"])
        menuInsert.addAction(self.__editActions["table"])
        menuInsert.addAction(self.__editActions["linkpage"])

        menu.addMenu(menuInsert)

        menu.exec_(e.globalPos())