Exemplo n.º 1
0
    def setupActions (self):
        clearAction = KAction(KIcon("edit-clear"), i18n("Clear"), self)
        self.actionCollection().addAction("clear", clearAction)
        self.connect (clearAction, SIGNAL ("triggered(bool)"), self.textArea.clear)

        KStandardAction.quit (app.quit, self.actionCollection())

        self.setupGUI(QSize (600, 400), KXmlGuiWindow.Default, os.path.join (sys.path [0],"kactionui.rc"))
Exemplo n.º 2
0
    def setupActions(self):
        clearAction = KAction(KIcon("edit-clear"), i18n("Clear"), self)
        self.actionCollection().addAction("clear", clearAction)
        self.connect(clearAction, SIGNAL("triggered(bool)"),
                     self.textArea.clear)

        KStandardAction.quit(app.quit, self.actionCollection())

        self.setupGUI(QSize(600, 400), KXmlGuiWindow.Default,
                      os.path.join(sys.path[0], "kactionui.rc"))
Exemplo n.º 3
0
    def build_menu(self):
        if ConfigManager.SETTINGS[SHOW_TRAY_ICON]:
            # Get phrase folders to add to main menu
            folders = []
            items = []

            for folder in self.configManager.allFolders:
                if folder.showInTrayMenu:
                    folders.append(folder)

            for item in self.configManager.allItems:
                if item.showInTrayMenu:
                    items.append(item)

            # Construct main menu
            menu = popupmenu.PopupMenu(self.app.service, folders, items, False,
                                       "AutoKey")
            if len(items) > 0:
                menu.addSeparator()

            self.toggleAction = KToggleAction(i18n("&Enable Monitoring"), menu)
            self.toggleAction.connect(self.toggleAction, SIGNAL("triggered()"),
                                      self.on_enable_toggled)
            self.toggleAction.setChecked(self.app.service.is_running())
            self.toggleAction.setEnabled(not self.app.serviceDisabled)

            menu.addAction(self.toggleAction)
            menu.addAction(KIcon("edit-clear"), i18n("&Hide Icon"),
                           self.on_hide_icon)
            menu.addAction(KIcon("configure"), i18n("&Show Main Window"),
                           self.on_configure)
            menu.addAction(KStandardAction.quit(self.on_quit, menu))
            self.icon.setContextMenu(menu)
Exemplo n.º 4
0
    def build_menu(self):
        if ConfigManager.SETTINGS[SHOW_TRAY_ICON]:
            # Get phrase folders to add to main menu
            folders = []
            items = []

            for folder in self.configManager.allFolders:
                if folder.showInTrayMenu:
                    folders.append(folder)
            
            for item in self.configManager.allItems:
                if item.showInTrayMenu:
                    items.append(item)
                    
            # Construct main menu
            menu = popupmenu.PopupMenu(self.app.service, folders, items, False, "AutoKey")
            if len(items) > 0:
                menu.addSeparator()
            
            self.toggleAction = KToggleAction(i18n("&Enable Monitoring"), menu)
            self.toggleAction.connect(self.toggleAction, SIGNAL("triggered()"), self.on_enable_toggled)
            self.toggleAction.setChecked(self.app.service.is_running())
            self.toggleAction.setEnabled(not self.app.serviceDisabled)           
            
            menu.addAction(self.toggleAction)
            menu.addAction(KIcon("edit-clear"), i18n("&Hide Icon"), self.on_hide_icon)
            menu.addAction(KIcon("configure"), i18n("&Show Main Window"), self.on_configure)
            menu.addAction(KStandardAction.quit(self.on_quit, menu))
            self.icon.setContextMenu(menu)
Exemplo n.º 5
0
    def setupActions(self):
        self._editAction = QAction(KIcon('document-properties'),
            i18n('&Edit Translation'), self)
        self._editAction.setShortcut(Qt.Key_Return)
        self._editAction.setShortcutContext(Qt.WidgetShortcut)
        self.connect(self._editAction, SIGNAL("triggered(bool)"),
            lambda: self.vocabularyListView.edit(
                self.vocabularyListView.currentIndex()))
        self.connect(self.vocabularyListView, SIGNAL("returnPressed()"),
            self._editAction.trigger) # TODO

        self._selectAllAction = KStandardAction.selectAll(
            self.vocabularyListView.selectAll, self)

        self._removeAction = QAction(KIcon('list-remove'),
            i18n('&Remove Selected'), self)
        #c = QShortcut(self)
        #c.setKey(Qt.Key_Delete)
        #c.setContext(Qt.WidgetShortcut)
        #self.connect(c, SIGNAL("activated()"), self._removeAction.trigger)
        self._removeAction.setShortcut(Qt.Key_Delete)
        self._removeAction.setShortcutContext(Qt.WidgetShortcut)
        self.connect(self.vocabularyListView, SIGNAL("deletePressed()"),
            self._removeAction.trigger) # TODO
        self.connect(self.vocabularyListView.selectionModel(),
            SIGNAL("selectionChanged(const QItemSelection &, const QItemSelection &)"),
            lambda: self._removeAction.setEnabled(
                self.vocabularyListView.selectionModel().hasSelection()))
        self.connect(self._removeAction, SIGNAL("triggered(bool)"),
            lambda: self.vocabularyModel.remove(
                self.vocabularyListView.selectedIndexes()))
Exemplo n.º 6
0
    def setupActions (self):
        clearAction = KAction(KIcon("edit-clear"), i18n("Clear"), self)
        

        dfltShortcut   = KAction.ShortcutTypes (KAction.DefaultShortcut)
        activeShortcut = KAction.ShortcutTypes (KAction.ActiveShortcut)

        clearAction.setShortcut(Qt.CTRL+Qt.Key_W, dfltShortcut | activeShortcut)

        self.actionCollection().addAction("clear", clearAction)

        self.connect (clearAction, SIGNAL ("triggered(bool)"), self.textArea.clear)

 
        KStandardAction.quit (app.quit, self.actionCollection())

        self.setupGUI(QSize (600, 400), KXmlGuiWindow.Default, os.path.join (sys.path [0], "kactionui.rc"))
Exemplo n.º 7
0
    def setupActions(self):
        clearAction = KAction(KIcon("edit-clear"), i18n("Clear"), self)

        dfltShortcut = KAction.ShortcutTypes(KAction.DefaultShortcut)
        activeShortcut = KAction.ShortcutTypes(KAction.ActiveShortcut)

        clearAction.setShortcut(Qt.CTRL + Qt.Key_W,
                                dfltShortcut | activeShortcut)

        self.actionCollection().addAction("clear", clearAction)

        self.connect(clearAction, SIGNAL("triggered(bool)"),
                     self.textArea.clear)

        KStandardAction.quit(app.quit, self.actionCollection())

        self.setupGUI(QSize(600, 400), KXmlGuiWindow.Default,
                      os.path.join(sys.path[0], "kactionui.rc"))
Exemplo n.º 8
0
    def setup_action_collection(self):
        """Set up the action collection by adding the actions."""

        action_collection = self.actionCollection()

        # Addition to the action collection
        action_collection.addAction("connect", self.connect_action)
        action_collection.addAction("fetch", self.fetch_action)
        action_collection.addAction("clean", self.clean_action)
        action_collection.addAction("batchDownload",
                                    self.batch_download_action)
        action_collection.addAction("poolDownload", self.pool_toggle_action)
        action_collection.addAction("tagDisplay", self.tag_display_action)

        KStandardAction.quit(self.close, action_collection)
        KStandardAction.preferences(self.show_preferences, action_collection)

        action_collection.removeAction(
            action_collection.action("help_contents"))
        action_collection.actionHovered.connect(self.setup_action_tooltip)
Exemplo n.º 9
0
 def __init__(self, icon, parent):
     KStatusNotifierItem.__init__(self, parent)
     self.setStandardActionsEnabled(False)
     self.connect(self.contextMenu(), SIGNAL('aboutToShow()'), self.__buildMenu)
     self.actionQuit = KStandardAction.quit(parent.app, SLOT("quit()"), self)
     self.hideResoreAction = QAction('Minimize', self.contextMenu())
     self.connect(self.hideResoreAction, SIGNAL('triggered()'), SIGNAL("activate()"))
     self.icon = icon
     self.parent = parent
     self.setIconByName(icon)
     self.setCategory(1)
     self.setStatus(2)
Exemplo n.º 10
0
    def setup_action_collection(self):

        """Set up the action collection by adding the actions."""

        action_collection = self.actionCollection()

        # Addition to the action collection
        action_collection.addAction("connect", self.connect_action)
        action_collection.addAction("fetch", self.fetch_action)
        action_collection.addAction("clean", self.clean_action)
        action_collection.addAction("batchDownload", self.batch_download_action)
        action_collection.addAction("poolDownload", self.pool_toggle_action)
        action_collection.addAction("tagDisplay", self.tag_display_action)

        KStandardAction.quit (self.close, action_collection)
        KStandardAction.preferences(self.show_preferences,
                                    action_collection)

        action_collection.removeAction(
            action_collection.action("help_contents"))
        action_collection.actionHovered.connect(self.setup_action_tooltip)
Exemplo n.º 11
0
 def __init__(self, icon, parent):
     KStatusNotifierItem.__init__(self, parent)
     self.setStandardActionsEnabled(False)
     self.connect(self.contextMenu(), SIGNAL('aboutToShow()'),
                  self.__buildMenu)
     self.actionQuit = KStandardAction.quit(parent.app, SLOT("quit()"),
                                            self)
     self.hideResoreAction = QAction('Minimize', self.contextMenu())
     self.connect(self.hideResoreAction, SIGNAL('triggered()'),
                  SIGNAL("activate()"))
     self.icon = icon
     self.parent = parent
     self.setIconByPixmap(icon)
     self.setCategory(1)
     self.setStatus(2)
Exemplo n.º 12
0
 def createActions(self):
     actionCollection = self.window.actionCollection()
     # File Menu
     KStandardAction.openNew(self.new_file, actionCollection)
     KStandardAction.open(self.open_file, actionCollection)
     KStandardAction.openRecent(self.open_file_recent, actionCollection)   
     KStandardAction.save(self.save_file, actionCollection)
     KStandardAction.quit(self.quit, actionCollection)
     
     # Edit Menu
     KStandardAction.undo(self.undo, actionCollection)
     KStandardAction.redo(self.redo, actionCollection)
     KStandardAction.copy(self.copy, actionCollection)
     KStandardAction.paste(self.paste, actionCollection)
     KStandardAction.cut(self.cut, actionCollection)
     
     # View Menu
     KStandardAction.zoomIn(self.zoom_in, actionCollection)
     KStandardAction.zoomOut(self.zoom_out, actionCollection)
     
     # Settings Menu
     KStandardAction.selectAll(self.select_all, actionCollection)
Exemplo n.º 13
0
    def setupActions(self):
        """Sets up all actions (signal/slot combinations)."""
        # standard action
        KStandardAction.quit(g_app.quit, self.actionCollection())

        # dictionary actions
        self.dictionaryPage.registerGlobalActions(self.actionCollection())
        # update dictionaries
        if self.updateDialog:
            self.updateAction = self.updateDialog.updateAction(
                self.actionCollection())
            # optimise database
            self.updateDialog.optimiseAction(self.actionCollection())
        else:
            self.updateAction = None

        # search bar
        self.characterCombo = KHistoryComboBox()
        self.characterCombo.setSizePolicy(QSizePolicy.Expanding,
            QSizePolicy.Fixed)
        font = QFont()
        font.setPointSize(13)
        self.characterCombo.setFont(font)
        self.characterCombo.setObjectName("characterCombo")
        self.connect(self.characterCombo, SIGNAL("activated(const QString &)"),
            self.slotCharacterComboActivated)

        comboAction = KAction(self)
        comboAction.setText(i18n("Search bar"))
        comboAction.setShortcut(Qt.Key_F6)
        self.connect(comboAction, SIGNAL("triggered()"),
            self.slotSearchComboActivated)
        comboAction.setDefaultWidget(self.characterCombo)
        comboAction.setWhatsThis(
            i18n("<html>Search bar<br/><br/>Enter character of search string</html>"))
        self.actionCollection().addAction("searchbar", comboAction)

        goUrl = self.actionCollection().addAction("go_search")
        goUrl.setIcon(KIcon("go-jump-locationbar"))
        goUrl.setText(i18n("Go"))
        self.connect(goUrl, SIGNAL("triggered()"),
            lambda: self.slotCharacterComboActivated(
                self.characterCombo.currentText()))
        goUrl.setWhatsThis(
            i18n("<html>Go<br /><br />Searches for the string given in the search bar.</html>"))

        # clear search bar action
        clearLocationAction = KAction(KIcon("edit-clear-locationbar-ltr"),
            i18n("Clear &Location Bar"), self)
        clearLocationAction.setShortcut(Qt.CTRL + Qt.Key_L)
        clearLocationAction.setWhatsThis(
            i18n("Clears the location bar and places the cursor inside"))
        self.actionCollection().addAction("clearlocationbar",
            clearLocationAction)
        self.connect(clearLocationAction, SIGNAL("triggered(bool)"),
            self.characterCombo.clearEditText)
        self.connect(clearLocationAction, SIGNAL("triggered(bool)"),
            self.characterCombo.setFocus)

        # show/hide character page
        self.toggleToolboxAction = KToggleAction(KIcon("view-sidetree"),
            i18n("Show Character Toolbox"), self)
        self.toggleToolboxAction.setShortcut(Qt.Key_F9)
        self.toggleToolboxAction.setWhatsThis(
            i18n("Shows and Hides the character choosing toolbox"))
        self.actionCollection().addAction("showtoolbox",
            self.toggleToolboxAction)
        self.connect(self.toggleToolboxAction, SIGNAL("triggered(bool)"),
            self.slotToggleToolbox)

        # auto-lookup clipboard
        self.autoLookupAction = KToggleAction(i18n("&Auto-Lookup"), self)
        self.autoLookupAction.setToolTip(
            i18n("Automatically look up text selected by the mouse cursor."))
        self.autoLookupAction.setWhatsThis(
            i18n("Automatically look up text selected by the mouse cursor."))
        self.actionCollection().addAction("autolookup", self.autoLookupAction)
        self.connect(self.autoLookupAction, SIGNAL("triggered(bool)"),
            self.setAutoLookup)
        self.autoLookupAction.setIcon(
            QIcon(util.getIcon('auto-lookup-selection.png')))

        self.connect(QApplication.clipboard(), SIGNAL("selectionChanged()"),
            self.slotSelectionChanged)
Exemplo n.º 14
0
    def createActions(self):
        actionCollection = self.window.actionCollection()
        KStandardAction.openNew(self.new_file, actionCollection)
        KStandardAction.open(self.open_file, actionCollection)
        KStandardAction.save(self.save_file, actionCollection)
        KStandardAction.undo(self.undo, actionCollection)
        KStandardAction.redo(self.redo, actionCollection)

        KStandardAction.quit(self.quit, actionCollection)
Exemplo n.º 15
0
    def __init__(self, parent = None):
        QObject.__init__(self)
        
#        if os.path.exists("netkut-window.ui"):
#            APPDIR = QDir.currentPath()
#        else:
#            file =  KStandardDirs.locate("appdata", "netkut-window.ui")
#            APPDIR = file.left(file.lastIndexOf('/'))

        self.mainWindow = MainWindow()
        uic.loadUi(os.path.join (sys.path [0],  "netkut-window.ui"), self.mainWindow)
        
        self.sysTray = KStatusNotifierItem(self.mainWindow)
        self.sysTray.setCategory(KStatusNotifierItem.ApplicationStatus)
        self.sysTray.setIconByName("edit-cut")
        self.sysTray.setAssociatedWidget(self.mainWindow)
        self.sysTray.setStatus(KStatusNotifierItem.Active)
        
        self.actionScan = self.mainWindow.actionCollection().addAction("scan")
        self.actionScan.setIcon(KIcon("edit-web-search"))
        self.actionScan.setText(i18n("&Scan"))
        self.actionScan.setShortcut(QKeySequence(Qt.Key_F5))
        self.actionScan.setToolTip(i18n("Scanning network for live host(s)"))
        self.connect(self.actionScan, SIGNAL("triggered()"), self.onScan)
        
        self.actionCut = self.mainWindow.actionCollection().addAction("cut")
        self.actionCut.setIcon(KIcon("edit-cut"))
        self.actionCut.setText(i18n("&Cut"))
        self.actionCut.setShortcut(Qt.CTRL + Qt.Key_X)
        self.actionCut.setToolTip(i18n("Cutting the internet from selected victim's IP address"))
        self.connect(self.actionCut, SIGNAL("triggered()"), self.onCut)
        
        self.actionResume = self.mainWindow.actionCollection().addAction("resume")
        self.actionResume.setIcon(KIcon("edit-undo"))
        self.actionResume.setText(i18n("&Resume"))
        self.actionResume.setShortcut(Qt.CTRL + Qt.Key_R)
        self.actionResume.setToolTip(i18n("Stop all cut operation"))
        self.connect(self.actionResume, SIGNAL("triggered()"), self.onResume)
        
        self.actionProtect = self.mainWindow.actionCollection().addAction("protect")
        self.actionProtect.setIcon(KIcon("security-low"))
        self.actionProtect.setText(i18n("Unprotected"))
        self.actionProtect.setToolTip(i18n("Enable protection mode"))
        self.actionProtect.setCheckable(True)
        self.connect(self.actionProtect, SIGNAL("triggered()"), self.onProtectMe)
        
        self.actionChangeMac = self.mainWindow.actionCollection().addAction("change_mac")
        self.actionChangeMac.setIcon(KIcon("document-edit"))
        self.actionChangeMac.setText(i18n("Change MAC"))
        self.actionChangeMac.setToolTip(i18n("Change your MAC Address"))
        self.connect(self.actionChangeMac, SIGNAL("triggered()"), self.onChangeMAC)
        
        KStandardAction.quit(app.quit, self.mainWindow.actionCollection())
        
        self.mainWindow.createGUI(os.path.join (sys.path [0], "netkutui.rc"))
        
        self.icard = self.Get_parameter('ip route list | grep "default" | cut -d " " -s -f 5')
        self.myMAC = self.Get_parameter("ip addr show dev " + self.icard +  "|awk '/ether/{ print $2 }'")
        self.gwip = self.Get_parameter('ip route list | grep "default" | cut -d" " -f3')
        self.gwMAC = self.Get_parameter('arping -I '+ self.icard +' -f '+ self.gwip +' | grep "Unicast" | cut -d" " -f5 | cut -d"[" -f2 | cut -d"]" -f1')
        self.myip = self.Get_parameter("ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' |cut -d: -f2 | awk '{ print $1}'")