Exemplo n.º 1
0
 def setUp(self):
     self.original = QKeySequence("Ctrl+P")
Exemplo n.º 2
0
 def init_shortcuts(self):
     self.save_btn.setShortcut(QKeySequence('Ctrl+s'))
     self.close_btn.setShortcut(QKeySequence('Ctrl+q'))
     self.email_btn.setShortcut(QKeySequence('Ctrl+Shift+e'))
     self.print_btn.setShortcut(QKeySequence(self.tr('Ctrl+p')))
     QShortcut(QKeySequence(self.tr('Ctrl+w')), self, self.save_and_close)
Exemplo n.º 3
0
 def init_shortcuts(self):
     self.save_btn.setShortcut(QKeySequence('Ctrl+s'))
     self.close_btn.setShortcut(QKeySequence('Ctrl+q'))
Exemplo n.º 4
0
 def testQKeySequenceQVariantOperator(self):
     # bug #775
     ks = QKeySequence(Qt.SHIFT, Qt.CTRL, Qt.Key_P, Qt.Key_R)
     self.assertEqual(TestObject.checkType(ks), 76)
Exemplo n.º 5
0
 def testAddActionKeySequenceSlot(self):
     action = self.menu.addAction(self.icon, 'Quit', self.app,
                                  SLOT('quit()'), QKeySequence('Ctrl+O'))
Exemplo n.º 6
0
 def testAddActionKeySequenceCallable(self):
     # bug #228
     action = self.menu.addAction(self.icon, self.app.tr('aaa'), lambda: 1,
                                  QKeySequence(self.app.tr('Ctrl+O')))
Exemplo n.º 7
0
    def __init__(self):

        url = QLineEdit()
        quality = QLineEdit()
        urlLabel = QLabel('Url')
        qualityLabel = QLabel('Quality')
        messages = QTextEdit()
        messagesLabel = QLabel('Messages')
        links = QTableWidget(0, 2)
        linksLabel = QLabel('Links')
        clearMessages = QPushButton('Clear Messages')
        checkIfOnline = QPushButton('Check If Online')
        addSelectedLink = QPushButton('Add Link')
        removeSelectedLink = QPushButton('Remove Selected Link')

        messages.setReadOnly(True)

        links.setHorizontalHeaderLabels(['Url', 'Status'])
        links.horizontalHeader().setResizeMode(QHeaderView.Stretch)
        links.horizontalHeader().setResizeMode(1, QHeaderView.Fixed)

        # set the events

        url.returnPressed.connect(self.select_stream_from_entry)
        quality.returnPressed.connect(self.select_stream_from_entry)
        links.itemDoubleClicked.connect(self.select_stream_from_link)
        clearMessages.clicked.connect(self.clear_messages)
        checkIfOnline.clicked.connect(self.check_if_online)
        addSelectedLink.clicked.connect(self.add_selected_link)
        removeSelectedLink.clicked.connect(self.remove_selected_link)

        #set shortcut
        checkIfOnline.setShortcut(QKeySequence(Qt.Key_F5))

        # set the layouts

        mainLayout = QGridLayout()

        # first row
        mainLayout.addWidget(urlLabel, 0, 0, 1, 1)  # spans 1 column
        mainLayout.addWidget(qualityLabel, 0, 1, 1, 1)  # spans 1 column
        mainLayout.addWidget(linksLabel, 0, 2, 1, 3)  # spans 3 columns

        # second row  (links widget occupies 2 rows and 2 columns)
        mainLayout.addWidget(url, 1, 0, 1, 1)  # spans 1 column
        mainLayout.addWidget(quality, 1, 1, 1, 1)  # spans 1 column
        mainLayout.addWidget(links, 1, 2, 2, 3)  # spans 3 columns

        # third row (messages widget occupies 2 columns)
        mainLayout.addWidget(messages, 2, 0, 1, 2)

        # fourth row
        mainLayout.addWidget(messagesLabel, 3, 0)
        mainLayout.addWidget(clearMessages, 3, 1)
        mainLayout.addWidget(checkIfOnline, 3, 2)
        mainLayout.addWidget(addSelectedLink, 3, 3)
        mainLayout.addWidget(removeSelectedLink, 3, 4)

        window = QWidget()

        window.setLayout(mainLayout)
        window.setWindowTitle('Live Streamer')
        window.resize(700, 350)
        window.show()

        self.url_ui = url
        self.quality_ui = quality
        self.messages_ui = messages
        self.links_ui = links
        self.window_ui = window

        self.links = set()

        self.data_file = os.path.join(os.path.expanduser("~"), ".config",
                                      "livestreamer-ui", "data.txt")
        folder = os.path.dirname(self.data_file)
        if not os.path.exists(folder):
            os.makedirs(folder)