Esempio n. 1
0
    def removeDocument(self, document, confirmation=True):
        """
        Remove a given document from the project.

        Args:
            document: PyutDocument to remove from this project
            confirmation:  If `True` ask for confirmation
        """
        frame = document.getFrame()

        if confirmation:
            self._mediator.getFileHandling().showFrame(frame)

            dlg = MessageDialog(self._mediator.getUmlFrame(), _("Are you sure to remove the document ?"),
                                _("Remove a document from a project"), YES_NO)
            if dlg.ShowModal() == ID_NO:
                dlg.Destroy()
                return
            dlg.Destroy()

        # Remove references

        fileHandling = self._mediator.getFileHandling()
        fileHandling.removeAllReferencesToUmlFrame(frame)

        document.removeFromTree()

        # Remove document from documents list
        self._documents.remove(document)
Esempio n. 2
0
 def Destroy(self):
     if self.changed:
         dlg = MessageDialog(self,
                             "編集した内容を保存しますか?",
                             "終了",
                             style=YES | NO | CANCEL)
         stat = dlg.ShowModal()
         if stat == ID_YES:
             self.Save()
         elif stat == ID_CANCEL:
             dlg.Destroy()
             return False
         dlg.Destroy()
     self.application.ExitMainLoop()
     return True
Esempio n. 3
0
    def doAction(self, umlObjects: List[OglObject],
                 selectedObjects: List[OglClass], umlFrame: UmlFrame):
        """

        Args:
            umlObjects: list of the uml objects of the diagram
            selectedObjects:  list of the selected objects
            umlFrame: the frame of the diagram
        """
        if len(selectedObjects) != 1:
            dlg: MessageDialog = MessageDialog(
                None, _("You must select at most a single class"),
                _("Warning"), OK | ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return
        oglClass: OglClass = selectedObjects[0]

        if isinstance(oglClass, OglClass) is False:
            dlg = MessageDialog(None, _('Must be a UML Class'),
                                _('Bad Selection'), OK | ICON_ERROR | CENTER)
            dlg.ShowModal()
            dlg.Destroy()
            return

        filename: str = ToFastEdit.FAST_EDIT_TEMP_FILE

        self._writeTempTextFileForEditor(filename, oglClass)
        self._launchAppropriateEditor(filename)
        self._readTheModifiedTextFile(filename, oglClass)

        self._setProjectModified()
        self._cleanupTempFile()
Esempio n. 4
0
    def __OnCheckBox(self, event: CommandEvent):
        """
        """
        self.__changed = True
        eventID = event.GetId()
        val = event.IsChecked()
        if eventID == self.__autoResizeID:
            self.__prefs[PyutPreferences.AUTO_RESIZE_SHAPE_ON_EDIT] = val
        elif eventID == self.__showParamsID:
            self.__ctrl.showParams(val)
            self.__prefs[PyutPreferences.SHOW_PARAMETERS] = val
        elif eventID == self.__maximizeID:
            self.__prefs[PyutPreferences.FULL_SCREEN] = val
        elif eventID == self.__showTipsID:
            self.__prefs[PyutPreferences.SHOW_TIPS_ON_STARTUP] = val
        elif eventID == self.__centerDiagramID:
            self.__prefs.centerAppOnStartup = val
            self.__setPositionControls()
            dlg = MessageDialog(
                self, _("You must restart Pyut for position changes"),
                _("Warning"), OK | ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()

        else:
            self.logger.warning(f'Unknown combo box ID: {eventID}')
Esempio n. 5
0
 def onClose(self, event):
     dialog = MessageDialog(self, "Close app?", "Confirm Exit",
                            OK | CANCEL | ICON_QUESTION)
     result = dialog.ShowModal()
     dialog.Destroy()
     if result == ID_OK:
         self.Destroy()
Esempio n. 6
0
    def _fillAllControls(self):
        """
        Fill all controls with _pyutModelCopy data.

        """
        # Fill Class name
        self._txtName.SetValue(self._pyutModelCopy.getName())

        # Fill Stereotype
        stereotype = self._pyutModelCopy.getStereotype()
        if stereotype is None:
            strStereotype = ""
        else:
            strStereotype = stereotype.getName()
        self._txtStereotype.SetValue(strStereotype)

        # Fill the list controls
        try:
            for el in self._pyutModelCopy.fields:
                self.logger.debug(f'field: {el}')
                self._lstFieldList.Append(str(el))

            self._fillMethodList()
        except (ValueError, Exception) as e:

            eMsg: str = _(f"Error: {e}")
            dlg = MessageDialog(self, eMsg, OK | ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()

        # Fill display properties
        self._chkShowFields.SetValue(self._pyutModelCopy.showFields)
        self._chkShowMethods.SetValue(self._pyutModelCopy.showMethods)
        self._chkShowStereotype.SetValue(
            self._pyutModelCopy.getShowStereotype())
Esempio n. 7
0
    def doAction(self, umlObjects: List[OglObject],
                 selectedObjects: List[OglObject], umlFrame: UmlFrame):
        """

        Args:
            umlObjects: list of the uml objects of the diagram
            selectedObjects:  list of the selected objects
            umlFrame: the frame of the diagram

        """
        if len(selectedObjects) != 1:
            dlg = MessageDialog(None,
                                _("You must select at most a single class"),
                                _("Warning"), OK | ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()

            return
        filename: str = ToFastEdit.FAST_EDIT_TEMP_FILE

        file: TextIO = open(filename, "w")
        self.write(selectedObjects[0], file)
        file.close()

        if sysPlatform == PyutConstants.THE_GREAT_MAC_PLATFORM:
            osSystem(f'open -W -a {self._editor} {filename}')
        else:
            osSystem(f'{self._editor} {filename}')
        file = open(filename, "r")
        self.read(selectedObjects[0], file)
        file.close()

        self._setProjectModified()
        self._cleanupTempFile()
Esempio n. 8
0
 def _on_about(self, _):
     dlg = MessageDialog(self, "Monitors save directory and backs up"
             " changes to backup directory. Backup directory is under Git"
             " version control system.\n"
             "\n"
             "Author(s):\n"
             "Vasiliy (real) Efimov\n",
         "About")
     dlg.ShowModal()
     dlg.Destroy()
Esempio n. 9
0
    def newWarning(self, msg, title=None, parent=None):

        if title is None:
            title = _("WARNING...")
        try:
            dlg = MessageDialog(parent, msg, title,
                                OK | ICON_EXCLAMATION | CENTRE)
            dlg.ShowModal()
            dlg.Destroy()
        except (ValueError, Exception) as e:
            self.logger.error(f'newWarning: {e}')
Esempio n. 10
0
    def removeDocument(self, document, confirmation=True):
        """
        Remove a given document from the project.

        Args:
            document: PyutDocument to remove from this project
            confirmation:  If `True` ask for confirmation
        """

        # Get frame
        frame = document.getFrame()

        # Confirmation
        # self._ctrl.registerUMLFrame(frame)
        if confirmation:
            self._ctrl.getFileHandling().showFrame(frame)

            # dlg = MessageDialog(self._parentFrame, _("Are you sure to remove the document ?"),
            dlg = MessageDialog(self._ctrl.getUmlFrame(), _("Are you sure to remove the document ?"),
                                _("Remove a document from a project"), YES_NO)
            if dlg.ShowModal() == ID_NO:
                dlg.Destroy()
                return
            dlg.Destroy()

        # Remove references
        from org.pyut.general import Mediator
        ctrl = Mediator.getMediator()
        fileHandling = ctrl.getFileHandling()
        fileHandling.removeAllReferencesToUmlFrame(frame)

        # Remove frame
        # frame.Close()  # DONE by fileHandling.removeAllRef...
        # self._ctrl.registerUMLFrame(None)

        # Remove from tree
        document.removeFromTree()

        # Remove document from documents list
        self._documents.remove(document)
Esempio n. 11
0
    def onClose(self) -> bool:
        """
        Close all files

        Returns:
            True if everything is ok
        """
        # Display warning if we are in scripting mode
        if self._mediator.isInScriptMode():
            self.logger.warning(
                "WARNING : in script mode, the non-saved projects are closed without warning"
            )

        # Close projects and ask for unsaved but modified projects
        if not self._mediator.isInScriptMode():
            for project in self._projects:
                if project.getModified() is True:
                    frames = project.getFrames()
                    if len(frames) > 0:
                        frame = frames[0]
                        frame.SetFocus()
                        wxYield()
                        self.showFrame(frame)
                    dlg = MessageDialog(
                        self.__parent,
                        _("Your diagram has not been saved! Would you like to save it?"
                          ), _("Save changes?"), YES_NO | ICON_QUESTION)
                    if dlg.ShowModal() == ID_YES:
                        # save
                        if self.saveFile() is False:
                            return False
                    dlg.Destroy()

        from org.pyut.ui.frame.PyutApplicationFrame import PyutApplicationFrame  # Prevent recursion import problem
        from org.pyut.ui.Mediator import Mediator

        # dereference all
        self.__notebook.DeleteAllPages()
        self.__notebook = None

        self.__parent = cast(PyutApplicationFrame, None)
        self._projects = cast(List[PyutProject], None)
        self._mediator = cast(Mediator, None)
        self._currentProject = cast(PyutProject, None)
        self._currentFrame = cast(UmlDiagramsFrame, None)

        self.__splitter = None
        self.__projectTree = None
        self.__splitter = None

        return True
Esempio n. 12
0
    def ask_and_overwrite(self):
        backupDir = self.backupDir.GetValue()
        savePath = self.saveDir.GetValue()
        if not (isdir(backupDir) and bool(savePath)):
            with MessageDialog(self.master, "Set paths up!", "Error") as dlg:
                dlg.ShowModal()
            return False

        repo = Repo(backupDir)
        if repo.is_dirty():
            with MessageDialog(self.master,
                "Backup repository '%s' is dirty" % backupDir,
                "Error") as dlg:
                dlg.ShowModal()
            return False

        active_branch = repo.active_branch

        try:
            c = active_branch.commit
        except Exception as e:
            hint = ""

            try:
                if active_branch.name == "master":
                    hint = "Is backup empty?"
            except:
                pass

            with MessageDialog(self.master,
                str(e) + "\n" + hint,
                "Error") as dlg:
                dlg.ShowModal()
            return False

        label = commit_time_str(c) + " | " + c.message

        dlg = MessageDialog(self.master,
            "Do you want to overwrite save data with current version?\n\n" +
            "SHA1: %s\n\n%s\n\n" % (c.hexsha, label) +
            "Files in save directory will be overwritten!",
            "Confirmation is required",
            YES_NO
        )
        switch = dlg.ShowModal() == ID_YES
        dlg.Destroy()
        if not switch:
            return False

        self._switch_to(c)
        return True
Esempio n. 13
0
    def __OnSizeChange(self, event: SpinEvent):

        self.__changed = True
        eventId: int = event.GetId()
        newValue: int = event.GetInt()
        if eventId == self.__scAppWidthID:
            self.__prefs.startupWidth = newValue
        elif eventId == self.__scAppHeightID:
            self.__prefs.startupHeight = newValue
        else:
            self.logger.error(f'Unknown onSizeChange event id: {eventId}')

        dlg = MessageDialog(self, _("You must restart Pyut for size changes"),
                            _("Warning"), OK | ICON_EXCLAMATION)
        dlg.ShowModal()
        dlg.Destroy()
Esempio n. 14
0
    def __OnLanguageChange(self, event: CommandEvent):

        newLanguage: str = event.GetString()
        actualLanguage: str = self.__prefs[PyutPreferences.I18N]
        if actualLanguage not in Lang.LANGUAGES or newLanguage != Lang.LANGUAGES[
                actualLanguage][0]:
            # Search the key corresponding to the newLanguage
            for i in list(Lang.LANGUAGES.items()):
                if newLanguage == i[1][0]:
                    # Write the key in preferences file
                    self.__prefs[PyutPreferences.I18N] = i[0]

            dlg = MessageDialog(
                self, _("You must restart Pyut for language changes"),
                _("Warning"), OK | ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
Esempio n. 15
0
 def Open(self, e=None):
     if self.changed:
         dlg = MessageDialog(self,
                             "編集中の内容を保存して既存ファイルを開きますか?",
                             "確認",
                             style=OK | CANCEL)
         if dlg.ShowModal() == ID_OK:
             self.Save()
         dlg.Destroy()
     file = FileSelector("開くファイルを選択", expanduser('~'), "", "*.wnf")
     if not file:
         return
     self.File = file
     with open(self.File, encoding='utf-8') as f:
         self.editor.SetValue(f.read())
     self.SetTitle(f"{BASETITLE} - {basename(self.File)}")
     self.changed = False
Esempio n. 16
0
    def _on_commit_selected(self, e):
        c = e.commit

        dlg = MessageDialog(self,
            "Do you want to switch to that version?\n\n" +
            "SHA1: %s\n\n%s\n\n" % (c.backed.hexsha, c.label) +
            "Files in both save and backup directories will be overwritten!",
            "Confirmation is required",
            YES_NO
        )
        switch = dlg.ShowModal() == ID_YES
        dlg.Destroy()
        if not switch:
            return

        self.target = c.backed
        self.EndModal(ID_OK)
Esempio n. 17
0
    def newFatalError(self, msg, title=None, parent=None):

        from org.pyut.errorcontroller.ErrorManager import ErrorManager  # Avoid cyclical dependency

        if title is None:
            title = _("An error occurred...")

        errMsg: str = msg + "\n\n"
        errorInfo: str = ErrorManager.getErrorInfo()
        if errorInfo is not None:
            errMsg = f'{errMsg}{ErrorManager.getErrorInfo()}'
        try:
            dlg = MessageDialog(parent, errMsg, title,
                                OK | ICON_ERROR | CENTRE)
            dlg.ShowModal()
            dlg.Destroy()
        except (ValueError, Exception) as e:
            self.logger.error(f'newFatalError: {e}')
Esempio n. 18
0
    def onClose(self) -> bool:
        """
        Close all files

        Returns:
            True if everything is ok
        """
        # Display warning if we are in scripting mode
        if self._mediator.isInScriptMode():
            print("WARNING : in script mode, the non-saved projects are closed without warning")

        # Close projects and ask for unsaved but modified projects
        if not self._mediator.isInScriptMode():
            for project in self._projects:
                if project.getModified() is True:
                    frames = project.getFrames()
                    if len(frames) > 0:
                        frame = frames[0]
                        frame.SetFocus()
                        wxYield()
                        # if self._ctrl is not None:
                            # self._ctrl.registerUMLFrame(frame)
                        self.showFrame(frame)
                    dlg = MessageDialog(self.__parent,
                                        _("Your diagram has not been saved! Would you like to save it ?"),
                                        _("Save changes ?"), YES_NO | ICON_QUESTION)
                    if dlg.ShowModal() == ID_YES:
                        # save
                        if self.saveFile() is False:
                            return False
                    dlg.Destroy()

        # dereference all
        self.__parent = None
        self._mediator = None
        self.__splitter = None
        self.__projectTree = None
        self.__notebook.DeleteAllPages()
        self.__notebook = None
        self.__splitter = None
        self._projects = None
        self._currentProject = None
        self._currentFrame = None
Esempio n. 19
0
    def OnInit(self):
        """
        """
        provider: SimpleHelpProvider = SimpleHelpProvider()

        HelpProvider.Set(provider)
        try:
            # Create the SplashScreen
            if self._showSplash:

                bmp: Bitmap = splashImage.GetBitmap()
                self.splash = SplashScreen(bmp,
                                           SPLASH_CENTRE_ON_PARENT
                                           | SPLASH_TIMEOUT,
                                           PyutApp.SPLASH_TIMEOUT_MSECS,
                                           parent=None,
                                           pos=wxDefaultPosition,
                                           size=wxDefaultSize)

                self.logger.debug(f'Showing splash screen')
                self.splash.Show(True)
                wxYield()

            self._frame: AppFrame = AppFrame(cast(AppFrame, None), ID_ANY,
                                             "Pyut")
            self.SetTopWindow(self._frame)
            self._AfterSplash()

            return True
        except (ValueError, Exception) as e:
            self.logger.error(f'{e}')
            dlg = MessageDialog(
                None, _(f"The following error occurred: {exc_info()[1]}"),
                _("An error occurred..."), OK | ICON_ERROR)
            errMessage: str = ErrorManager.getErrorInfo()
            self.logger.debug(errMessage)
            dlg.ShowModal()
            dlg.Destroy()
            return False
Esempio n. 20
0
    def _AfterSplash(self):
        """
        AfterSplash : Occurs after the splash screen is launched; launch the application
        """
        try:
            # Handle application file names on the command line
            prefs: PyutPreferences = PyutPreferences()
            self._handleCommandLineFileNames(prefs)

            if self._frame is None:
                self.logger.error("Exiting due to previous errors")
                return False

            if self._showMainFrame is True:
                self._frame.Show(True)

            # Show full screen ?
            if prefs.fullScreen is True:
                dc = ScreenDC()
                self._frame.SetSize(dc.GetSize())
                self._frame.CentreOnScreen()

            return True

        except (ValueError, Exception) as e:
            dlg = MessageDialog(
                None, _(f"The following error occurred : {exc_info()[1]}"),
                _("An error occurred..."), OK | ICON_ERROR)
            self.logger.error(f'Exception: {e}')
            self.logger.error(f'Error: {exc_info()[0]}')
            self.logger.error('Msg: {exc_info()[1]}')
            self.logger.error('Trace:')
            for el in extract_tb(exc_info()[2]):
                self.logger.error(el)
            dlg.ShowModal()
            dlg.Destroy()
            return False
Esempio n. 21
0
    def _AfterSplash(self):
        """
        AfterSplash : Occurs after the splash screen is launched; launch the application
        """
        try:
            # Handle application parameters in the command line
            prefs: PyutPreferences = PyutPreferences()
            orgPath: str = prefs[PyutPreferences.ORG_DIRECTORY]
            for filename in [el for el in argv[1:] if el[0] != '-']:
                self._frame.loadByFilename(orgPath + osSeparator + filename)
            if self._frame is None:
                self.logger.error("Exiting due to previous errors")
                return False
            del orgPath
            if self._showMainFrame:
                self._frame.Show(True)

            # Show full screen ?
            if prefs.fullScreen is True:
                dc = ScreenDC()
                self._frame.SetSize(dc.GetSize())
                self._frame.CentreOnScreen()

            return True
        except (ValueError, Exception) as e:
            dlg = MessageDialog(
                None, _(f"The following error occurred : {exc_info()[1]}"),
                _("An error occurred..."), OK | ICON_ERROR)
            self.logger.error(f'Exception: {e}')
            self.logger.error(f'Error: {exc_info()[0]}')
            self.logger.error('Msg: {exc_info()[1]}')
            self.logger.error('Trace:')
            for el in extract_tb(exc_info()[2]):
                self.logger.error(el)
            dlg.ShowModal()
            dlg.Destroy()
            return False
Esempio n. 22
0
 def alert_message(title, message):
     from wx import MessageDialog, YES_DEFAULT, ICON_INFORMATION
     dlg = MessageDialog(None, message=message, caption=title, style=YES_DEFAULT | ICON_INFORMATION)
     dlg.ShowModal()
     dlg.Destroy()
Esempio n. 23
0
 def alert_error(title, message):
     from wx import MessageDialog, YES_DEFAULT, ICON_ERROR
     dlg = MessageDialog(None, message=message, caption=title, style=YES_DEFAULT | ICON_ERROR)
     dlg.ShowModal()
     dlg.Destroy()
Esempio n. 24
0
def OnNotification(self, event, text):
    dlg = MessageDialog(self, text, "Informacja od programu", OK)
    dlg.ShowModal()
    dlg.Destroy()
Esempio n. 25
0
    def runFile(self, event=None, fileName=None, focusOnExit='runner'):
        """Begin new process to run experiment.

        Parameters
        ----------
        event : wx.Event or None
            Parameter for event information if this function is bound as a
            callback. Set as `None` if calling directly.
        fileName : str
            Path to the file to run.
        focusOnExit : str
            Which output window to focus on when the application exits. Can be
            either 'coder' or 'runner'. Default is 'runner'.

        Returns
        -------
        bool
            True if the process has been started without error.

        """
        # full path to the script
        fullPath = fileName.replace('.psyexp', '_lastrun.py')

        if not os.path.isfile(fullPath):
            fileNotFoundDlg = MessageDialog(
                None,
                "Cannot run script '{}', file not found!".format(fullPath),
                caption="File Not Found Error",
                style=OK | ICON_ERROR)
            fileNotFoundDlg.ShowModal()
            fileNotFoundDlg.Destroy()

            if event is not None:
                event.Skip()

            return False

        # provide a message that the script is running
        # format the output message
        runMsg = u"## Running: {} ##".format(fullPath)
        runMsg = runMsg.center(80, "#") + "\n"

        # if we have a runner frame, write to the output text box
        if hasattr(self.app, 'runner'):
            stdOut = StdStreamDispatcher.getInstance()
            stdOut.lenLastRun = len(self.app.runner.stdOut.getText())
        else:
            # if not, just write to the standard output pipe
            stdOut = sys.stdout

        stdOut.write(runMsg)
        stdOut.flush()

        # interpreter path
        pyExec = sys.executable

        # optional flags for the subprocess
        execFlags = jobs.EXEC_ASYNC  # all use `EXEC_ASYNC`
        if sys.platform == 'win32':
            execFlags |= jobs.EXEC_HIDE_CONSOLE
        else:
            execFlags |= jobs.EXEC_MAKE_GROUP_LEADER

        # build the shell command to run the script
        # pyExec = '"' + pyExec + '"'  # use quotes to prevent issues with spaces
        # fullPath = '"' + fullPath + '"'
        command = [pyExec, '-u', fullPath]  # passed to the Job object

        # create a new job with the user script
        self.scriptProcess = jobs.Job(
            self,
            command=command,
            # flags=execFlags,
            inputCallback=self._onInputCallback,  # both treated the same
            errorCallback=self._onErrorCallback,
            terminateCallback=self._onTerminateCallback)

        BeginBusyCursor()  # visual feedback

        # start the subprocess
        workingDir, _ = os.path.split(fullPath)
        workingDir = os.path.abspath(workingDir)  # make absolute
        # move set CWD to Job.__init__ later
        pid = self.scriptProcess.start(cwd=workingDir)

        if pid < 1:  # error starting the process on zero or negative PID
            errMsg = (
                "Failed to run script '{}' in directory '{}'! Check whether "
                "the file or its directory exists and is accessible.".format(
                    fullPath, workingDir))
            fileNotFoundDlg = MessageDialog(None,
                                            errMsg,
                                            caption="Run Task Error",
                                            style=OK | ICON_ERROR)
            fileNotFoundDlg.ShowModal()
            fileNotFoundDlg.Destroy()

            # also log the error
            logging.error(errMsg)

            if event is not None:
                event.Skip()

            self.scriptProcess = None  # reset
            EndBusyCursor()
            return False

        self.focusOnExit = focusOnExit

        return True
Esempio n. 26
0
    def _on_monitor(self, _):
        root = self.saveDir.GetValue()
        backup = self.backupDir.GetValue()
        root2threads = self.master.root2threads

        # See: http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html
        if self.cbMonitor.IsChecked():
            self._disable_settings()

            if not root:
                dlg = MessageDialog(self.master, "Pleas select save directory",
                    "Error"
                )
                dlg.ShowModal()
                dlg.Destroy()
                self.cbMonitor.SetValue(False)
                self._enable_settings()
                return
            if not exists(root):
                dlg = MessageDialog(self.master,
                    "No such directory '%s'" % root,
                    "Error"
                )
                dlg.ShowModal()
                dlg.Destroy()
                self.cbMonitor.SetValue(False)
                self._enable_settings()
                return
            if not backup:
                dlg = MessageDialog(self.master,
                    "Pleas select backup directory",
                    "Error"
                )
                dlg.ShowModal()
                dlg.Destroy()
                self.cbMonitor.SetValue(False)
                self._enable_settings()
                return
            if root in root2threads:
                return # already monitored

            if not exists(backup):
                dlg = MessageDialog(self.master,
                    "Directory '%s' does not exist. Create?" % backup,
                    "Create backup directory",
                    YES_NO
                )
                res = dlg.ShowModal()
                dlg.Destroy()
                if not res:
                    self.cbMonitor.SetValue(False)
                    self._enable_settings()
                    return

                makedirs(backup)

            filterOutRe = None
            filterOut = self.filterOut.GetValue()
            if filterOut:
                try:
                    filterOutRe = compile(filterOut)
                except:
                    if filterOut:
                        dlg = MessageDialog(self.master,
                                "Incorrect filter expression"
                                " (use Python's re syntax)\n" + format_exc() +
                                "\nContinue without filter?",
                            "Filter Out Error",
                            YES_NO
                        )
                        res = dlg.ShowModal()
                        dlg.Destroy()
                        if res == ID_NO:
                            self.cbMonitor.SetValue(False)
                            self._enable_settings()
                            return

            mt = MonitorThread(root, lambda : root2threads.pop(root))
            bt = BackUpThread(root, backup, mt.changes, filterOutRe)
            root2threads[root] = (mt, bt)
            mt.start()
            bt.start()
        else:
            self._enable_settings()

            if root in root2threads:
                for t in root2threads[root]:
                    t.exit_request = True
Esempio n. 27
0
    def __potentiallyDisplayInfoMessage(self):

        if self._positioningPreferences.valuesChanged is True:
            dlg = MessageDialog(self, _("You must restart Pyut for position/size changes"), _("Warning"), OK | ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()