Пример #1
0
    def setupWorkspace(self):
        super().setupWorkspace()

        fileManager = self.app.mainWindow.fileManagerWidget

        self.fileManagerTab = files.FileManagerTab(
            self.app.mainWindow,
            fileManager=fileManager
        )

        self.seedsTab = seeds.SeedsTrackerTab(self.app.mainWindow)

        icon = getIcon('folder-open.png')

        self.wsRegisterTab(self.fileManagerTab, iFileManager(), icon)
        self.wsRegisterTab(self.seedsTab, iFileSharing(),
                           getIcon('fileshare.png'))

        self.wsAddAction(fileManager.addFilesAction)
        self.wsAddAction(fileManager.addDirectoryAction)
        self.wsAddAction(fileManager.newSeedAction)

        self.actionTorrentClient = self.wsAddCustomAction(
            iBitTorrentClient(), getIcon('torrent.png'),
            iBitTorrentClient(),
            partialEnsure(self.onStartTorrentClient)
        )

        self.actionGc = self.wsAddCustomAction(
            'gc', getIcon('clear-all.png'),
            iGarbageCollectRun(),
            partialEnsure(self.onRunGC)
        )
Пример #2
0
    def setupWorkspace(self):
        super().setupWorkspace()

        self.pinStatusTab = pinstatus.PinStatusWidget(
            self.app.mainWindow, sticky=True)

        self.wsRegisterTab(
            self.pinStatusTab, iPinningStatus(),
            icon=getIcon('pin-zoom.png'))

        self.wsRegisterTab(
            self.settingsCenter,
            iSettings(),
            icon=getIcon('settings.png')
        )

        self.actionConfigure = self.wsAddCustomAction(
            'config', getIcon('settings.png'),
            iConfigurationEditor(), self.openConfigEditor
        )

        if shutil.which('dot'):
            # Only if we have graphviz's dot
            self.wsAddCustomAction(
                'app-graph', getIcon('ipld.png'),
                'Application graph', partialEnsure(self.openAppGraph)
            )
Пример #3
0
    def __init__(self, parent=None):
        super(UnixFSDirectoryModel, self).__init__(parent)

        self.app = QApplication.instance()
        self.entries = []

        self.iconFolder = getIcon('folder-open.png')
        self.iconFile = getIcon('file.png')
        self.iconUnknown = getIcon('unknown-file.png')
Пример #4
0
    def __init__(self, parent=None):
        super(CameraController, self).__init__(icon=getIcon('camera.png'),
                                               mode=QToolButton.InstantPopup,
                                               parent=parent)

        self.setToolTip(iWebcamIpfsCapture())

        self.menuDevices = QMenu(iDevices())
        self.menuDevices.setIcon(self.icon())

        self.menu.addMenu(self.menuDevices)
        self.menu.addSeparator()

        self.captureAction = QAction(self.icon(),
                                     iCapture(),
                                     self,
                                     triggered=self.onCameraView)
        self.captureAction.setEnabled(False)

        self.menu.addAction(self.captureAction)
        self.camView = None

        self.videoDevicesGroup = QActionGroup(self)
        self.videoDevicesGroup.setExclusive(True)

        self.detectDevices()
Пример #5
0
    async def chatJoinDefault(self):
        chanWidget = await self.chatCenterButton.chans.joinChannel(
            '#galacteek', chanSticky=False)

        self.wsRegisterTab(
            chanWidget,
            '#galacteek',
            icon=getIcon('qta:mdi.chat-outline'),
            current=False
        )
Пример #6
0
    def onShowAtomFeeds(self):
        name = iAtomFeeds()

        tab = self.wsFindTabWithId('dweb-atom-feeds')
        if tab:
            return self.tabWidget.setCurrentWidget(tab)

        tab = AtomFeedsViewTab(self.app.mainWindow)
        self.wsRegisterTab(tab, name,
                           getIcon('atom-feed.png'), current=True)
Пример #7
0
    def setupWorkspace(self):
        super().setupWorkspace()

        self.actionHelp = self.wsAddCustomAction(
            'help', getIcon('help.png'),
            iHelp(), self.onHelpEditing)

        self.actionMarkdownHelp = self.wsAddCustomAction(
            'help', getIcon('markdown.png'),
            'Have you completely lost your Markdown ?',
            self.onHelpMarkdown)

        self.actionPostBlog = self.wsAddCustomAction(
            'blogpost', getIcon('blog.png'),
            iNewBlogPost(), self.onAddBlogPost, default=True)

        self.actionTextEdit = self.wsAddCustomAction(
            'textedit', getIcon('text-editor.png'),
            iTextEditor(), self.onAddTextEditorTab)
Пример #8
0
    def _traverse_file_tree(self, name: str, node: FileTreeNode,
                            parent: QWidget):
        item = QTreeWidgetItem(parent)
        item.setCheckState(0, Qt.Checked)
        item.setText(0, name)
        if isinstance(node, FileInfo):
            item.setText(1, humanize_size(node.length))
            item.setIcon(0, getMimeIcon('unknown'))
            self._file_items.append((node, item))
            return

        item.setIcon(0, getIcon('folder-open.png'))
        for name, child in node.items():
            self._traverse_file_tree(name, child, item)
Пример #9
0
    def openConfigEditor(self):
        tab = self.wsFindTabWithName(iConfigurationEditor())

        if not tab:
            self.wsRegisterTab(
                ConfigManager(
                    self.app.mainWindow,
                    parent=self
                ),
                iConfigurationEditor(),
                icon=getIcon('settings.png'),
                current=True
            )
        else:
            self.tabWidget.setCurrentWidget(tab)
Пример #10
0
    def setupButton(self):
        self.setObjectName('pinObjectButton')
        self.styleIconOnly()

        iconPin = self.iconPinBlue

        self.actionPinS = QAction(iconPin,
                                  iPinHere(),
                                  self,
                                  triggered=self.onPinSingle)
        self.actionPinR = QAction(iconPin,
                                  iPinHereRecursive(),
                                  self,
                                  triggered=self.onPinRecursive)
        self.actionPinRParent = QAction(iconPin,
                                        iPinHereRecursiveParent(),
                                        self,
                                        triggered=self.onPinRecursiveParent)

        self.actionPinPageLinks = QAction(iconPin,
                                          iPinPageLinks(),
                                          self,
                                          triggered=self.onPinPageLinks)

        self.actionHelp = QAction(getIcon('help.png'),
                                  iHelp(),
                                  self,
                                  triggered=self.onHelp)

        self.actionUnpin = QAction(getIcon('cancel.png'),
                                   iUnpinHere(),
                                   self,
                                   triggered=self.onUnpin)

        self.enableActions(False)
        self.setEnabled(False)
Пример #11
0
    async def populateRpsQuick(self, menu):
        srvCount = 0
        actionPinRpsAll = QAction(self.iconPinRed, iPinToAllRps(), self)
        actionPinRpsAll.setToolTip(iPinToAllRpsToolTip())

        actionPinRpsAll.triggered.connect(partialEnsure(self.onPinToRpsAll))

        for srv in cfgpinning.rpsList():
            actionPinS = QAction(self.iconPinRed, iPinToRps(srv.displayName),
                                 self)
            actionPinS.setToolTip(iPinToRpsToolTip(srv.displayName))

            actionPinS.triggered.connect(partialEnsure(self.onPinToRps, srv))

            actionUnpin = QAction(getIcon('cancel.png'),
                                  iUnpinFromRps(srv.displayName), self)
            actionUnpin.setToolTip(iUnpinFromRpsToolTip(srv.displayName))

            actionUnpin.triggered.connect(
                partialEnsure(self.onUnpinFromRps, srv))

            actionPinC = QAction(self.iconPinRed,
                                 iPinToRpsWithName(srv.displayName), self)
            actionPinC.setToolTip(iPinToRpsToolTip(srv.displayName))

            actionPinC.triggered.connect(
                partialEnsure(self.onPinToRpsWithName, srv))

            sMenu = QMenu(srv.displayName, menu)
            sMenu.setIcon(self.iconPinRed)

            menu.addAction(actionPinS)
            menu.addSeparator()
            menu.addAction(actionUnpin)

            menu.addSeparator()
            # menu.addAction(actionPinC)
            # menu.addSeparator()

            srvCount += 1

        if srvCount > 0:
            menu.addAction(actionPinRpsAll)
            menu.addSeparator()
Пример #12
0
    def setupWorkspace(self):
        from galacteek.ui import chat

        super().setupWorkspace()

        pMgrTab = PeersManager(self.app.mainWindow, self.app.peersTracker)

        # Chat center button
        self.chatCenterButton = chat.ChatCenterButton(
            parent=self.toolBarActions)

        self.wsRegisterTab(
            pMgrTab, iPeers(),
            icon=getIcon('peers.png'))

        self.app.mainWindow.atomButton.clicked.connect(self.onShowAtomFeeds)

        self.wsAddWidget(self.app.mainWindow.atomButton)
        self.wsAddWidget(self.chatCenterButton)
Пример #13
0
    def _add_torrent_item(self, state: TorrentState):
        widget = TorrentListWidgetItem(self._control_thread.control)
        widget.state = state

        item = QListWidgetItem()
        item.setIcon(
            getMimeIcon('unknown') if state.
            single_file_mode else getIcon('folder-open.png'))
        item.setSizeHint(widget.sizeHint())
        item.setData(Qt.UserRole, state.info_hash)

        items_upper = 0
        for i in range(self._list_widget.count()):
            prev_item = self._list_widget.item(i)
            if self._list_widget.itemWidget(
                    prev_item).state.suggested_name > state.suggested_name:
                break
            items_upper += 1
        self._list_widget.insertItem(items_upper, item)

        self._list_widget.setItemWidget(item, widget)
        self._torrent_to_item[state.info_hash] = item
Пример #14
0
    async def getTorrentClient(self, show=True):
        try:
            from galacteek.ui.torrentgui import TorrentClientTab
        except ImportError:
            # bt client should be a service now
            return None

        try:
            btClient = self.btClient()
            assert btClient is not None
        except Exception:
            btClient = TorrentClientTab(self.app.mainWindow)
            await btClient.start()
            self.btClient = weakref.ref(btClient)

        ex = self.wsFindTabWithId('btclient')
        if not ex:
            self.wsRegisterTab(
                btClient, iBitTorrentClient(), getIcon('torrent.png'))

        if show:
            self.tabWidget.setCurrentWidget(btClient)

        return btClient
Пример #15
0
    def __init__(self, stack,
                 name,
                 description=None,
                 section='default',
                 icon=None,
                 acceptsDrops=False):
        super().__init__(parent=stack)

        self.app = QApplication.instance()
        self.acceptsDrops = acceptsDrops

        self.stack = stack
        self.wsName = name
        self.wsDescription = description
        self.wsSection = section
        self.wsAttached = False
        self.wsSwitchButton = None
        self.wsIcon = icon if icon else getIcon('galacteek.png')
        self.defaultAction = None
        self.wLayout = QVBoxLayout(self)
        self.setLayout(self.wLayout)

        self.wLayout.setSpacing(0)
        self.wLayout.setContentsMargins(0, 0, 0, 0)
Пример #16
0
 def __init__(self, stack):
     super(WorkspaceMisc, self).__init__(
         stack, WS_MISC, icon=getIcon('settings.png'),
         description='Misc'
     )
Пример #17
0
 def __init__(self, stack):
     super().__init__(stack, WS_MAIN, icon=getIcon('atom.png'),
                      description='Main')
Пример #18
0
    def __init__(self, mainWindow):
        super().__init__(mainWindow)

        self.app = QApplication.instance()
        self.ctx.tabIdent = 'btclient'

        control_thread = ControlManagerThread()
        self._control_thread = control_thread
        control = self._control_thread.control
        self.magnetConverter = IPFSMagnetConvertor()

        toolbar = QToolBar()
        self.addToLayout(toolbar)

        toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        toolbar.setMovable(False)

        self._add_action = toolbar.addAction(getIcon('torrent.png'),
                                             iBtAddFromTorrentFile())
        self._add_frommagnet_action = toolbar.addAction(
            getIcon('magnet.png'), iBtAddFromMagnetLink())

        self._add_action.triggered.connect(
            partial(self._add_torrents_triggered))
        self._add_frommagnet_action.triggered.connect(
            partial(self._add_magnet_triggered))

        if not self.magnetConverter.available:
            self._add_frommagnet_action.setEnabled(False)

        self._pause_action = toolbar.addAction(
            self.style().standardIcon(QStyle.SP_MediaPause), 'Pause')
        self._pause_action.setEnabled(False)
        self._pause_action.triggered.connect(
            partial(self._control_action_triggered, control.pause))

        self._resume_action = toolbar.addAction(getIcon('resume'), 'Resume')
        self._resume_action.setEnabled(False)
        self._resume_action.triggered.connect(
            partial(self._control_action_triggered, control.resume))

        self._remove_action = toolbar.addAction(getIcon('clear-all.png'),
                                                'Remove')
        self._remove_action.setEnabled(False)
        self._remove_action.triggered.connect(
            partialEnsure(self._remove_torrent))

        self._list_widget = TorrentListWidget()
        self._list_widget.itemSelectionChanged.connect(
            self._update_control_action_state)
        # self._list_widget.files_dropped.connect(self.add_torrent_files)
        self._torrent_to_item = {}  # type: Dict[bytes, QListWidgetItem]

        self.addToLayout(self._list_widget)

        # control_thread.error_happened.connect(self._error_happened)

        # control.torrents_suggested.connect(self.add_torrent_files)
        control.torrent_added.connect(self._add_torrent_item)
        control.torrent_changed.connect(self._update_torrent_item)
        control.torrent_removed.connect(self._remove_torrent_item)
Пример #19
0
 def __init__(self, stack):
     super().__init__(stack, WS_MULTIMEDIA, icon=getIcon('mediaplayer.png'),
                      description='Multimedia',
                      acceptsDrops=True)
Пример #20
0
    def __init__(self, stack):
        super().__init__(stack, WS_FILES,
                         icon=getIcon('folder-open-orange.png'),
                         description='Files')

        self.btClient = None
Пример #21
0
 def __init__(self, stack):
     super().__init__(stack, WS_EDIT, icon=getIcon('blog.png'),
                      description='Edition')
Пример #22
0
 def __init__(self, stack):
     super().__init__(stack, WS_SEARCH, icon=getIcon('search-engine.png'),
                      description='Search')
Пример #23
0
 def iconPillRed(self):
     return getIcon('pin/pill-red.png')
Пример #24
0
 def iconPillBlue(self):
     return getIcon('pin/pill-blue.png')
Пример #25
0
 def iconPinBlue(self):
     return getIcon('pin/pin-diago-blue.png')
Пример #26
0
 def iconPinRed(self):
     return getIcon('pin/pin-diago-red.png')
Пример #27
0
    def __init__(self, stack):
        super().__init__(stack, WS_DMESSENGER,
                         icon=getIcon('dmessenger/dmessenger.png'),
                         description='Messenger')

        self.psListen(makeKeyService('net', 'bitmessage'))
Пример #28
0
 def __init__(self, stack):
     super().__init__(stack, WS_PEERS, icon=getIcon('peers.png'),
                      description='Network')
Пример #29
0
 def setupWorkspace(self):
     super().setupWorkspace()
     self.wsAddCustomAction(
         'help-browsing', getIcon('help.png'),
         iHelp(), self.onHelpBrowsing)