def setCursorVisible(self, visible): self.setCursor(QCursor(Qt.ArrowCursor if visible else Qt.BlankCursor))
def enterEvent(self, event): self.font.setUnderline(True) self.setFont(self.font) self.app.setOverrideCursor(QCursor(Qt.PointingHandCursor)) return QLabel.enterEvent(self, event)
def mouseReleaseEvent(self, QMouseEvent): self.m_drag = False self.setCursor(QCursor(Qt.ArrowCursor))
def open_project(self, file_path, clear_thumbnails=True): """ Open a project from a file path, and refresh the screen """ app = get_app() _ = app._tr # Get translation function # Do we have unsaved changes? if get_app().project.needs_save(): ret = QMessageBox.question( self, _("Unsaved Changes"), _("Save changes to project first?"), QMessageBox.Cancel | QMessageBox.No | QMessageBox.Yes) if ret == QMessageBox.Yes: # Save project self.actionSave.trigger() elif ret == QMessageBox.Cancel: # User canceled prompt return # Set cursor to waiting get_app().setOverrideCursor(QCursor(Qt.WaitCursor)) try: if os.path.exists(file_path): # Clear any previous thumbnails #if clear_thumbnails: # self.clear_all_thumbnails() # Load project file app.project.load(file_path) # Set Window title self.SetWindowTitle() # Reset undo/redo history app.updates.reset() app.updates.load_history(app.project) # Reset selections self.clearSelections() # Refresh file tree self.filesTreeView.refresh_view() # Load recent projects again self.load_recent_menu() log.info("Loaded project {}".format(file_path)) else: # If statement is required, as if the user hits "Cancel" # on the "load file" dialog, it is interpreted as trying # to open a file with a blank name. This could use some # improvement. if file_path != "": # Prepare to use status bar self.statusBar = QStatusBar() self.setStatusBar(self.statusBar) log.info("File not found at {}".format(file_path)) self.statusBar.showMessage( _("Project {} is missing (it may have been moved or deleted). It has been removed from the Recent Projects menu." .format(file_path)), 5000) self.remove_recent_project(file_path) self.load_recent_menu() except Exception as ex: log.error("Couldn't open project {}".format(file_path)) QMessageBox.warning(self, _("Error Opening Project"), str(ex)) # Restore normal cursor get_app().restoreOverrideCursor()
def mousePressEvent(self, event): if event.button() == Qt.LeftButton: self.m_drag = True self.m_DragPosition = event.globalPos() - self.pos() event.accept() self.setCursor(QCursor(Qt.OpenHandCursor))
def rehighlight(self): QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) QSyntaxHighlighter.rehighlight(self) QApplication.restoreOverrideCursor()
def __init__(self, text): super().__init__(text) self.setWordWrap(True) self.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.setTextInteractionFlags(Qt.TextSelectableByMouse) self.setCursor(QCursor(Qt.IBeamCursor))
def __init__(self, canvas, config=None): super(PolylineTool, self).__init__(canvas) self.logger = roam.utils.logger if not config: self.config = {} else: self.config = config self.geom = None self.minpoints = 2 self.editmode = False self.editvertex = None self.points = [] self.is_tracking = False self.canvas = canvas self.valid_color = QColor.fromRgb(32, 218, 45, 100) self.invalid_color = QColor.fromRgb(216, 26, 96, 100) self.startcolour = self.valid_color self.editcolour = self.valid_color self.band = RubberBand(self.canvas, QgsWkbTypes.LineGeometry, width=5, iconsize=20) self.band.setColor(self.startcolour) self.errorband = RubberBand(self.canvas, QgsWkbTypes.LineGeometry, width=5, iconsize=20) self.errorband.setColor(QColor.fromRgb(64, 64, 64, 90)) self.errorlocations = QgsRubberBand(self.canvas, QgsWkbTypes.PointGeometry) self.errorlocations.setColor(self.invalid_color) self.errorlocations.setIconSize(20) self.errorlocations.setIcon(QgsRubberBand.ICON_BOX) self.pointband = QgsRubberBand(self.canvas, QgsWkbTypes.PointGeometry) self.pointband.setColor(self.startcolour) self.pointband.setIconSize(20) self.capturing = False self.cursor = QCursor( QPixmap([ "16 16 3 1", " c None", ". c #FF0000", "+ c #FFFFFF", " ", " +.+ ", " ++.++ ", " +.....+ ", " +. .+ ", " +. . .+ ", " +. . .+ ", " ++. . .++", " ... ...+... ...", " ++. . .++", " +. . .+ ", " +. . .+ ", " ++. .+ ", " ++.....+ ", " ++.++ ", " +.+ " ])) self.captureaction = CaptureAction(self, "line", text="Digitize") self.captureaction.toggled.connect(self.update_state) self.trackingaction = GPSTrackingAction(self) self.endcaptureaction = EndCaptureAction(self) self.undoaction = UndoAction(self) self.undoaction.setEnabled(False) self.undoaction.triggered.connect(self.undo) self.trackingaction.setEnabled(False) self.trackingaction.toggled.connect(self.set_tracking) self.captureaction.toggled.connect(self.update_end_capture_state) self.trackingaction.toggled.connect(self.update_end_capture_state) self.endcaptureaction.setEnabled(False) self.endcaptureaction.triggered.connect(self.endcapture) self.gpscapture = GPSCaptureAction(self, "line") self.gpscapture.setText("Add Vertex") self.gpscapture.triggered.connect(self.add_vertex_avg) self.timer = QTimer() GPS.gpsfixed.connect(self.update_tracking_button) GPS.gpsdisconnected.connect(self.update_tracking_button_disconnect) RoamEvents.selectioncleared.connect(self.selection_updated) RoamEvents.selectionchanged.connect(self.selection_updated) self.snapping = True self.active_color = self.startcolour
def freeze(self): QApplication.setOverrideCursor(QCursor(QtCore.Qt.WaitCursor))
def mouseReleaseEvent(self, QMouseEvent): ''' redefine已有的鼠标释放事件 ''' self.m_flag = False self.setCursor(QCursor(Qt.ArrowCursor))
def start(self, fn): """ Public slot to start the svn status command. @param fn filename(s)/directoryname(s) to show the status of (string or list of strings) """ self.errorGroup.hide() for act in self.menuactions: act.setEnabled(False) self.addButton.setEnabled(False) self.commitButton.setEnabled(False) self.diffButton.setEnabled(False) self.sbsDiffButton.setEnabled(False) self.revertButton.setEnabled(False) self.restoreButton.setEnabled(False) self.statusFilterCombo.clear() self.__statusFilters = [] self.statusList.clear() self.shouldCancel = False self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) self.refreshButton.setEnabled(False) QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) QApplication.processEvents() self.args = fn self.setWindowTitle(self.tr('Subversion Status')) self.activateWindow() self.raise_() if isinstance(fn, list): self.dname, fnames = self.vcs.splitPathList(fn) else: self.dname, fname = self.vcs.splitPath(fn) fnames = [fname] opts = self.vcs.options['global'] + self.vcs.options['status'] verbose = "--verbose" in opts recurse = "--non-recursive" not in opts update = "--show-updates" in opts hideChangelistColumn = True hidePropertyStatusColumn = True hideLockColumns = True hideUpToDateColumn = True hideHistoryColumn = True hideSwitchedColumn = True locker = QMutexLocker(self.vcs.vcsExecutionMutex) cwd = os.getcwd() os.chdir(self.dname) try: for name in fnames: # step 1: determine changelists and their files changelistsDict = {} if hasattr(self.client, 'get_changelist'): if recurse: depth = pysvn.depth.infinity else: depth = pysvn.depth.immediate changelists = self.client.get_changelist(name, depth=depth) for fpath, changelist in changelists: fpath = Utilities.normcasepath(fpath) changelistsDict[fpath] = changelist hideChangelistColumn = (hideChangelistColumn and len(changelistsDict) == 0) # step 2: determine status of files allFiles = self.client.status(name, recurse=recurse, get_all=verbose, ignore=True, update=update) counter = 0 for file in allFiles: uptodate = True if file.repos_text_status != pysvn.wc_status_kind.none: uptodate = (uptodate and file.repos_text_status != pysvn.wc_status_kind.modified) if file.repos_prop_status != pysvn.wc_status_kind.none: uptodate = (uptodate and file.repos_prop_status != pysvn.wc_status_kind.modified) lockState = " " if (file.entry is not None and hasattr(file.entry, 'lock_token') and file.entry.lock_token is not None): lockState = "L" if hasattr(file, 'repos_lock') and update: if lockState == "L" and file.repos_lock is None: lockState = "B" elif lockState == " " and file.repos_lock is not None: lockState = "O" elif (lockState == "L" and file.repos_lock is not None and file.entry.lock_token != file.repos_lock["token"]): lockState = "S" fpath = Utilities.normcasepath( os.path.join(self.dname, file.path)) if fpath in changelistsDict: changelist = changelistsDict[fpath] else: changelist = "" hidePropertyStatusColumn = (hidePropertyStatusColumn and file.prop_status in [ pysvn.wc_status_kind.none, pysvn.wc_status_kind.normal ]) hideLockColumns = (hideLockColumns and not file.is_locked and lockState == " ") hideUpToDateColumn = hideUpToDateColumn and uptodate hideHistoryColumn = (hideHistoryColumn and not file.is_copied) hideSwitchedColumn = (hideSwitchedColumn and not file.is_switched) self.__generateItem( changelist, file.text_status, file.prop_status, file.is_locked, file.is_copied, file.is_switched, lockState, uptodate, file.entry and file.entry.revision.number or "", file.entry and file.entry.commit_revision.number or "", file.entry and file.entry.commit_author or "", file.path) counter += 1 if counter == 30: # check for cancel every 30 items counter = 0 if self._clientCancelCallback(): break if self._clientCancelCallback(): break except pysvn.ClientError as e: self.__showError(e.args[0] + '\n') self.statusList.setColumnHidden(self.__propStatusColumn, hidePropertyStatusColumn) self.statusList.setColumnHidden(self.__lockedColumn, hideLockColumns) self.statusList.setColumnHidden(self.__lockinfoColumn, hideLockColumns) self.statusList.setColumnHidden(self.__upToDateColumn, hideUpToDateColumn) self.statusList.setColumnHidden(self.__historyColumn, hideHistoryColumn) self.statusList.setColumnHidden(self.__switchedColumn, hideSwitchedColumn) self.statusList.setColumnHidden(self.__changelistColumn, hideChangelistColumn) locker.unlock() self.__finish() os.chdir(cwd)
def __init__(self, parent=None): super(MainWindow, self).__init__() self.statusBar().showMessage("Move Dial to Deform Microphone Voice !.") self.setWindowTitle(__doc__) self.setMinimumSize(240, 240) self.setMaximumSize(480, 480) self.resize(self.minimumSize()) self.setWindowIcon(QIcon.fromTheme("audio-input-microphone")) self.tray = QSystemTrayIcon(self) self.center() QShortcut("Ctrl+q", self, activated=lambda: self.close()) self.menuBar().addMenu("&File").addAction("Quit", lambda: exit()) self.menuBar().addMenu("Sound").addAction( "STOP !", lambda: call("killall rec", shell=True) ) windowMenu = self.menuBar().addMenu("&Window") windowMenu.addAction("Hide", lambda: self.hide()) windowMenu.addAction("Minimize", lambda: self.showMinimized()) windowMenu.addAction("Maximize", lambda: self.showMaximized()) windowMenu.addAction("Restore", lambda: self.showNormal()) windowMenu.addAction("FullScreen", lambda: self.showFullScreen()) windowMenu.addAction("Center", lambda: self.center()) windowMenu.addAction("Top-Left", lambda: self.move(0, 0)) windowMenu.addAction("To Mouse", lambda: self.move_to_mouse_position()) # widgets group0 = QGroupBox("Voice Deformation") self.setCentralWidget(group0) self.process = QProcess(self) self.process.error.connect( lambda: self.statusBar().showMessage("Info: Process Killed", 5000) ) self.control = QDial() self.control.setRange(-10, 20) self.control.setSingleStep(5) self.control.setValue(0) self.control.setCursor(QCursor(Qt.OpenHandCursor)) self.control.sliderPressed.connect( lambda: self.control.setCursor(QCursor(Qt.ClosedHandCursor)) ) self.control.sliderReleased.connect( lambda: self.control.setCursor(QCursor(Qt.OpenHandCursor)) ) self.control.valueChanged.connect( lambda: self.control.setToolTip(f"<b>{self.control.value()}") ) self.control.valueChanged.connect( lambda: self.statusBar().showMessage( f"Voice deformation: {self.control.value()}", 5000 ) ) self.control.valueChanged.connect(self.run) self.control.valueChanged.connect(lambda: self.process.kill()) # Graphic effect self.glow = QGraphicsDropShadowEffect(self) self.glow.setOffset(0) self.glow.setBlurRadius(99) self.glow.setColor(QColor(99, 255, 255)) self.control.setGraphicsEffect(self.glow) self.glow.setEnabled(False) # Timer to start self.slider_timer = QTimer(self) self.slider_timer.setSingleShot(True) self.slider_timer.timeout.connect(self.on_slider_timer_timeout) # an icon and set focus QLabel(self.control).setPixmap( QIcon.fromTheme("audio-input-microphone").pixmap(32) ) self.control.setFocus() QVBoxLayout(group0).addWidget(self.control) self.menu = QMenu(__doc__) self.menu.addAction(__doc__).setDisabled(True) self.menu.setIcon(self.windowIcon()) self.menu.addSeparator() self.menu.addAction( "Show / Hide", lambda: self.hide() if self.isVisible() else self.showNormal(), ) self.menu.addAction("STOP !", lambda: call("killall rec", shell=True)) self.menu.addSeparator() self.menu.addAction("Quit", lambda: exit()) self.tray.setContextMenu(self.menu) self.make_trayicon()
def __init__(self, *args, **kwargs): super().__init__() #Create our 4 main buttons, the add contacts button will only be visible #on the contacts screen self.setStyleSheet( 'background-color: #242424; color: white; font-size: 14pt;' 'font: Courier;') self.create = QtWidgets.QPushButton(self) self.create.setText("Create Project") # padding: 6px;') self.create.setStyleSheet( "QPushButton{background-color : darkSlateGray;}" "QPushButton::pressed{background-color : #242424;}") self.create.setCursor(QCursor(QtCore.Qt.PointingHandCursor)) self.create.clicked.connect(self.createProj) self.view = QtWidgets.QPushButton(self) self.view.setText("View All Projects") self.view.setStyleSheet( "QPushButton{background-color : darkSlateGray;}" "QPushButton::pressed{background-color : #242424;}") self.view.setCursor(QCursor(QtCore.Qt.PointingHandCursor)) self.view.clicked.connect(self.projView) self.contacts = QtWidgets.QPushButton(self) self.contacts.setText("Contacts") self.contacts.setStyleSheet( "QPushButton{background-color : darkSlateGray;}" "QPushButton::pressed{background-color : #242424;}") self.contacts.setCursor(QCursor(QtCore.Qt.PointingHandCursor)) self.contacts.clicked.connect(self.contactsView) #This button is hidden and only made visible on contacts screen self.NewContact = QtWidgets.QPushButton(self) self.NewContact.setText("Add New Contact") self.NewContact.clicked.connect(self.addNew) self.NewContact.setStyleSheet( "QPushButton{background-color : darkSlateGray;}" "QPushButton::pressed{background-color : #242424;}") self.NewContact.setCursor(QCursor(QtCore.Qt.PointingHandCursor)) self.NewContact.hide() self.controls = QWidget() #Controls container widget. self.controlsLayout = QVBoxLayout() #Controls container layout. # List of names, widgets are stored in a dictionary by these keys. self.projWidget = [] project_dict = s.listProjects(folder_id, service) #Iterating through all the projects, creating a widget #for each one with their own buttons for name in project_dict: project_id = project_dict[name] #print("adding",name, "to widget:", project_id, "ProjectWindow") item = ProjectWidget( name, project_id, self ) #make a project widget with the name of the current project self.controlsLayout.insertWidget( 0, item ) #^^^ we pass self so we can hide it from the widgets inside it self.projWidget.append( item) #append it to our list of widgets of projects self.contWidget = [] #empty list of contact widgets contacts = s.addContact(None, None, None) #get the list of contacts for name in contacts: user_email = contacts[ name] #accessing email from dictionary of contacts item = contactsWidget( name, user_email, self ) #make a project widget with the name of the current project #and with the list with file_id and project_id self.controlsLayout.insertWidget(0, item) self.contWidget.append( item) #append it to our list of widgets of projects #Hide the contacts until the contact view is opened for widget in self.contWidget: widget.hide() self.fileWidget = [ ] #declaring this for later use in viewing the files in a project #Hide the project view widgets until a project is clicked for widget in self.fileWidget: widget.hide() spacer = QSpacerItem(1, 1, QSizePolicy.Minimum, QSizePolicy.Expanding) self.controlsLayout.addItem(spacer) self.controls.setLayout(self.controlsLayout) # Scroll Area Properties. self.scroll = QScrollArea() self.scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.scroll.setWidgetResizable(True) self.scroll.setWidget(self.controls) # Search bar. self.searchbar = QLineEdit() self.searchbar.setStyleSheet( 'background-color: white; color: black; font: Courier; padding: 6px;' 'border-style: outset;' 'border-width: 2px; border-radius: 6px;' 'border-color: beige;') self.searchbar.textChanged.connect(self.update_display) # Adding Completer. self.completer = QCompleter(project_dict) self.completer.setCaseSensitivity(Qt.CaseInsensitive) self.searchbar.setCompleter(self.completer) #Add the items to VBoxLayout (applied to container widget) #which encompasses the whole window. container = QWidget() containerLayout = QVBoxLayout() containerLayout.addWidget(self.create) containerLayout.addWidget(self.view) containerLayout.addWidget(self.contacts) containerLayout.addWidget(self.NewContact) containerLayout.addWidget(self.searchbar) containerLayout.addWidget(self.scroll) container.setLayout(containerLayout) self.setCentralWidget(container) self.showMaximized() self.setWindowTitle('StudioHub') #when we initialise this is the current window #We will keep track of this and hide all other results outside of it self.currentWindow = self.projWidget
def __init__(self): super(UserInfoUi, self).__init__() self.factor = QApplication.desktop().screenGeometry().width() / 100 self.resize(self.factor * 16, self.factor * 20) self.setWindowOpacity(1) self.setWindowFlags(Qt.FramelessWindowHint) self.setAttribute(Qt.WA_TranslucentBackground, True) self.setContentsMargins(0, 0, 0, 0) main_layout = QVBoxLayout() main_layout.setSpacing(0) v_layout = QVBoxLayout() h_layout = QHBoxLayout() self.user_name = QPushButton('admin') self.is_vip = QPushButton() self.is_vip.setCursor(QCursor(Qt.PointingHandCursor)) self.is_vip.setIcon(QIcon(':/default/default_icons/is_crown.ico')) h_layout.addWidget(self.user_name) h_layout.addWidget(self.is_vip) h_layout.addStretch() self.capacity_bar = QProgressBar() self.capacity_bar.setValue(30) self.capacity_bar.setFixedHeight(self.factor) self.capacity_bar.setTextVisible(False) self.capacity_info = QLabel('6G/20G') v_layout.addLayout(h_layout) v_layout.addWidget(self.capacity_bar) v_layout.addWidget(self.capacity_info) self.v_widget = QWidget(self) self.v_widget.setWindowOpacity(1) self.v_widget.setLayout(v_layout) self.personal_center = QPushButton('个人中心') self.help_center = QPushButton('帮助中心') self.switch_account = QPushButton('切换账号') self.exit_account = QPushButton('退出') self.personal_center.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self.help_center.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self.switch_account.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self.exit_account.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) button_widget = QWidget() button_layout = QVBoxLayout() button_layout.setSpacing(self.factor * 0.5) button_layout.addWidget(self.personal_center) button_layout.addWidget(self.help_center) button_layout.addWidget(self.switch_account) button_layout.addWidget(self.exit_account) button_widget.setLayout(button_layout) main_layout.addWidget(self.v_widget) main_layout.addWidget(button_widget) main_layout.setStretchFactor(self.v_widget, 2) main_layout.setStretchFactor(button_widget, 10) self.setLayout(main_layout) self.v_widget.setObjectName('user_info') self.user_name.setObjectName('transparent') self.is_vip.setObjectName('transparent') self.capacity_info.setObjectName('transparent') button_widget.setObjectName('color')
def exportSource(self): """ Public method performing the export. """ filename = self._getFileName(self.tr("HTML Files (*.html)")) if not filename: return try: QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) QApplication.processEvents() fn = self.editor.getFileName() if fn: extension = os.path.normcase(os.path.splitext(fn)[1][1:]) else: extension = "" if (extension in Preferences.getEditor( "PreviewMarkdownFileNameExtensions") or self.editor.getLanguage().lower() == "markdown"): # export markdown to HTML html = self.__generateFromMarkdown() elif (extension in Preferences.getEditor("PreviewRestFileNameExtensions") or self.editor.getLanguage().lower() == "restructuredtext"): # export ReST to HTML html = self.__generateFromReSTDocutils() else: tabSize = self.editor.getEditorConfig("TabWidth") if tabSize == 0: tabSize = 4 wysiwyg = Preferences.getEditorExporter("HTML/WYSIWYG") folding = Preferences.getEditorExporter("HTML/Folding") onlyStylesUsed = Preferences.getEditorExporter( "HTML/OnlyStylesUsed") titleFullPath = Preferences.getEditorExporter( "HTML/FullPathAsTitle") tabs = Preferences.getEditorExporter("HTML/UseTabs") generator = HTMLGenerator(self.editor) html = generator.generate(tabSize=tabSize, useTabs=tabs, wysiwyg=wysiwyg, folding=folding, onlyStylesUsed=onlyStylesUsed, titleFullPath=titleFullPath) if html: try: f = open(filename, "w", encoding="utf-8") f.write(html) f.close() except IOError as err: QApplication.restoreOverrideCursor() E5MessageBox.critical( self.editor, self.tr("Export source"), self.tr( """<p>The source could not be exported to""" """ <b>{0}</b>.</p><p>Reason: {1}</p>""").format( filename, str(err))) else: QApplication.restoreOverrideCursor() E5MessageBox.critical( self.editor, self.tr("Export source"), self.tr("""<p>The source could not be exported to""" """ <b>{0}</b>.</p><p>Reason: No HTML code""" """ generated.</p>""").format(filename)) finally: QApplication.restoreOverrideCursor()
def semifreeze(self): QApplication.setOverrideCursor(QCursor(QtCore.Qt.BusyCursor))
def mousePressEvent(self, event): self.posMouseOrigin = QCursor().pos()
def setupUi(self, yemeksepetiSiparisOtomatizasyonu): yemeksepetiSiparisOtomatizasyonu.setObjectName( "yemeksepetiSiparisOtomatizasyonu") yemeksepetiSiparisOtomatizasyonu.resize(600, 375) self.yemeksepetiOtomatizasyonu = QtWidgets.QWidget( yemeksepetiSiparisOtomatizasyonu) self.yemeksepetiOtomatizasyonu.setObjectName( "yemeksepetiOtomatizasyonu") self.label = QtWidgets.QLabel(self.yemeksepetiOtomatizasyonu) self.label.setGeometry(QtCore.QRect(80, 30, 475, 41)) font = QtGui.QFont() font.setFamily("Muli") font.setPointSize(22.7) self.label.setFont(font) self.label.setObjectName("label") self.otomatikSiparisOlustur = QtWidgets.QPushButton( self.yemeksepetiOtomatizasyonu) self.otomatikSiparisOlustur.setGeometry(QtCore.QRect(80, 110, 181, 41)) font = QtGui.QFont() font.setFamily("Open Sans") font.setPointSize(10) font.setBold(False) font.setWeight(50) self.otomatikSiparisOlustur.setFont(font) self.otomatikSiparisOlustur.setObjectName("otomatikSiparisOlustur") self.otomatikSiparisOlustur.setCursor( QCursor(QtCore.Qt.PointingHandCursor)) self.otomatikSiparisOlustur.clicked.connect( self.otomatikSiparisOlusturAc) self.siparisVer = QtWidgets.QPushButton(self.yemeksepetiOtomatizasyonu) self.siparisVer.setGeometry(QtCore.QRect(330, 110, 181, 41)) font = QtGui.QFont() font.setFamily("Open Sans") font.setPointSize(10) font.setBold(False) font.setWeight(50) self.siparisVer.setFont(font) self.siparisVer.setObjectName("siparisVer") self.siparisVer.setCursor(QCursor(QtCore.Qt.PointingHandCursor)) self.siparisVer.clicked.connect(self.siparisVerAc) self.kullanimKlavuzu = QtWidgets.QPushButton( self.yemeksepetiOtomatizasyonu) self.kullanimKlavuzu.setGeometry(QtCore.QRect(80, 160, 431, 41)) font = QtGui.QFont() font.setFamily("Open Sans") font.setPointSize(10) font.setBold(False) font.setWeight(50) self.kullanimKlavuzu.setFont(font) self.kullanimKlavuzu.setObjectName("kullanimKlavuzu") self.kullanimKlavuzu.setCursor(QCursor(QtCore.Qt.PointingHandCursor)) self.kullanimKlavuzu.clicked.connect(self.kullanimKlavuzuAc) self.label_2 = QtWidgets.QLabel(self.yemeksepetiOtomatizasyonu) self.label_2.setGeometry(QtCore.QRect(210, 310, 170, 16)) font = QtGui.QFont() font.setFamily("Muli") font.setPointSize(10) self.label_2.setFont(font) self.label_2.setObjectName("label_2") yemeksepetiSiparisOtomatizasyonu.setCentralWidget( self.yemeksepetiOtomatizasyonu) self.menubar = QtWidgets.QMenuBar(yemeksepetiSiparisOtomatizasyonu) self.menubar.setGeometry(QtCore.QRect(0, 0, 600, 21)) self.menubar.setObjectName("menubar") yemeksepetiSiparisOtomatizasyonu.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(yemeksepetiSiparisOtomatizasyonu) self.statusbar.setObjectName("statusbar") yemeksepetiSiparisOtomatizasyonu.setStatusBar(self.statusbar) self.retranslateUi(yemeksepetiSiparisOtomatizasyonu) QtCore.QMetaObject.connectSlotsByName(yemeksepetiSiparisOtomatizasyonu)
def wait_cursor(self): try: QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) yield finally: QApplication.restoreOverrideCursor()
def _enter_add_line_mode(self): for view in self.views(): view.setCursor(QCursor(Qt.CrossCursor))
def mousePressEvent(self, event): if event.button() == Qt.LeftButton: self.m_flag = True self.m_Position = event.globalPos() - self.pos() # 获取鼠标相对窗口的位置 event.accept() self.setCursor(QCursor(Qt.OpenHandCursor)) # 更改鼠标图标
def _leave_add_line_mode(self): for view in self.views(): view.setCursor(QCursor(Qt.ArrowCursor)) self._anker_pt = None print(self._lines)
def mouseReleaseEvent(self, QMouseEvent): self.m_flag = False self.setCursor(QCursor(Qt.ArrowCursor)) self.isPressedWidget = False
def create_form_layout(self): self.form_layout = QFormLayout() self.form_layout.setFormAlignment(Qt.AlignCenter) self.form_layout.setAlignment(Qt.AlignCenter) self.name_entry = QLineEdit() self.name_entry.setPlaceholderText("Name") self.name_entry.setFixedSize(300, 30) self.age_line_edit = QLineEdit() self.age_line_edit.setPlaceholderText("Age") self.age_line_edit.setFixedSize(300, 30) gender = QGroupBox() gender.setAlignment(Qt.AlignCenter) gender.setFixedSize(185, 40) gender_layout = QHBoxLayout() gender_layout.setAlignment(Qt.AlignCenter) gender_label = QLabel("Gender", self) gender_label.setAlignment(Qt.AlignCenter) gender_label.setFixedSize(115, 30) self.male_button = QRadioButton("Male") self.male_button.setChecked(True) self.female_button = QRadioButton("Female") gender_layout.addWidget(self.male_button) gender_layout.addWidget(self.female_button) gender.setLayout(gender_layout) units = QGroupBox() units.setAlignment(Qt.AlignCenter) units.setFixedSize(185, 40) units_layout = QHBoxLayout() units_layout.setAlignment(Qt.AlignCenter) units_label = QLabel("Units", self) units_label.setAlignment(Qt.AlignCenter) units_label.setFixedSize(115, 30) self.metric_button = QRadioButton("Metric") self.metric_button.setChecked(True) self.metric_button.toggled.connect(lambda: self.change_height_input()) self.imperial_button = QRadioButton("Imperial") self.imperial_button.toggled.connect( lambda: self.change_height_input()) units_layout.addWidget(self.metric_button) units_layout.addWidget(self.imperial_button) units.setLayout(units_layout) self.weight_entry = QLineEdit() self.weight_entry.setPlaceholderText("Weight") self.weight_entry.setFixedSize(300, 30) self.height_layout = QHBoxLayout() self.height_entry = QLineEdit() self.height_entry.setFixedSize(300, 30) self.height_entry.setPlaceholderText("Height") self.height_layout.addWidget(self.height_entry) self.form_layout.addRow(self.name_entry) self.form_layout.addRow(self.age_line_edit) self.form_layout.addRow(gender_label, gender) self.form_layout.addRow(units_label, units) self.form_layout.addRow(self.weight_entry) self.form_layout.addRow(self.height_layout) goal_label = QLabel("Goal", self) goal_label.setAlignment(Qt.AlignCenter) goal_label.setFixedSize(115, 30) goal_layout = QVBoxLayout() goal_layout.setAlignment(Qt.AlignCenter) goal = QGroupBox() goal.setAlignment(Qt.AlignCenter) goal.setFixedSize(185, 120) self.weight_loss_button = QRadioButton("Weight loss") self.weight_loss_button.setChecked(True) self.weight_loss_button.toggled.connect( lambda: self.hide_or_show_params_layout()) self.maintain_weight_button = QRadioButton("Maintain weight") self.maintain_weight_button.toggled.connect( lambda: self.hide_or_show_params_layout()) self.weight_gain_button = QRadioButton("Weight gain") self.weight_gain_button.toggled.connect( lambda: self.hide_or_show_params_layout()) goal_layout.addWidget(self.weight_loss_button) goal_layout.addWidget(self.maintain_weight_button) goal_layout.addWidget(self.weight_gain_button) goal.setLayout(goal_layout) self.form_layout.addRow(goal_label, goal) self.params_label = QLabel("Goal Parameters:") self.params_label.setFixedWidth(300) self.params_layout = self.calorie_params_layout() self.form_layout.addRow(self.params_label) self.form_layout.addRow(self.params_layout) self.signup_button = QPushButton("Signup", self) self.signup_button.clicked.connect(lambda: self.signup()) self.signup_button.setFixedSize(230, 30) self.signup_button.setCursor(QCursor(Qt.PointingHandCursor)) self.form_layout.addRow(self.signup_button) return self.form_layout
def setupUi(self, menuEkrani3): menuEkrani3.setObjectName("menuEkrani3") menuEkrani3.resize(500, 550) self.centralwidget = QtWidgets.QWidget(menuEkrani3) self.centralwidget.setObjectName("centralwidget") self.siparisAdi = QtWidgets.QLabel(self.centralwidget) self.siparisAdi.setGeometry(QtCore.QRect(20, 20, 211, 21)) font = QtGui.QFont() font.setFamily("Muli") font.setPointSize(12) self.siparisAdi.setFont(font) self.siparisAdi.setObjectName("siparisAdi") self.kullaniciAdi = QtWidgets.QLabel(self.centralwidget) self.kullaniciAdi.setGeometry(QtCore.QRect(20, 70, 450, 21)) font = QtGui.QFont() font.setFamily("Muli") font.setPointSize(12) self.kullaniciAdi.setFont(font) self.kullaniciAdi.setObjectName("kullaniciAdi") self.sehir = QtWidgets.QLabel(self.centralwidget) self.sehir.setGeometry(QtCore.QRect(20, 120, 350, 21)) font = QtGui.QFont() font.setFamily("Muli") font.setPointSize(12) self.sehir.setFont(font) self.sehir.setObjectName("sehir") self.restoran = QtWidgets.QLabel(self.centralwidget) self.restoran.setGeometry(QtCore.QRect(20, 170, 350, 21)) font = QtGui.QFont() font.setFamily("Muli") font.setPointSize(12) self.restoran.setFont(font) self.restoran.setObjectName("restoran") self.birinciParca = QtWidgets.QLabel(self.centralwidget) self.birinciParca.setGeometry(QtCore.QRect(20, 220, 431, 21)) font = QtGui.QFont() font.setFamily("Muli") font.setPointSize(12) self.birinciParca.setFont(font) self.birinciParca.setObjectName("birinciParca") self.ikinciParca = QtWidgets.QLabel(self.centralwidget) self.ikinciParca.setGeometry(QtCore.QRect(20, 270, 431, 21)) font = QtGui.QFont() font.setFamily("Muli") font.setPointSize(12) self.ikinciParca.setFont(font) self.ikinciParca.setObjectName("ikinciParca") self.ucuncuParca = QtWidgets.QLabel(self.centralwidget) self.ucuncuParca.setGeometry(QtCore.QRect(20, 320, 431, 21)) font = QtGui.QFont() font.setFamily("Muli") font.setPointSize(12) self.ucuncuParca.setFont(font) self.ucuncuParca.setObjectName("ucuncuParca") self.siparisiSil = QtWidgets.QPushButton(self.centralwidget) self.siparisiSil.setGeometry(QtCore.QRect(270, 410, 181, 41)) font = QtGui.QFont() font.setFamily("Raleway") font.setPointSize(12) self.siparisiSil.setFont(font) self.siparisiSil.setStyleSheet( "background-color: rgb(255, 0, 0); border: none; color: rgb(0, 0, 0);" ) self.siparisiSil.setObjectName("siparisiSil") self.siparisiSil.setCursor(QCursor(QtCore.Qt.PointingHandCursor)) self.siparisiSil.clicked.connect(self.siparisiSilme) self.siparisVer = QtWidgets.QPushButton(self.centralwidget) self.siparisVer.setGeometry(QtCore.QRect(20, 410, 181, 41)) font = QtGui.QFont() font.setFamily("Raleway") font.setPointSize(12) font.setBold(False) font.setWeight(50) self.siparisVer.setFont(font) self.siparisVer.setStyleSheet( "background-color: rgb(0, 255, 0); border: none; color: rgb(0, 0, 0);" ) self.siparisVer.setObjectName("siparisVer") self.siparisVer.setCursor(QCursor(QtCore.Qt.PointingHandCursor)) self.siparisVer.clicked.connect(self.siparisVerme) self.not1 = QtWidgets.QLabel(self.centralwidget) self.not1.setGeometry(QtCore.QRect(20, 470, 451, 16)) self.not1.setObjectName("not1") menuEkrani3.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(menuEkrani3) self.menubar.setGeometry(QtCore.QRect(0, 0, 500, 21)) self.menubar.setObjectName("menubar") menuEkrani3.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(menuEkrani3) self.statusbar.setObjectName("statusbar") menuEkrani3.setStatusBar(self.statusbar) self.retranslateUi(menuEkrani3) QtCore.QMetaObject.connectSlotsByName(menuEkrani3)
def enterEvent(self, QEvent): self.setCursor(QCursor(Qt.PointingHandCursor))
def leaveEvent(self, event): self.font.setUnderline(False) self.setFont(self.font) self.app.setOverrideCursor(QCursor(Qt.ArrowCursor)) return QLabel.leaveEvent(self, event)
from PyQt5.QtCore import QUrl, Qt, QObject, pyqtSignal, pyqtSlot from PyQt5.QtGui import QGuiApplication, QCursor from PyQt5.QtQuick import QQuickView from PyQt5.QtQml import qmlRegisterType from OpenGL import GLU class App(QGuiApplication): def __init__(self, argv): super(App, self).__init__(argv) if __name__ == '__main__': try: app = App(sys.argv) qmlRegisterType(RadialBar, "SDK", 1,0, "RadialBar") if os.uname()[4][:3] == 'arm': app.setOverrideCursor( QCursor( Qt.BlankCursor) ) view = QQuickView() ctxt = view.rootContext() view.setSource(QUrl("main.qml")) view.show() ret = app.exec_() except Exception as e: print ("dupoa")
def initUI(self): grid = QGridLayout() self.setLayout(grid) # title_img QLabel self.title_img = QLabel() self.title_img.setStyleSheet(self.hover_css()) self.title_img.setAlignment(Qt.AlignCenter) grid.addWidget(self.title_img, 0, 0, 1, 3) # ts QDateTimeEdit time_label = QLabel() time_label.setPixmap(self.time_img) grid.addWidget(time_label, 1, 0) # now_btn QRadioButton self.now_btn = QRadioButton('Now') self.now_btn.setChecked(True) self.now_btn.setCursor(QCursor(Qt.PointingHandCursor)) grid.addWidget(self.now_btn, 1, 1, 1, 1) # manual_btn QRadioButton self.manual_btn = QRadioButton('Manually') self.manual_btn.setCursor(QCursor(Qt.PointingHandCursor)) grid.addWidget(self.manual_btn, 1, 2, 1, 1) # ts QDateTimeEdit self.ts = QDateTimeEdit(self) self.ts.setDateTime(self.datetime) self.ts.setDateTimeRange(QDateTime(1900, 1, 1, 00, 00, 00), QDateTime(2100, 1, 1, 00, 00, 00)) self.ts.setDisplayFormat('yyyy.MM.dd hh:mm') grid.addWidget(self.ts, 2, 2, 1, 1) # msg label msg_label = QLabel() msg_label.setPixmap(self.msg_img) grid.addWidget(msg_label, 3, 0) # msg QTextEdit self.msg = QTextEdit() self.msg.setStyleSheet( "background-color: white; border-radius: 10px; border: 3px solid white;" ) self.msg.installEventFilter(self) grid.addWidget(self.msg, 4, 0, 1, 3) # in_btn, out_btn Qlabel self.in_btn = QLabel() self.in_btn.setAlignment(Qt.AlignCenter) self.in_btn.setCursor(QCursor(Qt.PointingHandCursor)) self.out_btn = QLabel() self.out_btn.setAlignment(Qt.AlignCenter) self.out_btn.setCursor(QCursor(Qt.PointingHandCursor)) grid.addWidget(self.in_btn, 5, 1) grid.addWidget(self.out_btn, 5, 2) # stats_btn QLabel stats_btn = QLabel() stats_btn.setPixmap(self.stats_img) stats_btn.setAlignment(Qt.AlignLeft) stats_btn.setCursor(QCursor(Qt.PointingHandCursor)) grid.addWidget(stats_btn, 5, 0) # confirm text QLabel self.confirmlabel = QLabel(self.confirm_msg, self) grid.addWidget(self.confirmlabel, 6, 0, 1, 3) # conditional images if self.status == 'IN': self.in_btn.setPixmap(self.in_grey_img) self.out_btn.setPixmap(self.out_img) self.title_img.setPixmap(self.awake_img) else: self.in_btn.setPixmap(self.in_img) self.out_btn.setPixmap(self.out_grey_img) self.title_img.setPixmap(self.sleep_img) ### EVENT ### clickable(self.in_btn).connect(self.inCheck) clickable(self.out_btn).connect(self.outCheck) clickable(stats_btn).connect(self.openWeb) self.setWindowTitle('BENJI') self.setStyleSheet("background-color: rgb(220,208,255);") self.setGeometry(300, 300, 300, 200) self.show()
def html(self): QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) html = """ <!DOCTYPE html> <html> <head> </head> <style> * { font-size: 75%; font-family: "Times New Roman", Times, serif; } table, th, td { border-collapse: collapse; } th, td { padding: 5px; } th { text-align: left; } </style> <body> """ html = html + ("<H1>" + self.lblCommonName.text() + "</H1>") html = html + ("<H2>" + self.lblScientificName.text() + "</H2>") html = html + ("<H4>" + self.lblOrderName.text() + "</H4>") html = html + ("<H4>" + self.lblFirstSeen.text() + "</H4>") html = html + ("<H4>" + self.lblMostRecentlySeen.text() + "</H4>") html = html + ("<br>" + "<H4>" + "Locations" "</H4>") html = html + ("<font size='2'>") root = self.trLocations.invisibleRootItem() for i in range(root.childCount()): for ii in range(root.child(i).childCount()): for iii in range(root.child(i).child(ii).childCount()): for iv in range( root.child(i).child(ii).child(iii).childCount()): html = html + ( "<b>" + root.child(i).text(0) + ", " + root.child(i).child(ii).text(0) + ", " + root.child(i).child(ii).child(iii).text(0) + ", " + root.child(i).child(ii).child(iii).child(iv).text( 0)) filter = code_Filter.Filter() filter.setSpeciesName = self.lblCommonName.text() filter.setLocationType("Location") filter.setLocationName( root.child(i).child(ii).child(iii).child(iv).text( 0)) dates = self.mdiParent.db.GetDates(filter) html = html + (" (" + str(len(dates))) if len(dates) > 1: html = html + " dates)" else: html = html + " date)" html = html + ("</b>" "<br>" "<table width='100%'>" "<tr>") R = 1 for d in dates: html = html + ("<td>" + d + "</td>") if R == 5: html = html + ("</tr>" "<tr>") R = 0 R = R + 1 html = html + ("<br>" + "<br>" + "<br>" + "</table>") html = html + ("<font size>" + "</body>" + "</html>") QApplication.restoreOverrideCursor() return (html)