Ejemplo n.º 1
0
 def closeEvent(self, event: QCloseEvent) -> None:
     """Qt Close Event: Window close & cleanup"""
     if not self.__window:
         event.accept()
     else:
         self.__window.close()
         event.setAccepted(self.__window.isHidden())
Ejemplo n.º 2
0
    def closeEvent(self, event: QCloseEvent):
        ask_exit = self.stacked_widget.currentWidget().askExit()

        if ask_exit:
            event.accept()
        else:
            event.ignore()
Ejemplo n.º 3
0
 def closeEvent(self, event: QCloseEvent):
     logger.debug(locals())
     if self.unsaved_check():
         self.write_settings()
         event.accept()
     else:
         event.ignore()
Ejemplo n.º 4
0
 def closeEvent(self, event: QtGui.QCloseEvent) -> None:
     close = QtWidgets.QMessageBox.question(self, "Thoát", "Bạn chắc chắn muốn thoát?",
                                 QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
     if close == QtWidgets.QMessageBox.Yes:
         self.OnExitGUI()
     else:
         event.ignore()
Ejemplo n.º 5
0
    def closeEvent(self, event: QCloseEvent):
        if not self.safe_to_change():
            event.ignore()

            return

        super(MainWindow, self).closeEvent(event)
Ejemplo n.º 6
0
 def closeEvent(self, event: QCloseEvent):
     if self.__setup_widget:
         self.__setup_widget.close()
     if self.__metal_main_widget:
         self.__slicer_widget.close()
         self.__metal_main_widget.close()
     event.accept()
Ejemplo n.º 7
0
    def closeEvent(self, arg__1: QtGui.QCloseEvent):
        # If we don't do this the widgets get deleted from their parent when the window closes.
        #  Typically this would be fine but since we are storing the widgets statically we don't want them deleted.
        for contact in self.contact_widgets:
            contact.setParent(None)

        arg__1.accept()
Ejemplo n.º 8
0
 def deal_with_close(self, event: QCloseEvent):
     if self.can_close:
         self.closed.emit()
         event.accept()
     else:
         self.cannot_closed.emit()
         event.ignore()
Ejemplo n.º 9
0
    def closeEvent(self, a0: QtGui.QCloseEvent) -> None:
        if self.pb:
            try:
                self.pb.stop_signal.emit()
            except Exception:
                pass
        if self.app.fastflix.currently_encoding:
            sm = QtWidgets.QMessageBox()
            sm.setText(f"<h2>{t('There is a conversion in process!')}</h2>")
            sm.addButton(t("Cancel Conversion"), QtWidgets.QMessageBox.RejectRole)
            sm.addButton(t("Close GUI Only"), QtWidgets.QMessageBox.DestructiveRole)
            sm.addButton(t("Keep FastFlix Open"), QtWidgets.QMessageBox.AcceptRole)
            sm.exec_()
            if sm.clickedButton().text() == "Cancel Conversion":
                self.app.fastflix.worker_queue.put(["cancel"])
                time.sleep(0.5)
                self.main.close()
            elif sm.clickedButton().text() == "Close GUI Only":
                self.main.close(no_cleanup=True)
                return super(Container, self).closeEvent(a0)
            else:
                a0.ignore()
                return

        for item in self.app.fastflix.config.work_path.iterdir():
            if item.is_dir() and item.stem.startswith("temp_"):
                shutil.rmtree(item, ignore_errors=True)
            if item.name.lower().endswith((".jpg", ".jpeg", ".png", ".gif", ".tiff", ".tif")):
                item.unlink()
        shutil.rmtree(self.app.fastflix.config.work_path / "covers", ignore_errors=True)
        if reusables.win_based:
            cleanup_windows_notification()
        self.main.close(from_container=True)
        super(Container, self).closeEvent(a0)
Ejemplo n.º 10
0
 def closeEvent(self, event: QCloseEvent) -> None:
     window_size = self.size()
     self._config.setValue(X_SIZE, window_size.width())
     self._config.setValue(Y_SIZE, window_size.height())
     window_loc = self.pos()
     self._config.setValue(X_LOC, window_loc.x())
     self._config.setValue(Y_LOC, window_loc.y())
     event.accept()
Ejemplo n.º 11
0
def test_close_event(mocker, dialog_builder, close):
    dialog = dialog_builder.build(5)
    warning = mocker.patch("PySide2.QtWidgets.QMessageBox.warning")
    warning.return_value = (QMessageBox.Yes if close else QMessageBox.No)
    evt = QCloseEvent()

    dialog.closeEvent(evt)
    assert evt.isAccepted() is close
Ejemplo n.º 12
0
 def closeEvent(self, a0: QtGui.QCloseEvent) -> None:
     if self.stackedWidget.currentIndex() == 1:
         self.stackedWidget.setCurrentIndex(0)
         self.owner().qtReadImg.AddHistory()
         self.LoadHistory()
         a0.ignore()
     else:
         a0.accept()
Ejemplo n.º 13
0
 def closeEvent(self, event: QCloseEvent):
     G.loading = None
     if G.mainwindow is None:
         try:
             current_app.release()
         except Exception:
             pass
     event.accept()
Ejemplo n.º 14
0
 def closeEvent(self, event: QCloseEvent) -> None:
     """
     Override closeEvent to set the Configuration popup to not visible instead of deleting it.
     :param event: QCloseEvent - the close event to capture and override
     :return None:
     """
     event.ignore()
     self.setVisible(False)
Ejemplo n.º 15
0
 def closeEvent(self, event: QCloseEvent):
     ret = QMessageBox.question(self, self.tr("Sc2 bot"),
                               self.tr("Are you sure you want to exit?"),
                               QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
     if ret == QMessageBox.Yes:
         event.accept()
         self.bot.stop_game()
     else:
         event.ignore()
Ejemplo n.º 16
0
 def closeEvent(self, event: QCloseEvent):
     if self.__setup_widget:
         self.__setup_widget.close()
     if self.__dlp_main_widget:
         self.__printer_widget.close()
         self.__slicer_widget.close()
         self.__settings_widget.close()
         self.__dlp_main_widget.close()
     event.accept()
Ejemplo n.º 17
0
 def closeEvent(self, event: QCloseEvent):
     self.std_reader_worker.read_queue = False
     self._queue_background_to_foreground.put(("End.", False))
     self._background_reader_thread.join()
     self._right_side.midi_player.end_signal = 'End.'
     self._right_side.end_signal = 'End.'
     self._right_side.player_timer_thread.join()
     self._queue_foreground_to_background.put(("End.", False))
     event.accept()
Ejemplo n.º 18
0
 def closeEvent(self, event: QCloseEvent) -> None:
     if self._settings.gui.close_to_systray:
         # Ignore the close event, hide the window (and create the systray
         # icon) instead
         event.ignore()
         self.hide_window()
     else:
         # Go ahead
         super().closeEvent(event)
Ejemplo n.º 19
0
 def closeEvent(self, event: QCloseEvent) -> None:
     result = QMessageBox.question(
         self, "Quit Liberation?",
         "Are you sure you want to quit? All unsaved progress will be lost.",
         QMessageBox.Yes | QMessageBox.No)
     if result == QMessageBox.Yes:
         super().closeEvent(event)
     else:
         event.ignore()
Ejemplo n.º 20
0
 def closeEvent(self, event: QCloseEvent):
     user_response = self.maybe_save(
         self, text='Do you want to save the game before exiting?')
     if user_response == QMessageBox.Cancel:
         event.ignore()
         return
     if user_response == QMessageBox.Yes:
         self.save_file()
     event.accept()
Ejemplo n.º 21
0
    def closeEvent(self, event: QCloseEvent):
        if not self.safe_to_change():
            event.ignore()

            return

        auto_save_rom_path.unlink(missing_ok=True)
        auto_save_level_data_path.unlink(missing_ok=True)

        super(MainWindow, self).closeEvent(event)
Ejemplo n.º 22
0
 def closeEvent(self, event: QCloseEvent):
     try:
         self.dlp_gui.close()
     except:
         print("already deleted")
     try:
         self.metal_gui.close()
     except:
         print("already deleted")
     event.accept()
Ejemplo n.º 23
0
 def closeEvent(self, event: QCloseEvent):
     if self.quit_:
         G.pool_done = True
         try:
             self.widget.close()
         except:
             pass
         event.accept()
     else:
         self.hide()
         event.ignore()
Ejemplo n.º 24
0
 def closeEvent(self, event: QtGui.QCloseEvent):
     description = "是否退出当前程序?"
     reply = QtWidgets.QMessageBox.warning(
         self, "警告", description,
         QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
         QtWidgets.QMessageBox.No)
     if reply == QtWidgets.QMessageBox.Yes:
         event.accept()
     else:
         event.ignore()
         self.showMinimized()
Ejemplo n.º 25
0
 def closeEvent(self, event: QtGui.QCloseEvent) -> None:
     close = QMessageBox.question(self, "Thoát",
                                  "Bạn chắc chắn muốn thoát?",
                                  QMessageBox.Yes | QMessageBox.No)
     if close == QMessageBox.Yes:
         event.accept()
         self.close()
         self.parentWindow.Disconnect()
         self.parentWindow.show()
     else:
         event.ignore()
Ejemplo n.º 26
0
 def closeEvent(self, event: QCloseEvent) -> None:
     """
     Do not allow user to close window directly.
     :param event: The close event.
     :return: None
     """
     event.ignore()
     self.setWindowState(Qt.WindowMinimized)
     if self.windowState() == Qt.WindowMinimized:
         self.setWindowState(Qt.WindowNoState)
     elif self.windowState() == Qt.WindowNoState:
         self.setWindowState(Qt.WindowMinimized)
Ejemplo n.º 27
0
 def closeEvent(self, event: QCloseEvent) -> None:
     result = QMessageBox.question(
         self,
         "Quit Liberation?",
         "Are you sure you want to quit? All unsaved progress will be lost.",
         QMessageBox.Yes | QMessageBox.No,
     )
     if result == QMessageBox.Yes:
         self._save_window_geometry()
         super().closeEvent(event)
         self.dialog = None
     else:
         event.ignore()
Ejemplo n.º 28
0
 def closeEvent(self, event: QtGui.QCloseEvent) -> None:
     close = QMessageBox.question(self, "Thoát",
                                  ("Kết nối vẫn còn hiệu lực. " if
                                   self.clientProgram.connected else "") +
                                  "Bạn chắc chắn muốn thoát?",
                                  QMessageBox.Yes | QMessageBox.No)
     if close == QMessageBox.Yes:
         self.Disconnect()
         self.close()
         event.accept()
         self.close()
     else:
         event.ignore()
Ejemplo n.º 29
0
 def closeEvent(self, event: QtGui.QCloseEvent):
     if self._check_for_edit_dialog():
         event.ignore()
     else:
         data = data_writer.write_game_description(self.game_description)
         if data != self._last_data:
             user_response = QMessageBox.warning(
                 self, "Unsaved changes",
                 "You have unsaved changes. Do you want to close and discard?",
                 QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
             if user_response == QMessageBox.No:
                 return event.ignore()
         super().closeEvent(event)
Ejemplo n.º 30
0
    def closeEvent(self, event: QtGui.QCloseEvent):
        """
        This overridden method gets called before actually destroying self.

        It's used to finalize some resources and then it passes the event up the chain to let PySide2 deal with it.
        """
        SettingsWindow.shut_down()
        ContactsWindow.shut_down()

        # We have no choice but to do it this way because i have no control over how much time a call through algosdk
        #  could take and it's not possible to dirty kill a QRunnable.
        if QtCore.QThreadPool.globalInstance().activeThreadCount() > 0:
            self.setVisible(False)
            self.exec_dialog(ClosingWindow)

        event.accept()