Ejemplo n.º 1
0
    def __init__(self, isLightTheme):
        QDialog.__init__(self)

        self.mode = None

        # Set the title and icon
        self.setWindowTitle("Cryptully")
        self.setWindowIcon(QIcon(utils.getAbsoluteResourcePath('images/' + ('light' if isLightTheme else 'dark') + '/icon.png')))

        clientButton = QModeButton("Connect to friend", utils.getAbsoluteResourcePath('images/client.png'), lambda: self.modeSelected(constants.MODE_CLIENT), 150, self)
        serverButton = QModeButton("Wait for connection", utils.getAbsoluteResourcePath('images/server.png'), lambda: self.modeSelected(constants.MODE_SERVER), 150, self)

        helpLink = QLinkLabel("Confused? Read the docs.", "https://cryptully.readthedocs.org/en/latest/", self)

        # Center the buttons horizontally
        hbox = QHBoxLayout()
        hbox.addStretch(1)
        hbox.addWidget(clientButton)
        hbox.addSpacing(45)
        hbox.addWidget(serverButton)
        hbox.addStretch(1)

        # Add the help link to the bottom left corner
        vbox = QVBoxLayout()
        vbox.addLayout(hbox)
        vbox.addWidget(helpLink)

        self.setLayout(vbox)

        qtUtils.resizeWindow(self, 500, 200)
        qtUtils.centerWindow(self)
Ejemplo n.º 2
0
    def __init__(self, client, messageQueue, isLightTheme):
        QMainWindow.__init__(self)

        self.client = client
        self.messageQueue = messageQueue
        self.isLightTheme = isLightTheme

        self.__setMenubar()

        self.chatLog = QTextEdit()
        self.chatLog.setReadOnly(True)

        self.chatInput = QTextEdit()
        self.chatInput.textChanged.connect(self.chatInputTextChanged)

        self.sendButton = QPushButton("Send")
        self.sendButton.clicked.connect(self.sendMessage)

        # Set the min height for the chatlog and a matching fixed height for the send button
        chatInputFontMetrics = QFontMetrics(self.chatInput.font())
        self.chatInput.setMinimumHeight(chatInputFontMetrics.lineSpacing() * 3)
        self.sendButton.setFixedHeight(chatInputFontMetrics.lineSpacing() * 3)

        hboxLayout = QHBoxLayout()
        hboxLayout.addWidget(self.chatInput)
        hboxLayout.addWidget(self.sendButton)

        # Put the chatinput and send button in a wrapper widget so they may be added to the splitter
        chatInputWrapper = QWidget()
        chatInputWrapper.setLayout(hboxLayout)
        chatInputWrapper.setMinimumHeight(chatInputFontMetrics.lineSpacing() * 3.7)

        # Put the chat log and chat input into a splitter so the user can resize them at will
        splitter = QSplitter(Qt.Vertical)
        splitter.addWidget(self.chatLog)
        splitter.addWidget(chatInputWrapper)
        splitter.setSizes([int(self.height()), 1])

        vboxLayout = QVBoxLayout()
        vboxLayout.addWidget(splitter)

        # Add the completeted layout to the window
        self.centralWidget = QWidget()
        self.centralWidget.setLayout(vboxLayout)
        self.setCentralWidget(self.centralWidget)

        qtUtils.resizeWindow(self, 700, 400)
        qtUtils.centerWindow(self)

        # Title and icon
        self.setWindowTitle("Cryptully")
        self.setWindowIcon(QIcon(utils.getAbsoluteResourcePath('images/' + ('light' if isLightTheme else 'dark') + '/icon.png')))
        self.statusBar().showMessage("Not Connected")
Ejemplo n.º 3
0
    def __init__(self, parent, nick=""):
        QDialog.__init__(self, parent)
        self.nick = None

        # Set the title and icon
        self.setWindowTitle("Cryptully")
        self.setWindowIcon(QIcon(qtUtils.getAbsoluteImagePath('icon.png')))

        helpLink = QLinkLabel("Confused? Read the docs.", "https://cryptully.readthedocs.org/en/latest/", self)

        vbox = QVBoxLayout()
        vbox.addStretch(1)
        vbox.addWidget(QNickInputWidget('splash_icon.png', 200, self.connectClicked, nick, self))
        vbox.addStretch(1)
        vbox.addWidget(helpLink, alignment=Qt.AlignRight)

        self.setLayout(vbox)

        qtUtils.resizeWindow(self, 500, 200)
        qtUtils.centerWindow(self)
Ejemplo n.º 4
0
    def __init__(self, restartCallback, connectionManager=None, messageQueue=None):
        QMainWindow.__init__(self)

        self.restartCallback = restartCallback
        self.connectionManager = connectionManager
        self.messageQueue = messageQueue
        self.newClientSignal.connect(self.newClientSlot)
        self.clientReadySignal.connect(self.clientReadySlot)
        self.smpRequestSignal.connect(self.smpRequestSlot)
        self.handleErrorSignal.connect(self.handleErrorSlot)
        self.sendMessageToTabSignal.connect(self.sendMessageToTab)

        self.chatTabs = QTabWidget(self)
        self.chatTabs.setTabsClosable(True)
        self.chatTabs.setMovable(True)
        self.chatTabs.tabCloseRequested.connect(self.closeTab)
        self.chatTabs.currentChanged.connect(self.tabChanged)

        self.statusBar = self.statusBar()
        self.systemTrayIcon = QSystemTrayIcon(self)
        self.systemTrayIcon.setVisible(True)

        self.__setMenubar()

        vbox = QVBoxLayout()
        vbox.addWidget(self.chatTabs)

        # Add the completeted layout to the window
        self.centralWidget = QWidget()
        self.centralWidget.setLayout(vbox)
        self.setCentralWidget(self.centralWidget)

        qtUtils.resizeWindow(self, 700, 400)
        qtUtils.centerWindow(self)

        # Title and icon
        self.setWindowTitle("Cryptully")
        self.setWindowIcon(QIcon(qtUtils.getAbsoluteImagePath('icon.png')))
Ejemplo n.º 5
0
    def __init__(self, parent, nick=""):
        QDialog.__init__(self, parent)
        self.nick = None

        # Set the title and icon
        self.setWindowTitle("Cryptully")
        self.setWindowIcon(QIcon(qtUtils.getAbsoluteImagePath('icon.png')))

        helpLink = QLinkLabel("Confused? Read the docs.",
                              "https://cryptully.readthedocs.org/en/latest/",
                              self)

        vbox = QVBoxLayout()
        vbox.addStretch(1)
        vbox.addWidget(
            QNickInputWidget('splash_icon.png', 200, self.connectClicked, nick,
                             self))
        vbox.addStretch(1)
        vbox.addWidget(helpLink, alignment=Qt.AlignRight)

        self.setLayout(vbox)

        qtUtils.resizeWindow(self, 500, 200)
        qtUtils.centerWindow(self)