Ejemplo n.º 1
0
    def createActions(self):
        self.newLetterAct = QAction(QIcon.fromTheme('document-new', QIcon(':/images/new.png')), "&New Letter",
                self, shortcut=QKeySequence.New,
                statusTip="Create a new form letter", triggered=self.newLetter)

        self.saveAct = QAction(QIcon.fromTheme('document-save', QIcon(':/images/save.png')), "&Save...", self,
                shortcut=QKeySequence.Save,
                statusTip="Save the current form letter", triggered=self.save)

        self.printAct = QAction(QIcon.fromTheme('document-print', QIcon(':/images/print.png')), "&Print...", self,
                shortcut=QKeySequence.Print,
                statusTip="Print the current form letter",
                triggered=self.print_)

        self.undoAct = QAction(QIcon.fromTheme('edit-undo', QIcon(':/images/undo.png')), "&Undo", self,
                shortcut=QKeySequence.Undo,
                statusTip="Undo the last editing action", triggered=self.undo)

        self.quitAct = QAction("&Quit", self, shortcut="Ctrl+Q",
                statusTip="Quit the application", triggered=self.close)

        self.aboutAct = QAction("&About", self,
                statusTip="Show the application's About box",
                triggered=self.about)

        self.aboutQtAct = QAction("About &Qt", self,
                statusTip="Show the Qt library's About box",
                triggered=QApplication.instance().aboutQt)
Ejemplo n.º 2
0
    def _layout(self):
        layout = QHBoxLayout(self)
        self.setLayout(layout)

        self.tree = QTreeView(self)
        self.tree.setModel(self.model)
        self.tree.setUniformRowHeights(True)
        self.tree.setColumnWidth(0, 200)
        self.tree.setDragEnabled(True)
        self.tree.setDragDropMode(QAbstractItemView.InternalMove)
        self.tree.viewport().setAcceptDrops(True)
        layout.addWidget(self.tree, 1)

        buttons = QVBoxLayout()
        buttons.setAlignment(Qt.AlignTop)

        add_button = QPushButton(QIcon.fromTheme("list-add"), "", self)
        add_button.setToolTip("Add application")
        add_button.clicked.connect(self.on_add)
        buttons.addWidget(add_button)

        mkdir_button = QPushButton(QIcon.fromTheme("folder-new"), "", self)
        mkdir_button.setToolTip("Make directory")
        mkdir_button.clicked.connect(self.on_mkdir)
        buttons.addWidget(mkdir_button)

        delete_button = QPushButton(QIcon.fromTheme("list-remove"), "", self)
        delete_button.setToolTip("Remove selected item")
        delete_button.clicked.connect(self.on_delete)
        buttons.addWidget(delete_button)

        layout.addLayout(buttons)
Ejemplo n.º 3
0
    def __init__(self, timeline, parent, topic):
        MessageView.__init__(self, timeline, topic)

        self._parent = parent
        self._stamp = None
        self._name = parent.objectName()

        self.toolbar = QToolBar()
        self._first_action = QAction(QIcon.fromTheme('go-first'), '',
                                     self.toolbar)
        self._first_action.triggered.connect(self.navigate_first)
        self.toolbar.addAction(self._first_action)
        self._prev_action = QAction(QIcon.fromTheme('go-previous'), '',
                                    self.toolbar)
        self._prev_action.triggered.connect(self.navigate_previous)
        self.toolbar.addAction(self._prev_action)
        self._next_action = QAction(QIcon.fromTheme('go-next'), '',
                                    self.toolbar)
        self._next_action.triggered.connect(self.navigate_next)
        self.toolbar.addAction(self._next_action)
        self._last_action = QAction(QIcon.fromTheme('go-last'), '',
                                    self.toolbar)
        self._last_action.triggered.connect(self.navigate_last)
        self.toolbar.addAction(self._last_action)
        parent.layout().addWidget(self.toolbar)
Ejemplo n.º 4
0
 def __init__(self, parent):
     super().__init__(parent)
     self.setWindowTitle("muSync - Logs")
     self.resize(540, 250)
     self.setModal(False)
     logLayout = QVBoxLayout(self)
     self.__log = QTextBrowser(parent)
     self.__log.setAcceptRichText(True)
     self.__log.setReadOnly(True)
     self.__log.textChanged.connect(self.__scroll)
     logLayout.addWidget(self.__log)
     buttonsLayout = QHBoxLayout()
     self.__autoScroll = QCheckBox("Auto-scroll")
     self.__autoScroll.setChecked(True)
     buttonsLayout.addWidget(self.__autoScroll)
     clearButton = QPushButton(QIcon.fromTheme("edit-delete"), "C&lear")
     clearButton.clicked.connect(self.__log.clear)
     buttonsLayout.addWidget(clearButton)
     copyButton = QPushButton(QIcon.fromTheme("edit-copy"), "Co&py")
     copyButton.clicked.connect(self.__copy_log)
     buttonsLayout.addWidget(copyButton)
     closeButton = QPushButton(QIcon.fromTheme("dialog-close"), "&Close")
     closeButton.clicked.connect(self.close)
     buttonsLayout.addWidget(closeButton)
     logLayout.addLayout(buttonsLayout)
Ejemplo n.º 5
0
    def initActions(self):
        self.newGameAction = QAction("&New Game", self)
        self.newGameAction.setIcon(QIcon(CONST.ICONS["New"]))
        self.newGameAction.triggered.connect(self.newGame)
        self.newGameAction.setShortcut('CTRL+N')

        self.openAction = QAction("&Open", self)
        self.openAction.setIcon(QIcon(CONST.ICONS["Open"]))
        self.openAction.triggered.connect(self.openFile)
        self.openAction.setShortcut('CTRL+O')

        self.saveGameAction = QAction("&Save", self)
        self.saveGameAction.setIcon(QIcon(CONST.ICONS["Save"]))
        self.saveGameAction.triggered.connect(self.saveGame)
        self.saveGameAction.setShortcut('CTRL+S')

        self.saveAsAction = QAction("Save &As", self)
        self.saveAsAction.setIcon(QIcon(CONST.ICONS["Save"]))
        self.saveAsAction.triggered.connect(self.saveGameAs)
        self.saveAsAction.setShortcut('CTRL+A')

        self.showAboutDialogAction = QAction("&About DCS Liberation", self)
        self.showAboutDialogAction.setIcon(QIcon.fromTheme("help-about"))
        self.showAboutDialogAction.triggered.connect(self.showAboutDialog)

        self.showLiberationPrefDialogAction = QAction("&Preferences", self)
        self.showLiberationPrefDialogAction.setIcon(
            QIcon.fromTheme("help-about"))
        self.showLiberationPrefDialogAction.triggered.connect(
            self.showLiberationDialog)
Ejemplo n.º 6
0
    def show_rightclick_menu(self):
        """

        :type self: SteamAccountSwitcherGui
        """

        right_menu = QMenu()

        selected = self.accounts_list.currentItem()
        if not self.accounts_list.selectedItems():
            add_account_action = QAction(_("Add account"), self)
            add_account_action.triggered.connect(
                lambda: self.account_dialog(True))
            right_menu.addAction(add_account_action)
            right_menu.exec_(QCursor.pos())
            return
        login_name = selected.data(5)
        account = self.switcher.settings["users"].get(login_name, {})

        login_action = QAction(_("Login"), self)
        edit_action = QAction(_("Edit"), self)
        delete_action = QAction(_("Delete"), self)
        open_profile_action = QAction(_("Steam profile"), self)
        steampage_menu = QMenu(_("Steam profile"), self)

        edit_action.setIcon(QIcon.fromTheme("document-edit"))
        delete_action.setIcon(QIcon.fromTheme("edit-delete"))
        open_profile_action.setIcon(QIcon.fromTheme("internet-web-browser"))

        right_menu.addActions([login_action, edit_action, delete_action])
        right_menu.addSeparator()
        right_menu.addAction(open_profile_action)
        right_menu.addMenu(steampage_menu)

        login_action.triggered.connect(lambda: self.steam_login(login_name))
        edit_action.triggered.connect(lambda: self.account_dialog())
        delete_action.triggered.connect(
            lambda: self.remove_account(login_name))

        open_profile_action.triggered.connect(
            lambda: self.open_steam_profile(account))

        steampage_menu.triggered.connect(
            lambda: self.open_steam_profile(account))

        steampage_menu_actions = QActionGroup(steampage_menu)
        steampage_menu_inventory = QAction(_('Inventory'),
                                           steampage_menu_actions,
                                           checkable=True,
                                           data="nothing")

        open_profile_action.setDisabled(True)
        if account.get("steam_user", {}).get("profileurl"):
            open_profile_action.setEnabled(True)
            steampage_menu.addActions([steampage_menu_inventory])

        if self.accounts_list.selectedItems():
            right_menu.exec_(QCursor.pos())
Ejemplo n.º 7
0
    def setPlaying(self, playing):
        self.playing = playing

        if self.playing:
            self.setText(self.pauseText)
            self.setIcon(QIcon.fromTheme("media-playback-pause"))
        else:
            self.setText(self.playText)
            self.setIcon(QIcon.fromTheme("media-playback-start"))
Ejemplo n.º 8
0
    def contextMenuRequested(self, point):
        menu = QMenu()
        actionFile = menu.addAction(QIcon.fromTheme("video-x-generic"),
                                    "open File (o)")
        actionclipboard = menu.addSeparator()
        actionURL = menu.addAction(QIcon.fromTheme("browser"),
                                   "URL from Clipboard (u)")
        actionclipboard = menu.addSeparator()
        actionYTurl = menu.addAction(QIcon.fromTheme("youtube"),
                                     "URL from YouTube (y)")
        actionclipboard = menu.addSeparator()
        actionToggle = menu.addAction(QIcon.fromTheme("next"),
                                      "show / hide Slider (s)")
        actionFull = menu.addAction(QIcon.fromTheme("view-fullscreen"),
                                    "Fullscreen (f)")
        action169 = menu.addAction(QIcon.fromTheme("tv-symbolic"), "16 : 9")
        action43 = menu.addAction(QIcon.fromTheme("tv-symbolic"), "4 : 3")
        actionSep = menu.addSeparator()
        actionInfo = menu.addAction(QIcon.fromTheme("help-about"), "Info (i)")
        action5 = menu.addSeparator()
        actionQuit = menu.addAction(QIcon.fromTheme("application-exit"),
                                    "Exit (q)")

        actionFile.triggered.connect(self.openFile)
        actionQuit.triggered.connect(self.handleQuit)
        actionFull.triggered.connect(self.handleFullscreen)
        actionInfo.triggered.connect(self.handleInfo)
        actionToggle.triggered.connect(self.toggleSlider)
        actionURL.triggered.connect(self.playFromURL)
        actionYTurl.triggered.connect(self.getYTUrl)
        action169.triggered.connect(self.screen169)
        action43.triggered.connect(self.screen43)
        menu.exec_(self.mapToGlobal(point))
Ejemplo n.º 9
0
    def initActions(self):
        self.newGameAction = QAction("&New Game", self)
        self.newGameAction.setIcon(QIcon(CONST.ICONS["New"]))
        self.newGameAction.triggered.connect(self.newGame)
        self.newGameAction.setShortcut("CTRL+N")

        self.openAction = QAction("&Open", self)
        self.openAction.setIcon(QIcon(CONST.ICONS["Open"]))
        self.openAction.triggered.connect(self.openFile)
        self.openAction.setShortcut("CTRL+O")

        self.saveGameAction = QAction("&Save", self)
        self.saveGameAction.setIcon(QIcon(CONST.ICONS["Save"]))
        self.saveGameAction.triggered.connect(self.saveGame)
        self.saveGameAction.setShortcut("CTRL+S")

        self.saveAsAction = QAction("Save &As", self)
        self.saveAsAction.setIcon(QIcon(CONST.ICONS["Save"]))
        self.saveAsAction.triggered.connect(self.saveGameAs)
        self.saveAsAction.setShortcut("CTRL+A")

        self.showAboutDialogAction = QAction("&About DCS Liberation", self)
        self.showAboutDialogAction.setIcon(QIcon.fromTheme("help-about"))
        self.showAboutDialogAction.triggered.connect(self.showAboutDialog)

        self.showLiberationPrefDialogAction = QAction("&Preferences", self)
        self.showLiberationPrefDialogAction.setIcon(
            QIcon.fromTheme("help-about"))
        self.showLiberationPrefDialogAction.triggered.connect(
            self.showLiberationDialog)

        self.openDiscordAction = QAction("&Discord Server", self)
        self.openDiscordAction.setIcon(CONST.ICONS["Discord"])
        self.openDiscordAction.triggered.connect(
            lambda: webbrowser.open_new_tab("https://" + "discord.gg" + "/" +
                                            "bKrt" + "rkJ"))

        self.openGithubAction = QAction("&Github Repo", self)
        self.openGithubAction.setIcon(CONST.ICONS["Github"])
        self.openGithubAction.triggered.connect(
            lambda: webbrowser.open_new_tab(
                "https://github.com/dcs-liberation/dcs_liberation"))

        self.openSettingsAction = QAction("Settings", self)
        self.openSettingsAction.setIcon(CONST.ICONS["Settings"])
        self.openSettingsAction.triggered.connect(self.showSettingsDialog)

        self.openStatsAction = QAction("Stats", self)
        self.openStatsAction.setIcon(CONST.ICONS["Statistics"])
        self.openStatsAction.triggered.connect(self.showStatsDialog)

        self.openNotesAction = QAction("Notes", self)
        self.openNotesAction.setIcon(CONST.ICONS["Notes"])
        self.openNotesAction.triggered.connect(self.showNotesDialog)
Ejemplo n.º 10
0
    def _set_mode_prompt_delete(cls):
        cls._disconnect_buttons()

        cls.btn_delete.setText("Confirm Delete")
        cls.btn_delete.setIcon(QIcon.fromTheme('edit-delete'))
        cls.btn_delete.setWhatsThis("Delete the selected log entry.")
        cls.btn_delete.clicked.connect(cls.delete)

        cls.btn_edit.setText("Keep")
        cls.btn_edit.setIcon(QIcon.fromTheme('edit-undo'))
        cls.btn_edit.setWhatsThis("Keep the selected log entry.")
        cls.btn_edit.clicked.connect(cls.cancel)
Ejemplo n.º 11
0
    def _updateActionFullScreen(self):

        if not self.isFullScreen():
            self._actionFullScreen.setText(self.tr("Full Screen Mode"))
            self._actionFullScreen.setIcon(QIcon.fromTheme("view-fullscreen", QIcon(":/icons/actions/16/view-fullscreen.svg")))
            self._actionFullScreen.setChecked(False)
            self._actionFullScreen.setToolTip(self.tr("Display the window in full screen"))
        else:
            self._actionFullScreen.setText(self.tr("Exit Full Screen Mode"))
            self._actionFullScreen.setIcon(QIcon.fromTheme("view-restore", QIcon(":/icons/actions/16/view-restore.svg")))
            self._actionFullScreen.setChecked(True)
            self._actionFullScreen.setToolTip(self.tr("Exit the full screen mode"))
Ejemplo n.º 12
0
    def _set_mode_default(cls):
        cls._disconnect_buttons()

        cls.btn_delete.setText("Delete")
        cls.btn_delete.setIcon(QIcon.fromTheme('edit-delete'))
        cls.btn_delete.setWhatsThis("Delete the selected log entry.")
        cls.btn_delete.clicked.connect(cls.prompt_delete)

        cls.btn_edit.setText("Edit")
        cls.btn_edit.setIcon(QIcon.fromTheme('document-properties'))
        cls.btn_edit.setWhatsThis("Edit the selected log entry.")
        cls.btn_edit.clicked.connect(cls.edit)
Ejemplo n.º 13
0
    def __init__(self):
        super().__init__()
        self.setWindowTitle("muSync - Accounts")
        self.setModal(True)

        dialogLayout = QVBoxLayout(self)

        accountsList = QListWidget()
        accountsList.setObjectName("accountsList")
        dialogLayout.addWidget(accountsList)

        buttonsLayout = QHBoxLayout()
        addButton = QPushButton(QIcon.fromTheme("list-resource-add"),
                                "&Add account")
        addButton.clicked.connect(lambda: self.__show_modules())
        buttonsLayout.addWidget(addButton)
        delButton = QPushButton(QIcon.fromTheme("edit-delete"),
                                "&Remove account")
        delButton.clicked.connect(lambda: self.__del_account(accountsList))
        delButton.setDisabled(True)
        buttonsLayout.addWidget(delButton)
        okButton = QPushButton(QIcon.fromTheme("dialog-ok"), "&Select account")
        okButton.clicked.connect(lambda: self.__select_account(accountsList))
        okButton.setDisabled(True)
        buttonsLayout.addWidget(okButton)
        cancelButton = QPushButton(QIcon.fromTheme("dialog-cancel"), "&Cancel")
        cancelButton.clicked.connect(self.close)
        buttonsLayout.addWidget(cancelButton)
        dialogLayout.addLayout(buttonsLayout)
        accountsList.itemSelectionChanged.connect(lambda: okButton.setDisabled(
            True if accountsList.selectedIndexes() == [] else False))
        accountsList.itemSelectionChanged.connect(
            lambda: delButton.setDisabled(True if accountsList.selectedIndexes(
            ) == [] else False))

        accounts = QSettings()
        accounts.beginGroup("accounts")
        for account_id in accounts.childKeys():
            module_name = accounts.value(account_id)

            if module_name not in modules.modules:
                pass  # TODO

            account = modules.create_object(module_name)
            account.setId(account_id)
            account.initialize()

            accountListItem = QListWidgetItem(account.getName())
            accountListItem.account = account
            accountsList.addItem(accountListItem)

        accountsList.itemDoubleClicked.connect(
            lambda: self.__select_account(accountsList))
Ejemplo n.º 14
0
Archivo: QT.py Proyecto: Zamtos/QT
    def createActions(self):
        # self.newLetterAct = QAction(QIcon.fromTheme('document-new', QIcon(':/images/new.png')), "&New Letter",
        #         self, shortcut=QKeySequence.New,
        #         statusTip="Create a new form letter", triggered=self.newLetter())

        self.newWindowAct = QAction(QIcon.fromTheme('document-new',
                                                    QIcon(':/images/new.png')),
                                    "&Nowe Okno",
                                    self,
                                    shortcut=QKeySequence.New,
                                    statusTip="Create a new form letter",
                                    triggered=self.newWindow2)
        self.saveAct = QAction(QIcon.fromTheme('document-save',
                                               QIcon(':/images/save.png')),
                               "&Zapisz",
                               self,
                               shortcut=QKeySequence.Save,
                               statusTip="Zapisz obecne współrzędne",
                               triggered=self.save)
        self.loadAct = QAction(QtGui.QIcon(':/images/open.png'),
                               "&Wczytaj",
                               self,
                               shortcut=QtGui.QKeySequence.Open,
                               statusTip="Wczytaj współrzędne z pliku",
                               triggered=self.load)
        self.aboutAct = QAction("&O Programie",
                                self,
                                statusTip="Pokazuje pomoc dla programu",
                                triggered=self.about)
        self.aboutAct2 = QAction(
            "&Symbole i skróty",
            self,
            statusTip=
            "Pokazuje objaśnienia używanych w programie skrótów i symboli",
            triggered=self.about2)
        self.quitAct = QAction("&Zamknij",
                               self,
                               shortcut="Ctrl+Q",
                               statusTip="Zamyka aplikację",
                               triggered=self.close)
        self.DefaultAct = QAction(
            QIcon.fromTheme('document-default', QIcon(':/images/def.png')),
            "&Rozpocznij dla domyślnej lokacji",
            self,
            statusTip="Rozpoczyna obliczenia dla domyślnej lokacji (Wrocław)",
            triggered=self.handleButton2)
        self.controlAct = QAction(QIcon.fromTheme('document-new',
                                                  QIcon(':/images/new.png')),
                                  "&Sterowanie",
                                  self,
                                  statusTip="Create a new form letter",
                                  triggered=self.newWindow)
Ejemplo n.º 15
0
    def _set_mode_stopped(cls):
        """Set buttons to stopped-clock state."""
        cls._disconnect_buttons()

        cls.btn_startpause.setText("Start")
        cls.btn_startpause.setIcon(QIcon.fromTheme('media-playback-start'))
        cls.btn_startpause.setWhatsThis("Start a new timer.")
        cls.btn_startpause.clicked.connect(cls.start)

        cls.btn_stopsave.setIcon(QIcon.fromTheme(None))
        cls.btn_stopsave.setText("Stopped")
        cls.btn_stopsave.setWhatsThis("Timer is already stopped.")
        cls.btn_stopsave.setEnabled(False)
Ejemplo n.º 16
0
    def _set_mode_prompt_reset(cls):
        """Set buttons to reset-prompt state."""

        cls._disconnect_buttons()

        cls.btn_startpause.setText("Confirm Reset")
        cls.btn_startpause.setIcon(QIcon.fromTheme('edit-undo'))
        cls.btn_startpause.setWhatsThis("Discard time and reset timer.")
        cls.btn_startpause.clicked.connect(cls.reset)

        cls.btn_stopsave.setIcon(QIcon.fromTheme('document-save'))
        cls.btn_stopsave.setWhatsThis("Save time and notes to log.")
        cls.btn_stopsave.setText("Save")
        cls.btn_stopsave.setEnabled(True)
        cls.btn_stopsave.clicked.connect(cls.save)
Ejemplo n.º 17
0
 def set_mode_running(cls):
     cls._disconnect_actions()
     cls.act_quit.setEnabled(False)
     cls.act_time.setEnabled(True)
     cls.act_time.setText("Pause")
     cls.act_time.setIcon(QIcon.fromTheme('media-playback-pause'))
     cls.act_time.triggered.connect(TimeControls.pause)
Ejemplo n.º 18
0
 def create_items(self, name, count):
     if name.startswith("/"):
         if name == "/":
             short_name = "all"
         else:
             short_name = name.rsplit("/", 1)[1]
         icon = QIcon.fromTheme("folder")
     else:
         short_name = name
         icon = QIcon.fromTheme("tag")
     item = QStandardItem(icon, short_name)
     item.setToolTip(name)
     item.setData(name)
     c_item = QStandardItem(str(count))
     c_item.setTextAlignment(Qt.AlignRight)
     return item, c_item
Ejemplo n.º 19
0
 def __init__(self, v, link):
     super().__init__('')
     self.link = link
     self.setIcon(QIcon.fromTheme('document-save'))
     self.setFixedWidth(30)
     self.clicked.connect(self.download)
     return
Ejemplo n.º 20
0
    def setup_menubar(self):
        experiment_menu = self.menuBar().addMenu("Experiment Data")
        brain_icon = QIcon(os.path.join(os.path.dirname(__file__), "icon_brain.png"))
        self.open_data = QAction(brain_icon,
                                 "Open Data",
                                 self,
                                 shortcut=QtCore.Qt.CTRL + QtCore.Qt.Key_O,
                                 triggered=self.select_open_file)
        experiment_menu.addAction(self.open_data)
        self.show_sample_data = QAction(brain_icon,
                                        "Show Sample Data",
                                        self,
                                        shortcut=QtCore.Qt.CTRL + QtCore.Qt.Key_T,
                                        triggered=self.prepare_and_display_data)
        experiment_menu.addAction(self.show_sample_data)

        settings_action = QAction("Settings", self, triggered=self.settings)
        experiment_menu.addAction(settings_action)

        # TODO fix the icon on windows/mac
        exit_action = QAction(QIcon.fromTheme("application-exit"), "Exit",
                              self, shortcut=QtCore.Qt.CTRL + QtCore.Qt.Key_Q, triggered=self.close)
        experiment_menu.addAction(exit_action)

        about_menu = self.menuBar().addMenu("About")
        about_tool_action = QAction("Tool Information", self, triggered=self.about_tool)
        about_menu.addAction(about_tool_action)
        about_qt_action = QAction("About Qt", self, triggered=qApp.aboutQt)
        about_menu.addAction(about_qt_action)
Ejemplo n.º 21
0
    def initActions(self):
        self.newGameAction = QAction("New Game", self)
        self.newGameAction.setIcon(QIcon(CONST.ICONS["New"]))
        self.newGameAction.triggered.connect(self.newGame)

        self.saveGameAction = QAction("Save", self)
        self.saveGameAction.setIcon(QIcon(CONST.ICONS["Save"]))
        self.saveGameAction.triggered.connect(self.saveGame)

        self.showAboutDialogAction = QAction("About DCS Liberation", self)
        self.showAboutDialogAction.setIcon(QIcon.fromTheme("help-about"))
        self.showAboutDialogAction.triggered.connect(self.showAboutDialog)

        self.showLiberationPrefDialogAction = QAction("Preferences", self)
        self.showLiberationPrefDialogAction.setIcon(QIcon.fromTheme("help-about"))
        self.showLiberationPrefDialogAction.triggered.connect(self.showLiberationDialog)
Ejemplo n.º 22
0
 def set_mode_stopped(cls):
     cls._disconnect_actions()
     cls.act_quit.setEnabled(True)
     cls.act_time.setEnabled(True)
     cls.act_time.setText("Start")
     cls.act_time.setIcon(QIcon.fromTheme('media-playback-start'))
     cls.act_time.triggered.connect(TimeControls.start)
Ejemplo n.º 23
0
 def set_mode_paused(cls):
     cls._disconnect_actions()
     cls.act_quit.setEnabled(False)
     cls.act_time.setEnabled(True)
     cls.act_time.setText("Resume")
     cls.act_time.setIcon(QIcon.fromTheme('media-playback-start'))
     cls.act_time.triggered.connect(TimeControls.resume)
Ejemplo n.º 24
0
    def __init__(self, *args):
        logging.debug('MainWindow creation')

        QMainWindow.__init__(self, *args)
        self.ui = Ui_MainWindow()
        logging.debug('MainWindow ui setup')
        self.ui.setupUi(self)

        self.instanceManager = InstanceManager(InstanceManager.getStoredKey())
        self.readConfig()
        self.setupModels()

        self.ui.treeView.activated.connect(self.updatePasswordsModel)
        self.ui.tableView.activated.connect(self.udpateDetailTabs)
        self.ui.actionQuit.triggered.connect(self.closeReally)
        self.ui.actionPreferences.triggered.connect(self.openPreferences)
        self.ui.actionRefresh.triggered.connect(self.refreshInstances)

        # Init QSystemTrayIcon
        icon = QIcon.fromTheme('dialog-passwords',
                               QIcon(':/icons/dialog-password.svg'))
        self.trayIcon = QSystemTrayIcon(icon, self)
        systrayMenu = QMenu(self)
        systrayMenu.addAction(self.ui.actionRefresh)
        systrayMenu.addAction(self.ui.actionQuit)
        self.trayIcon.setContextMenu(systrayMenu)
        self.trayIcon.show()
        self.trayIcon.activated.connect(self.handleSystray)
Ejemplo n.º 25
0
    def data(self, index: QModelIndex, role: int):
        left_col = index.siblingAtColumn(0)
        col = index.column()
        app = typing.cast(_InternalData, left_col.internalPointer())

        if "data" not in app:
            # Folder
            if role == Qt.DisplayRole:
                if col == 0:
                    return app["id"]
            elif role == Qt.DecorationRole:
                if col == 0:
                    return QIcon.fromTheme("folder")

            return None

        if role in (Qt.DisplayRole, Qt.ToolTipRole):
            if col == 0:
                return app["data"]["appName"]
            elif col == 1:
                return app["data"]["appUrl"]
            elif col == 2:
                return app["data"]["description"]
        elif role == Qt.DecorationRole and col == 0:
            return self.store.icon(app["id"])
        else:
            return None
Ejemplo n.º 26
0
    def _set_mode_paused(cls):
        """Set buttons to paused-time state."""

        cls._disconnect_buttons()

        cls.btn_startpause.setText("Resume")
        cls.btn_startpause.setIcon(QIcon.fromTheme('media-playback-start'))
        cls.btn_startpause.setWhatsThis("Resume timer from current time.")
        cls.btn_startpause.clicked.connect(cls.resume)
        cls.btn_stopsave.setText("Stop")

        cls.btn_stopsave.setIcon(QIcon.fromTheme('media-playback-stop'))
        cls.btn_stopsave.setWhatsThis("Stop timer. Timer must be stopped "
                                      "before you can save.")
        cls.btn_stopsave.clicked.connect(cls.prompt_stop)
        cls.btn_stopsave.setEnabled(True)
Ejemplo n.º 27
0
        def _load(filePath):
            # type: (pathlib.Path) -> NoReturn
            with itemsLock:
                icon = self.__iconsCache.get(filePath)

            if icon is None:
                iconProvider = QFileIconProvider()

                posixPath = filePath.as_posix()
                file = QFileInfo(posixPath)
                icon = iconProvider.icon(file)

                if icon.isNull():
                    mimeDb = QMimeDatabase()
                    for mime in mimeDb.mimeTypesForFileName(posixPath):
                        icon = QIcon.fromTheme(mime.iconName())
                        if not icon.isNull():
                            break

            result = QFileIconLoader.LoadResult(filePath, icon)
            with itemsLock:
                loadedItems[filePath] = result
                self.__iconsCache.set(filePath, icon)

            self.loaded.emit(result)

            if len(loadedItems) == len(targetPaths):
                self.completed.emit(loadedItems)
Ejemplo n.º 28
0
def main():
    global dbus
    parser = ArgumentParser()
    parser.add_argument("-v",
                        "--verbose",
                        help="increase output verbosity",
                        action="store_true")
    args = parser.parse_args()
    QtQml.qmlRegisterType(QmlPage, "djpdf", 1, 0, "DjpdfPage")
    app = QApplication([])
    app.setWindowIcon(QIcon.fromTheme("com.github.unrud.djpdf"))
    engine = QQmlApplicationEngine()
    thumbnail_image_provider = ThumbnailImageProvider()
    engine.addImageProvider("thumbnails", thumbnail_image_provider)
    ctx = engine.rootContext()
    pages_model = QmlPagesModel(verbose=args.verbose)
    if os.environ.get("DJPDF_PLATFORM") == "flatpak":
        import dbus
        import dbus.mainloop.glib
        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
        bus = dbus.SessionBus()
        platform_integration = QmlFlatpakPlatformIntegration(bus)
    else:
        platform_integration = QmlPlatformIntegration()
    ctx.setContextProperty("pagesModel", pages_model)
    ctx.setContextProperty("platformIntegration", platform_integration)
    engine.load(QUrl.fromLocalFile(os.path.join(QML_DIR, "main.qml")))
    platform_integration.window = engine.rootObjects()[0]
    exit(app.exec_())
Ejemplo n.º 29
0
    def _set_mode_running(cls):
        """Set buttons to running-clock state."""

        cls._disconnect_buttons()

        cls.btn_startpause.setText("Pause")
        cls.btn_startpause.setIcon(QIcon.fromTheme('media-playback-pause'))
        cls.btn_startpause.setWhatsThis("Pause timer.")
        cls.btn_startpause.clicked.connect(cls.pause)

        cls.btn_stopsave.setText("Stop")
        cls.btn_stopsave.setIcon(QIcon.fromTheme('media-playback-stop'))
        cls.btn_stopsave.setWhatsThis("Stop timer. Timer must be stopped "
                                      "before you can save.")
        cls.btn_stopsave.clicked.connect(cls.prompt_stop)
        cls.btn_stopsave.setEnabled(True)
Ejemplo n.º 30
0
 def __init__(self, v, link):
     super().__init__('')
     self.link = link
     self.v = v
     self.setIcon(QIcon.fromTheme('media-playback-start'))
     self.setFixedWidth(30)
     self.clicked.connect(self.play)
     return
Ejemplo n.º 31
0
    def __init__(self):
        super(MainWindow, self).__init__()

        self.cameraInfo = QCameraInfo.defaultCamera()
        self.camera = QCamera(self.cameraInfo)
        self.camera.setCaptureMode(QCamera.CaptureStillImage)
        self.imageCapture = QCameraImageCapture(self.camera)
        self.imageCapture.imageCaptured.connect(self.imageCaptured)
        self.imageCapture.imageSaved.connect(self.imageSaved)
        self.currentPreview = QImage()

        toolBar = QToolBar()
        self.addToolBar(toolBar)

        fileMenu = self.menuBar().addMenu("&File")
        shutterIcon = QIcon(os.path.join(os.path.dirname(__file__),
                            "shutter.svg"))
        self.takePictureAction = QAction(shutterIcon, "&Take Picture", self,
                                         shortcut="Ctrl+T",
                                         triggered=self.takePicture)
        self.takePictureAction.setToolTip("Take Picture")
        fileMenu.addAction(self.takePictureAction)
        toolBar.addAction(self.takePictureAction)

        exitAction = QAction(QIcon.fromTheme("application-exit"), "E&xit",
                             self, shortcut="Ctrl+Q", triggered=self.close)
        fileMenu.addAction(exitAction)

        aboutMenu = self.menuBar().addMenu("&About")
        aboutQtAction = QAction("About &Qt", self, triggered=qApp.aboutQt)
        aboutMenu.addAction(aboutQtAction)

        self.tabWidget = QTabWidget()
        self.setCentralWidget(self.tabWidget)

        self.cameraViewfinder = QCameraViewfinder()
        self.camera.setViewfinder(self.cameraViewfinder)
        self.tabWidget.addTab(self.cameraViewfinder, "Viewfinder")

        if self.camera.status() != QCamera.UnavailableStatus:
            name = self.cameraInfo.description()
            self.setWindowTitle("PySide2 Camera Example (" + name + ")")
            self.statusBar().showMessage("Starting: '" + name + "'", 5000)
            self.camera.start()
        else:
            self.setWindowTitle("PySide2 Camera Example")
            self.takePictureAction.setEnabled(False)
            self.statusBar().showMessage("Camera unavailable", 5000)
Ejemplo n.º 32
0
    def createActions(self):

        self.newAct = QAction(QIcon.fromTheme("document-new", QIcon(':/images/new.png')), "&New", self,
                shortcut=QKeySequence.New, statusTip="Create a new file",
                triggered=self.newFile)

        self.openAct = QAction(QIcon.fromTheme("document-open", QIcon(':/images/open.png')), "&Open...", self,
                shortcut=QKeySequence.Open, statusTip="Open an existing file",
                triggered=self.open)

        self.saveAct = QAction(QIcon.fromTheme("document-save", QIcon(':/images/save.png')), "&Save", self,
                shortcut=QKeySequence.Save,
                statusTip="Save the document to disk", triggered=self.save)

        self.saveAsAct = QAction("Save &As...", self,
                shortcut=QKeySequence.SaveAs,
                statusTip="Save the document under a new name",
                triggered=self.saveAs)

        self.exitAct = QAction("E&xit", self, shortcut=QKeySequence.Quit,
                statusTip="Exit the application",
                triggered=QApplication.instance().closeAllWindows)

        self.cutAct = QAction(QIcon.fromTheme("edit-cut", QIcon(':/images/cut.png')), "Cu&t", self,
                shortcut=QKeySequence.Cut,
                statusTip="Cut the current selection's contents to the clipboard",
                triggered=self.cut)

        self.copyAct = QAction(QIcon.fromTheme("edit-copy", QIcon(':/images/copy.png')), "&Copy", self,
                shortcut=QKeySequence.Copy,
                statusTip="Copy the current selection's contents to the clipboard",
                triggered=self.copy)

        self.pasteAct = QAction(QIcon.fromTheme("edit-paste", QIcon(':/images/paste.png')), "&Paste", self,
                shortcut=QKeySequence.Paste,
                statusTip="Paste the clipboard's contents into the current selection",
                triggered=self.paste)

        self.closeAct = QAction("Cl&ose", self,
                statusTip="Close the active window",
                triggered=self.mdiArea.closeActiveSubWindow)

        self.closeAllAct = QAction("Close &All", self,
                statusTip="Close all the windows",
                triggered=self.mdiArea.closeAllSubWindows)

        self.tileAct = QAction("&Tile", self, statusTip="Tile the windows",
                triggered=self.mdiArea.tileSubWindows)

        self.cascadeAct = QAction("&Cascade", self,
                statusTip="Cascade the windows",
                triggered=self.mdiArea.cascadeSubWindows)

        self.nextAct = QAction("Ne&xt", self, shortcut=QKeySequence.NextChild,
                statusTip="Move the focus to the next window",
                triggered=self.mdiArea.activateNextSubWindow)

        self.previousAct = QAction("Pre&vious", self,
                shortcut=QKeySequence.PreviousChild,
                statusTip="Move the focus to the previous window",
                triggered=self.mdiArea.activatePreviousSubWindow)

        self.separatorAct = QAction(self)
        self.separatorAct.setSeparator(True)

        self.aboutAct = QAction("&About", self,
                statusTip="Show the application's About box",
                triggered=self.about)

        self.aboutQtAct = QAction("About &Qt", self,
                statusTip="Show the Qt library's About box",
                triggered=QApplication.instance().aboutQt)
Ejemplo n.º 33
0
    def __init__(self):
        super(MainWindow, self).__init__()

        self.playlist = QMediaPlaylist()
        self.player = QMediaPlayer()

        toolBar = QToolBar()
        self.addToolBar(toolBar)

        fileMenu = self.menuBar().addMenu("&File")
        openAction = QAction(QIcon.fromTheme("document-open"),
                             "&Open...", self, shortcut=QKeySequence.Open,
                             triggered=self.open)
        fileMenu.addAction(openAction)
        exitAction = QAction(QIcon.fromTheme("application-exit"), "E&xit",
                             self, shortcut="Ctrl+Q", triggered=self.close)
        fileMenu.addAction(exitAction)

        playMenu = self.menuBar().addMenu("&Play")
        playIcon = self.style().standardIcon(QStyle.SP_MediaPlay)
        self.playAction = toolBar.addAction(playIcon, "Play")
        self.playAction.triggered.connect(self.player.play)
        playMenu.addAction(self.playAction)

        previousIcon = self.style().standardIcon(QStyle.SP_MediaSkipBackward)
        self.previousAction = toolBar.addAction(previousIcon, "Previous")
        self.previousAction.triggered.connect(self.previousClicked)
        playMenu.addAction(self.previousAction)

        pauseIcon = self.style().standardIcon(QStyle.SP_MediaPause)
        self.pauseAction = toolBar.addAction(pauseIcon, "Pause")
        self.pauseAction.triggered.connect(self.player.pause)
        playMenu.addAction(self.pauseAction)

        nextIcon = self.style().standardIcon(QStyle.SP_MediaSkipForward)
        self.nextAction = toolBar.addAction(nextIcon, "Next")
        self.nextAction.triggered.connect(self.playlist.next)
        playMenu.addAction(self.nextAction)

        stopIcon = self.style().standardIcon(QStyle.SP_MediaStop)
        self.stopAction = toolBar.addAction(stopIcon, "Stop")
        self.stopAction.triggered.connect(self.player.stop)
        playMenu.addAction(self.stopAction)

        self.volumeSlider = QSlider()
        self.volumeSlider.setOrientation(Qt.Horizontal)
        self.volumeSlider.setMinimum(0)
        self.volumeSlider.setMaximum(100)
        self.volumeSlider.setFixedWidth(app.desktop().availableGeometry(self).width() / 10)
        self.volumeSlider.setValue(self.player.volume())
        self.volumeSlider.setTickInterval(10)
        self.volumeSlider.setTickPosition(QSlider.TicksBelow)
        self.volumeSlider.setToolTip("Volume")
        self.volumeSlider.valueChanged.connect(self.player.setVolume)
        toolBar.addWidget(self.volumeSlider)

        aboutMenu = self.menuBar().addMenu("&About")
        aboutQtAct = QAction("About &Qt", self, triggered=qApp.aboutQt)
        aboutMenu.addAction(aboutQtAct)

        self.videoWidget = QVideoWidget()
        self.setCentralWidget(self.videoWidget)
        self.player.setPlaylist(self.playlist)
        self.player.stateChanged.connect(self.updateButtons)
        self.player.setVideoOutput(self.videoWidget)

        self.updateButtons(self.player.state())
Ejemplo n.º 34
0
    def _create_menu(self):
        file_menu = self.menuBar().addMenu("&File")
        exit_action = QAction(QIcon.fromTheme("application-exit"), "E&xit",
                             self, shortcut = "Ctrl+Q", triggered=qApp.quit)
        file_menu.addAction(exit_action)

        navigation_menu = self.menuBar().addMenu("&Navigation")

        style_icons = ':/qt-project.org/styles/commonstyle/images/'
        back_action = QAction(QIcon.fromTheme("go-previous",
                                             QIcon(style_icons + 'left-32.png')),
                             "Back", self,
                             shortcut = QKeySequence(QKeySequence.Back),
                             triggered = self._tab_widget.back)
        self._actions[QWebEnginePage.Back] = back_action
        back_action.setEnabled(False)
        navigation_menu.addAction(back_action)
        forward_action = QAction(QIcon.fromTheme("go-next",
                                                QIcon(style_icons + 'right-32.png')),
                                "Forward", self,
                                shortcut = QKeySequence(QKeySequence.Forward),
                                triggered = self._tab_widget.forward)
        forward_action.setEnabled(False)
        self._actions[QWebEnginePage.Forward] = forward_action

        navigation_menu.addAction(forward_action)
        reload_action = QAction(QIcon(style_icons + 'refresh-32.png'),
                               "Reload", self,
                               shortcut = QKeySequence(QKeySequence.Refresh),
                               triggered = self._tab_widget.reload)
        self._actions[QWebEnginePage.Reload] = reload_action
        reload_action.setEnabled(False)
        navigation_menu.addAction(reload_action)

        navigation_menu.addSeparator()

        new_tab_action = QAction("New Tab", self,
                             shortcut = 'Ctrl+T',
                             triggered = self.add_browser_tab)
        navigation_menu.addAction(new_tab_action)

        close_tab_action = QAction("Close Current Tab", self,
                                 shortcut = "Ctrl+W",
                                 triggered = self._close_current_tab)
        navigation_menu.addAction(close_tab_action)

        edit_menu = self.menuBar().addMenu("&Edit")

        find_action = QAction("Find", self,
                             shortcut = QKeySequence(QKeySequence.Find),
                             triggered = self._show_find)
        edit_menu.addAction(find_action)

        edit_menu.addSeparator()
        undo_action = QAction("Undo", self,
                             shortcut = QKeySequence(QKeySequence.Undo),
                             triggered = self._tab_widget.undo)
        self._actions[QWebEnginePage.Undo] = undo_action
        undo_action.setEnabled(False)
        edit_menu.addAction(undo_action)

        redo_action = QAction("Redo", self,
                             shortcut = QKeySequence(QKeySequence.Redo),
                             triggered = self._tab_widget.redo)
        self._actions[QWebEnginePage.Redo] = redo_action
        redo_action.setEnabled(False)
        edit_menu.addAction(redo_action)

        edit_menu.addSeparator()

        cut_action = QAction("Cut", self,
                            shortcut = QKeySequence(QKeySequence.Cut),
                            triggered = self._tab_widget.cut)
        self._actions[QWebEnginePage.Cut] = cut_action
        cut_action.setEnabled(False)
        edit_menu.addAction(cut_action)

        copy_action = QAction("Copy", self,
                             shortcut = QKeySequence(QKeySequence.Copy),
                             triggered = self._tab_widget.copy)
        self._actions[QWebEnginePage.Copy] = copy_action
        copy_action.setEnabled(False)
        edit_menu.addAction(copy_action)

        paste_action = QAction("Paste", self,
                             shortcut = QKeySequence(QKeySequence.Paste),
                             triggered = self._tab_widget.paste)
        self._actions[QWebEnginePage.Paste] = paste_action
        paste_action.setEnabled(False)
        edit_menu.addAction(paste_action)

        edit_menu.addSeparator()

        select_all_action = QAction("Select All", self,
                                  shortcut = QKeySequence(QKeySequence.SelectAll),
                                  triggered = self._tab_widget.select_all)
        self._actions[QWebEnginePage.SelectAll] = select_all_action
        select_all_action.setEnabled(False)
        edit_menu.addAction(select_all_action)

        self._bookmark_menu = self.menuBar().addMenu("&Bookmarks")
        add_bookmark_action = QAction("&Add Bookmark", self,
                                    triggered = self._add_bookmark)
        self._bookmark_menu.addAction(add_bookmark_action)
        add_tool_bar_bookmark_action = QAction("&Add Bookmark to Tool Bar", self,
                                           triggered = self._add_tool_bar_bookmark)
        self._bookmark_menu.addAction(add_tool_bar_bookmark_action)
        self._bookmark_menu.addSeparator()

        tools_menu = self.menuBar().addMenu("&Tools")
        download_action = QAction("Open Downloads", self,
                                 triggered = DownloadWidget.open_download_directory)
        tools_menu.addAction(download_action)

        window_menu = self.menuBar().addMenu("&Window")

        window_menu.addAction(self._bookmark_dock.toggleViewAction())

        window_menu.addSeparator()

        zoom_in_action = QAction(QIcon.fromTheme("zoom-in"),
                               "Zoom In", self,
                               shortcut = QKeySequence(QKeySequence.ZoomIn),
                               triggered = self._zoom_in)
        window_menu.addAction(zoom_in_action)
        zoom_out_action = QAction(QIcon.fromTheme("zoom-out"),
                                "Zoom Out", self,
                                shortcut = QKeySequence(QKeySequence.ZoomOut),
                                triggered = self._zoom_out)
        window_menu.addAction(zoom_out_action)

        reset_zoom_action = QAction(QIcon.fromTheme("zoom-original"),
                                  "Reset Zoom", self,
                                  shortcut = "Ctrl+0",
                                  triggered = self._reset_zoom)
        window_menu.addAction(reset_zoom_action)

        about_menu = self.menuBar().addMenu("&About")
        about_action = QAction("About Qt", self,
                              shortcut = QKeySequence(QKeySequence.HelpContents),
                              triggered=qApp.aboutQt)
        about_menu.addAction(about_action)