def closeEvent(self, evt):
     settings = QSettings(QSettings.UserScope, "cortex", "ArchivViewer")
     settings.setValue("geometry", self.saveGeometry())
     settings.setValue("windowState", self.saveState())
     settings.setValue("splitter", self.splitter.saveState())
     settings.sync()
     QMainWindow.closeEvent(self, evt)
Exemple #2
0
 def closeEvent(self, event: QtGui.QCloseEvent):
     QMainWindow.closeEvent(self, event)
     self._labeled_data[['label', 'path', 'path_to_image'
                         ]].to_csv(utils.LABELLING_OUTPUT_PATH, index=False)
     self._dropped_data[['label', 'path', 'path_to_image'
                         ]].to_csv(utils.LABELLING_DROPPED_PATH,
                                   index=False)
Exemple #3
0
    def closeEvent(self, ev):

        if self.game.is_active():
            if self.ai_session is not None:
                try:
                    self.stop_ai()
                except Exception as e:
                    logging.exception(e)
                    print(e)

            try:
                self.game.capitulate()
            except Exception as e:
                logging.exception(e)
                print(e)

        use_local_server = self.settings.value("use_local_server", type=bool)
        if use_local_server and self.local_server_used:
            try:
                self.game.shutdown()
            except RequestError as e:
                self._handle_game_error(e.rs)
            except Exception as e:
                logging.exception(e)
                print(e)

        self.settings.setValue("UI/geometry", self.saveGeometry())
        self.settings.setValue("UI/windowState", self.saveState())
        QMainWindow.closeEvent(self, ev)
Exemple #4
0
    def closeEvent(self, event):
        self.saveWindowSettings()

        if self.quitApp():
            QMainWindow.closeEvent(self, event)
        else:
            event.ignore()
Exemple #5
0
    def handleQtCloseEvent(self, event):
        if self.isTrayAvailable() and self._parent.isVisible():
            event.accept()
            self.__hideShowCall()
            return

        self.close()
        QMainWindow.closeEvent(self._parent, event)
Exemple #6
0
 def closeEvent(self, e):
     result = QMessageBox.question(self, 'Подтверждение закрытия окна',
                                   'Вы действительно хотите закрыть окно?',
                                   QMessageBox.Yes | QMessageBox.No,
                                   QMessageBox.No)
     if result == QMessageBox.Yes:
         e.accept()
         QMainWindow.closeEvent(self, e)
     else:
         e.ignore()
Exemple #7
0
 def closeEvent(self, event):
     print("inside closeEvent")
     if self.ok_continue():
         self.settings = QSettings("Kerr & Associates", "Image Changer")
         self.settings.setValue("geometry", self.saveGeometry())
         self.settings.setValue("windowState", self.saveState())
         self.settings.setValue("RecentFiles", self.recentFiles)
         QMainWindow.closeEvent(self, event)
     else:
         event.ignore()
Exemple #8
0
    def closeEvent(self, event):
        if self.fIdleTimerId != 0:
            self.killTimer(self.fIdleTimerId)
            self.fIdleTimerId = 0

        self.saveSettings()

        QMainWindow.closeEvent(self, event)

        # Needed in case the web inspector is still alive
        #self.ui.webinspector.close()
        QApplication.instance().quit()
Exemple #9
0
 def closeEvent(self, event):
     if self.config_window:
         self.config_window.close()
     if self.about_window:
         self.about_window.close()
     for widget in list(GraphDisplayWidget.graph_windows.values()):
         widget.close()
     for widget in list(SelectWidget.instances):
         widget.close()
     for widget in list(ViewWidget.instances):
         widget.close()
     QMainWindow.closeEvent(self, event)
Exemple #10
0
    def closeEvent(self, event):
        settings = QSettings('construct')
        settings.setValue('select1', self.select)

        for i in range(len(self.dataList)):
            settings.setValue('list' + str(i), self.dataList[i])

        sequenceListSave = QSettings('SequenceList')
        sequenceListSave.setValue('select2', self.sequenceData)
        QMainWindow.closeEvent(self, event)

        if (self.torqueState == True):
            torque(0)
 def closeEvent(self, event):
     """Close and clean up window."""
     try:
         try:
             for name, window in self.mysubwindows.items():
                 if (window and window.isVisible()):
                     window.close()
         finally:
             self.settings.setValue("geometry", self.saveGeometry())
             self.settings.setValue("windowState", self.saveState())
             self.controller.cleanUp(self._save)
             QMainWindow.closeEvent(self, event)
             # event.accept()
     except Exception as e:
         module_logger.exception("message")
Exemple #12
0
    def closeEvent(self, event):
        server.sendToDaemon('/nsm/client/gui_is_hidden')
        settings.setValue('ProxyGui%s/geometry' % self.proxy.client_id,
                          self.saveGeometry())
        settings.setValue('ProxyGui%s/WindowState' % self.proxy.client_id,
                          self.saveState())
        settings.sync()

        if self.fields_allow_start:
            self.saveProxy()

        QMainWindow.closeEvent(self, event)

        # Quit if process is not running yet
        if not proxy.process.state() == QProcess.Running:
            sys.exit(0)
Exemple #13
0
    def closeEvent(self, *args, **kwargs):
        # Restore output stream
        sys.stdout = sys.__stdout__
        # Terminate the running threads.
        # Set the shutdown flag on each thread to trigger a clean shutdown of each thread.
        self.mainWindow.myRpcWd.shutdown_flag.set()
        logging.debug("Saving stuff & closing...")
        try:
            self.mainWindow.hwdevice.clearDevice()
        except Exception as e:
            logging.warning(str(e))

        # Update window/splitter size
        self.cache['window_width'] = self.width()
        self.cache['window_height'] = self.height()
        self.cache['splitter_x'] = self.mainWindow.splitter.sizes()[0]
        self.cache['splitter_y'] = self.mainWindow.splitter.sizes()[1]
        self.cache['console_hidden'] = (
            self.mainWindow.btn_consoleToggle.text() == 'Show')

        # persist cache
        saveCacheSettings(self.cache)

        # clear / close DB
        self.db.removeTable('UTXOS')
        self.db.close()

        # Adios
        print("Bye Bye.")
        return QMainWindow.closeEvent(self, *args, **kwargs)
Exemple #14
0
    def create_torrent(self):
        self.get_gui_values()

        # noinspection PyBroadException
        try:
            dott_window = QMainWindow(self)
            ui = dott_gui.DottorrentGUI()
            ui.setupUi(dott_window)
            ui.loadSettings()
            ui.clipboard = QApplication.instance().clipboard
            dott_window.resize(500, 800)

            # manipulate the dottorrent settings to reflect config options
            ui.directoryRadioButton.setChecked(True)
            ui.inputEdit.setText(config.opts['media_dir'])
            if config.opts['recursive'] and config.opts['output_individual']:
                ui.batchModeCheckBox.setChecked(True)
            else:
                ui.batchModeCheckBox.setChecked(False)
            if not ui.excludeEdit.toPlainText():
                ui.excludeEdit.setPlainText('*.txt\n*.ini\n*.torrent')
            ui.initializeTorrent()

            def dott_close_event(event):
                ui.saveSettings()
                event.accept()

            dott_window.closeEvent = dott_close_event
            dott_window.show()
        except:
            (errortype, value, traceback) = sys.exc_info()
            sys.excepthook(errortype, value, traceback)
    def closeEvent(self, event):

        self.label_blur_img.show()

        msgBox = QMessageBox.question(self, 'End the Service',
                                      'Are you sure you want to quit?\t',
                                      QMessageBox.Yes | QMessageBox.No,
                                      QMessageBox.Yes)
        self.setWindowIcon(QIcon('assets/icon.png'))

        if msgBox == QMessageBox.Yes:
            QMainWindow.closeEvent(self, event)
        else:
            event.ignore()

        self.label_blur_img.hide()
Exemple #16
0
 def closeEvent(self, ev):
     """ Save all settings on window close """
     self.saveFileData()
     self.settings.setValue("OffsetX", self.geometry().x() - self.x())
     self.settings.setValue("OffsetY", self.geometry().y() - self.y())
     self.settings.setValue("ZoomLevel", self.zoomLevelCombo.currentIndex())
     self.settings.setValue("HistoryFileNameList",
                            self.history_filenames[:100])
     self.settings.setValue("HistoryPageNoList", self.history_page_no[:100])
     self.settings.setValue("RecentFiles", self.recent_files[:10])
     return QMainWindow.closeEvent(self, ev)
Exemple #17
0
    def closeEvent(self, event):
        self.iface.abort()

        # save export settings to a settings file
        self.settings.saveSettings()

        settings = QSettings()
        settings.setValue("/Qgis2threejs/wnd/geometry", self.saveGeometry())
        settings.setValue("/Qgis2threejs/wnd/state", self.saveState())

        # stop worker thread event loop
        if self.thread:
            self.thread.quit()
            self.thread.wait()

        # close dialogs
        for dlg in self.findChildren(QDialog):
            dlg.close()

        QMainWindow.closeEvent(self, event)
 def closeEvent(self, event):
     if self.uploadOnClose:
         self.thread = self.processor.analyzer.UploadDBThread(
             self.processor.analyzer, download_first=True)
         self.loading = LoadingWrapper(self.thread)
         self.loading.loadingDone.connect(self.fragmentsChanged.emit)
         self.loading.loadingDone.connect(
             lambda: QMainWindow.closeEvent(self, event))
         self.loading.start()
     else:
         self.fragmentsChanged.emit()
         super().closeEvent(event)
Exemple #19
0
	def closeEvent(self, event):
		if settings.session_manager.isRunning():
			settings.session_manager.stop()
		if settings.controlled_tower_viewer.running:
			settings.controlled_tower_viewer.stop(wait=True)
		if speech_recognition_available:
			cleanup_SR_language_files()
		print('Closing main window.')
		settings.saved_strip_racks = env.strips.rackNames()
		settings.saved_strip_dock_state = self.strip_pane.stateSave()
		settings.saved_workspace_windowed_view = self.central_workspace.windowedView()
		settings.saved_workspace_windows = self.central_workspace.workspaceWindowsStateSave()
		signals.mainWindowClosing.emit()
		signals.disconnect()
		settings.saveGeneralAndSystemSettings()
		settings.saveLocalSettings(env.airport_data)
		settings.savePresetChatMessages()
		env.resetEnv()
		settings.resetSession()
		EarthCoords.clearRadarPos()
		QMainWindow.closeEvent(self, event)
    def closeEvent(self, event):
        """ Closes all open Windows """
        self.previewview.stop()
        if Project.get_instance().changed:
            msgbox = QMessageBox()
            res = msgbox.question(
                self, str(Language.current.errors.unsaved.msgboxtitle),
                str(Language.current.errors.unsaved.msgboxtext),
                QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)

            if res == QMessageBox.Yes:
                self.save_project.emit()
                QApplication.closeAllWindows()

                QMainWindow.closeEvent(self, event)

            elif res == QMessageBox.Cancel:
                event.ignore()
        else:
            QApplication.closeAllWindows()
            QMainWindow.closeEvent(self, event)
 def closeEvent(self, event):
     """Store setting on exit
     """
     sett.storeSetting('geometry', self.saveGeometry())
     sett.storeSetting('state', self.saveState())
     sett.storeSetting("splitter_1Sizes", self.splitter_1.saveState())
     sett.storeSetting("splitter_1Geo", self.splitter_1.saveGeometry())
     sett.storeSetting("splitter_2Sizes", self.splitter_2.saveState())
     sett.storeSetting('images/last_filename', self.image_name)
     sett.storeSetting('images/zoom_factor', self.getZoomFactor())
     row_l = self.comboBoxLang.currentIndex()
     lang = self.comboBoxLang.itemData(row_l)
     if lang:
         sett.storeSetting('language', lang)
     row_p = self.comboBoxPSM.currentIndex()
     sett.storeSetting('PSM', self.comboBoxPSM.itemData(row_p))
     row_r = self.comboBoxRIL.currentIndex()
     sett.storeSetting('RIL', self.comboBoxRIL.itemData(row_r))
     if self.api:
         self.tesseract.TessBaseAPIEnd(self.api)
     QMainWindow.closeEvent(self, event)
Exemple #22
0
    def closeEvent(self, *args, **kwargs):
        # Restore output stream
        sys.stdout = sys.__stdout__

        # Terminate the running threads.
        # Set the shutdown flag on each thread to trigger a clean shutdown of each thread.
        self.mainWindow.myRpcWd.shutdown_flag.set()
        logging.debug("Saving stuff & closing...")
        try:
            self.mainWindow.hwdevice.clearDevice()
        except Exception as e:
            logging.warning(str(e))

        # Update window/splitter size
        self.cache['window_width'] = self.width()
        self.cache['window_height'] = self.height()
        self.cache['splitter_x'] = self.mainWindow.splitter.sizes()[0]
        self.cache['splitter_y'] = self.mainWindow.splitter.sizes()[1]
        self.cache['console_hidden'] = (
            self.mainWindow.btn_consoleToggle.text() == 'Show')

        # Update mnList order to cache settings
        mnOrder = {}
        mnList = self.mainWindow.tabMain.myList
        for i in range(mnList.count()):
            mnName = mnList.itemWidget(mnList.item(i)).alias
            mnOrder[mnName] = i
        self.cache['mnList_order'] = mnOrder

        # persist cache
        saveCacheSettings(self.cache)

        # Clear Rewards and Governance DB
        try:
            self.db.open()
        except Exception:
            pass
        self.db.removeTable('REWARDS')
        self.db.removeTable('PROPOSALS')
        self.db.removeTable('MY_VOTES')

        # close database
        self.db.close()

        # Adios
        print("Bye Bye.")

        # Return
        return QMainWindow.closeEvent(self, *args, **kwargs)
Exemple #23
0
    def closeEvent(self, event):
        """NOT A PUBLIC API
        Close event handler.
        Shows save files dialog. Cancels close, if dialog was rejected
        """

        # saving geometry BEFORE closing widgets, because state might be changed, when docks are closed
        self._saveState()
        self._saveGeometry()

        # request close all documents
        if not core.workspace().askToCloseAll():
            event.ignore()
            return

        core.aboutToTerminate.emit()
        self.hide()

        core.workspace().forceCloseAllDocuments()

        return QMainWindow.closeEvent(self, event)
Exemple #24
0
    def closeEvent(self, event):
        """NOT A PUBLIC API
        Close event handler.
        Shows save files dialog. Cancels close, if dialog was rejected
        """

        # saving geometry BEFORE closing widgets, because state might be changed, when docks are closed
        self._saveState()
        self._saveGeometry()

        # request close all documents
        if not core.workspace().askToCloseAll():
            event.ignore()
            return

        core.aboutToTerminate.emit()
        self.hide()

        core.workspace().forceCloseAllDocuments()

        return QMainWindow.closeEvent(self, event)
Exemple #25
0
def main(server_ip):
    """Main entry point for driver station"""
    config = DriverStationConfig('ds_config.cfg')

    if not server_ip:
        server_ip = config.remote_ip
    print("Connecting to: " + server_ip)

    joysticks = Joysticks(pygame)
    network = Network(networktables.NetworkTables, 'driver_station', server_ip)

    app = QApplication(sys.argv)
    window = QMainWindow()
    driver_station = PyDriverStation(window, network, config, joysticks)
    window.closeEvent = driver_station.close_application
    window.show()

    try:
        return app.exec_()
    except KeyboardInterrupt:
        driver_station.close_application()
        print("\n\nExiting...\n\n")
        return 0
Exemple #26
0
 def closeEvent(self, event):
     self.settings.setValue("geometry", self.saveGeometry())
     QMainWindow.closeEvent(self, event)
Exemple #27
0
 def closeEvent(self, event):
     data_transporter_service.fire(APP_EXIT_CHANNEL)
     QMainWindow.closeEvent(self, event)
Exemple #28
0
    def closeEvent(self, ev):
        QMainWindow.closeEvent(self, ev)

        self.settings_save()
Exemple #29
0
    def closeEvent(self, event):
        self.closeExternalUI()
        QMainWindow.closeEvent(self, event)

        # there might be other qt windows open which will block carla-modgui from quitting
        app.quit()
Exemple #30
0
    def closeEvent(self, *args, **kwargs):
        result = QMainWindow.closeEvent(self, *args, **kwargs)

        self.translator.close()

        return result
Exemple #31
0
 def closeEvent(self, event):
     self.closeExternalUI()
     QMainWindow.closeEvent(self, event)
Exemple #32
0
 def closeEvent(self, event):
     save(self.settings)
     QMainWindow.closeEvent(self, event)
Exemple #33
0
 def closeEvent(self, event):
     self.close_sockets()
     self.slam.close()
     QMainWindow.closeEvent(self, event)
Exemple #34
0
 def closeEvent(self, event):
     if not self.quitFlag:
         self.hide()
         event.ignore()
     QMainWindow.closeEvent(self, event)
Exemple #35
0
    def closeEvent(self, event):
        self.closed.emit()

        QMainWindow.closeEvent(self, event)
 def closeEvent(self, ev):
     self.settings.setValue('window_geometry', self.saveGeometry())
     QMainWindow.closeEvent(self, ev)
Exemple #37
0
 def closeEvent(self, event):
     self.settings.setValue("mainWindow/geometry", self.saveGeometry())
     self.settings.setValue("mainWindow/windowState", self.saveState())
     QMainWindow.closeEvent(self, event)