我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用PyQt5.QtCore.Qt.WindowMinimized()。
def bring_to_front(self): """ Brings the terminal window to the front and places the cursor in the textbox """ self._textbox.setFocus() self.setWindowState(self.windowState() & ~Qt.WindowMinimized | Qt.WindowActive) self.raise_() self.activateWindow() # Handlers that update the labels at the bottom
def show(self): self.setWindowState(self.windowState() & Qt.WindowMinimized | Qt.WindowActive) self.activateWindow() super(QMainWindow, self).show() self.raise_()
def show_next_message(self) -> None: """Show next statusbar message. If the status bar has not been updated for 1 second, display the next message. If no messages are available, clear the status bar after it has been displayed for 5 seconds. """ current_time = time.time() time_diff = 5 if len(self.queued_messages) < 1 else 1 if self.last_update and current_time - time_diff < self.last_update: return if len(self.queued_messages) == 0: QQmlProperty.write(self.status_text, "text", "") self.last_update = None else: message = self.queued_messages.pop(0) if message['type'] == 'error': statusbar_message = "<font color='red'>? {}</color>".format( message['message']) notification_message = '? {}'.format(message['message']) else: statusbar_message = message['message'] notification_message = message['message'] QQmlProperty.write(self.status_text, "text", statusbar_message) if self.window.window.windowState() == Qt.WindowMinimized or not self.window.window.isVisible(): try: Popen(['notify-send', 'Pext', notification_message]) except Exception as e: print("Could not open notify-send: {}. Notification follows after exception:".format(e)) traceback.print_exc() print(notification_message) self.last_update = current_time
def _process_window_state(self, event) -> None: if event & Qt.WindowMinimized: if Settings.get('minimize_mode') in [MinimizeMode.Tray, MinimizeMode.TrayManualOnly]: self.window.hide()
def show(self) -> None: """Show the window.""" if self.window.windowState() == Qt.WindowMinimized: self.window.showNormal() else: self.window.show() self.window.raise_() self.activateWindow()
def toggle_visibility(self, force_tray=False) -> None: """Toggle window visibility.""" if self.window.windowState() == Qt.WindowMinimized or not self.window.isVisible(): self.show() else: self.close(force_tray=force_tray)
def activateWindow(self): if not self._activationWindow: return self._activationWindow.setWindowState(self._activationWindow.windowState() & ~Qt.WindowMinimized) self._activationWindow.raise_() self._activationWindow.activateWindow()
def cb_boundary_slider_released(self): # destroy cursors on spectru mwindow self._app.windows['spectrumWindow'].get_current_widget().destroy_cursors() # bring window to front self.show() self.setWindowState(self.windowState() & ~Qt.WindowMinimized | Qt.WindowActive) self.activateWindow()
def cb_area_slider_released(self): # remove area map from the map canvas self._app.windows['mapWindow'].ui.tab_widget.currentWidget().destroy_area_map() # bring this window to front again self.setWindowState(self.windowState() & ~Qt.WindowMinimized | Qt.WindowActive) self.activateWindow()
def cb_limit_slider_released(self): # remove cursor from the spectrum canvas self._app.windows['spectrumWindow'].get_current_widget().destroy_cursors() # bring window to front self.show() self.setWindowState(self.windowState() & ~Qt.WindowMinimized | Qt.WindowActive) self.activateWindow()
def cb_threshold_slider_released(self): # destroy threshold map from the map canvas self._app.windows['mapWindow'].ui.tab_widget.currentWidget().destroy_threshold_map() # bring window to front self.setWindowState(self.windowState() & ~Qt.WindowMinimized | Qt.WindowActive) self.activateWindow()
def create_cursors(self, x1, x2): # check whether the spectrum window was visible self._visible_flag = self.parent().isVisible() # create cursor self._spectrum_canvas.create_cursors(x1, x2) # bring window to front self.parent().show() self.parent().setWindowState(self.windowState() & ~Qt.WindowMinimized | Qt.WindowActive) self.parent().activateWindow()
def create_threshold_map(self, threshold_data, threshold): # create threshold map on the map canvas self._map_canvas.create_threshold_map(threshold_data, threshold) # bring window to front self.setWindowState(self.windowState() & ~Qt.WindowMinimized | Qt.WindowActive) self.activateWindow()
def changeEvent(self, event): """ Executed when the main window is modified. """ QMainWindow.changeEvent(self, event) if b3.getPlatform() == 'nt': if event.type() == QEvent.WindowStateChange: if event.oldState() != Qt.WindowMinimized and self.isMinimized(): self.minimize_in_system_tray()
def make_visible(self): """ Make sure that the main window is visible """ self.setWindowState((self.windowState() & ~Qt.WindowMinimized) | Qt.WindowActive) self.activateWindow() self.raise_() self.show()