def connectServer(self): global config global serv selected_serv, selected_url = self.get_serv_url() print('You choose: ', selected_serv, "URL:", selected_url) msg = "Your choice: " + selected_serv + "\n" msg = msg + "URL: " + selected_url + "\n" self.textBrowser_Serv.setText(msg) if not self.tab_PC.isEnabled(): self.tab_PC.setEnabled(True) QApplication.changeOverrideCursor(Qt.ArrowCursor)
def mouseMoveEvent(self, event): cursor = QCursor(Qt.ArrowCursor) QApplication.setOverrideCursor(cursor) QApplication.changeOverrideCursor(cursor) super().mouseMoveEvent(event)
def normal_cursor(self): # Returns the cursor to normal cursor cursor = QCursor(Qt.ArrowCursor) QApplication.setOverrideCursor(cursor) QApplication.changeOverrideCursor(cursor)
def change_cursor(self): # Changes the cursor to indicate that our QAction is clickable cursor = QCursor(Qt.PointingHandCursor) QApplication.setOverrideCursor(cursor) QApplication.changeOverrideCursor(cursor)
game_dict[line[0]] = (line[1], line[2].rstrip('\n')) games = [] dirs = (config['rom_path'], config['exe_path']) for direc in dirs: for file in os.listdir(direc): if file not in to_ignore: try: info = game_dict[file] except KeyError: print('Could not find info for ' + file + ', skipping') continue if file.endswith(".zip"): games.append(Game(file.rstrip('.zip'), info[0], info[1], 'arcade')) elif file.endswith('.lnk'): games.append(Game(file.rstrip('.lnk'), info[0], info[1], 'exe')) games.sort() # consider a better data structure? return games if __name__ == '__main__': app = QApplication(sys.argv) ex = VArcMain() ex.setObjectName('window') cursor = QCursor(Qt.BlankCursor) app.setOverrideCursor(cursor) app.changeOverrideCursor(cursor) app.setFont(QFont('Karmatic Arcade', 16, 400)) sys.exit(app.exec_())
def normalCursor(self): cursor = QCursor(Qt.ArrowCursor) QApplication.setOverrideCursor(cursor) QApplication.changeOverrideCursor(cursor)
def returnCursorToNormal(self): cursor = QCursor(Qt.ArrowCursor) QApplication.setOverrideCursor(cursor) QApplication.changeOverrideCursor(cursor)
def mouseMoveEvent(self, QMouseEvent): # font = textCursor.block().charFormat().font() # metrics = QFontMetrics(font) # # b = self.document().findBlockByLineNumber(0) # # cursor = QTextCursor(b) # # cursor.select(QTextCursor.BlockUnderCursor) # # cursor.removeSelectedText() # # height = metrics.height() + 2 # y = QMouseEvent.pos().y() #print(y, height) #print(y/height) cursor_main = self.cursorForPosition(QMouseEvent.pos()) if QApplication.queryKeyboardModifiers() == Qt.ControlModifier: cursor_main.select(QTextCursor.WordUnderCursor) text = cursor_main.selectedText() self.text = text if self.text is not None: url = "https://docs.python.org/3/library/functions.html#" + self.text word = self.text # self.parent.parent.showBrowser(url, word) if self.check_func(word): extraSelections = self.highlightCurrentLine() selection = QTextEdit.ExtraSelection() selection.format.setFontUnderline(True) selection.format.setUnderlineColor(QColor("#00d2ff")) selection.format.setForeground(QColor("#00d2ff")) selection.format.setProperty( QTextFormat.FullWidthSelection, True) selection.cursor = self.cursorForPosition( QMouseEvent.pos()) selection.cursor.select(QTextCursor.WordUnderCursor) extraSelections.append(selection) self.setExtraSelections(extraSelections) cursor = QCursor(Qt.PointingHandCursor) # tooltip = QToolTip() QToolTip.setFont( QFont(editor["ToolTipFont"], editor["ToolTipFontSize"])) word_shown = eval(word).__doc__ if len(word_shown) > 2000: word_shown = word_shown[:2000] QToolTip.showText(QCursor.pos(), "{}".format(word_shown)) QApplication.setOverrideCursor(cursor) QApplication.changeOverrideCursor(cursor) else: self.returnCursorToNormal() else: pass else: self.returnCursorToNormal() extraSelections = self.highlightCurrentLine() self.setExtraSelections(extraSelections) super().mouseMoveEvent(QMouseEvent)
def overrideCursor(self, cursor): self._cursor = cursor if self.currentCursor() is None: QApplication.setOverrideCursor(cursor) else: QApplication.changeOverrideCursor(cursor)
def mouseMoveEvent(self, QMouseEvent): # TODO: finish cursor: QCursor = QCursor(Qt.IBeamCursor) QApplication.setOverrideCursor(cursor) QApplication.changeOverrideCursor(cursor) super().mouseMoveEvent(QMouseEvent)