Exemplo n.º 1
0
    def __init__(self, root, text = "Options"):
        super().__init__(root, text = text)

        self.root = root
        if type(self.root) is Processor:
            self.fileStorage = self.root.root.fileStorage

        # variables
        self.processWhat = StringVar()
        self.removeReflectionsWhere = StringVar()
        self.saveTags = BooleanVar()
        self.saveComments = BooleanVar()
        self.showResults = BooleanVar()

        self.processWhat.set(optionGet("ProcessWhat", "all files", "str", True))
        self.removeReflectionsWhere.set(optionGet("RemoveReflectionsWhere", "no files",
                                                  "str", True))
        self.saveTags.set(optionGet("DefSaveTags", False, "bool", True))
        self.saveComments.set(optionGet("DefSaveComments", False, "bool", True))
        self.showResults.set(optionGet("DefShowResults", False, "bool", True))        

        # labels
        self.processLabel = ttk.Label(self, text = "Process")
        self.removeReflectionsLabel = ttk.Label(self, text = "Remove reflections in")
        self.saveTagsLabel = ttk.Label(self, text = "Save tags")
        self.saveCommentsLabel = ttk.Label(self, text = "Save comments")
        self.showResultsLabel = ttk.Label(self, text = "Show results after processing")

        self.processLabel.grid(column = 0, row = 0, sticky = E, padx = 3)
        self.removeReflectionsLabel.grid(column = 0, row = 1, sticky = E, padx = 3)
        self.saveTagsLabel.grid(column = 0, row = 2, sticky = E, padx = 3)
        self.saveCommentsLabel.grid(column = 0, row = 3, sticky = E, padx = 3)
        self.showResultsLabel.grid(column = 0, row = 5, sticky = E, padx = 3)

        # comboboxes
        self.processCombobox = ttk.Combobox(self, textvariable = self.processWhat,
                                            justify = "center", width = 15, state = "readonly")
        self.processCombobox["values"] = ("all files", "only tagged", "only untagged")

        self.removeReflectionsCombobox = ttk.Combobox(self, justify = "center", textvariable =
                                                      self.removeReflectionsWhere, width = 15,
                                                      state = "readonly")
        self.removeReflectionsCombobox["values"] = ("no files", "tagged files", "untagged files",
                                                    "all files")

        self.processCombobox.grid(column = 1, row = 0, sticky = W, padx = 2)
        self.removeReflectionsCombobox.grid(column = 1, row = 1, sticky = W, padx = 2)

        # checkbuttons
        self.saveTagsCheckbutton = ttk.Checkbutton(self, variable = self.saveTags, onvalue = True,
                                                   offvalue = False)
        self.saveTagsCheckbutton.grid(column = 1, row = 2)
        self.saveCommentsCheckbutton = ttk.Checkbutton(self, variable = self.saveComments,
                                                       onvalue = True, offvalue = False)
        self.saveCommentsCheckbutton.grid(column = 1, row = 3)
        self.showResultsCheckbutton = ttk.Checkbutton(self, onvalue = True, offvalue = False,
                                                      variable = self.showResults)
        self.showResultsCheckbutton.grid(column = 1, row = 5)
Exemplo n.º 2
0
 def saveAs(self):
     "asks user to select file where to save output"
     self.saveToVar.set(asksaveasfilename(initialdir = optionGet("ResultDirectory", os.getcwd(),
                                                                 "str"), defaultextension =
                                          optionGet("DefProcessOutputFileType", ".txt",
                                                    "str")[1:]))
     if self.parent == "processor":
         if self.root.root.fileStorage.arenafiles and self.saveToVar.get():
             self.root.process.state(["!disabled"])              
Exemplo n.º 3
0
 def saveAs(self):
     "asks user to select file where to save output"
     self.saveToVar.set(
         asksaveasfilename(initialdir=optionGet("ResultDirectory",
                                                os.getcwd(), "str"),
                           defaultextension=optionGet(
                               "DefProcessOutputFileType", ".txt",
                               "str")[1:]))
     if self.parent == "processor":
         if self.root.root.fileStorage.arenafiles and self.saveToVar.get():
             self.root.process.state(["!disabled"])
Exemplo n.º 4
0
 def closeFun(self):
     "ask for saving files on exit"
     if not optionGet("Developer", False, 'bool', True):
         if doesFileStorageRequiresSave(self, m.mode):
             self._askForSave(m.mode)
         for mode in m.fs:
             if mode != m.mode and doesFileStorageRequiresSave(self, mode):
                 self._askForSave(mode)
     path = optionGet("SelectedFilesDirectory",
                      os.path.join(os.getcwd(), "Stuff", "Selected files"), "str", True)
     saveFileStorage(self, m.mode, os.path.join(path, "~last.files"))
     self.destroy()
Exemplo n.º 5
0
 def closeFun(self):
     "ask for saving files on exit"
     if not optionGet("Developer", False, 'bool', True):
         if doesFileStorageRequiresSave(self, m.mode):
             self._askForSave(m.mode)
         for mode in m.fs:
             if mode != m.mode and doesFileStorageRequiresSave(self, mode):
                 self._askForSave(mode)
     path = optionGet("SelectedFilesDirectory",
                      os.path.join(os.getcwd(), "Stuff", "Selected files"),
                      "str", True)
     saveFileStorage(self, m.mode, os.path.join(path, "~last.files"))
     self.destroy()
Exemplo n.º 6
0
    def __init__(self, root, onChange = False, observe = True, loadtime = True):
        super().__init__(root)
        if m.mode not in TimeFrame.start:
            TimeFrame.start[m.mode] = optionGet("DefStartTime", 0, ['int', 'float'])
        if m.mode not in TimeFrame.stop:
            TimeFrame.stop[m.mode] = optionGet("DefStopTime", m.time[m.mode], ['int', 'float'])
        
        if observe:
            TimeFrame.instances[m.mode].append(self)
        self.observe = observe

        self.root = root
        self.onChange = onChange

        # variables
        self.timeVar = StringVar()
        self.startTimeVar = StringVar()

        if loadtime:
            self.startTimeVar.set(TimeFrame.start[m.mode])
            self.timeVar.set(TimeFrame.stop[m.mode])            
        else:
            self.startTimeVar.set(optionGet("DefStartTime", 0, ['int', 'float']))  
            self.timeVar.set(optionGet("DefStopTime", m.time[m.mode], ['int', 'float']))                  

        # labels
        self.startTimeLab = ttk.Label(self, text = "Start time:")
        self.timeLab = ttk.Label(self, text = "Stop time:")
        self.minutesLab = ttk.Label(self, text = "minutes")
        self.minutesLab2 = ttk.Label(self, text = "minutes")

        # entry validation
        vcmdTotal = (root.register(self.validateTotal), "%P")
        vcmdStart = (root.register(self.validateStart), "%P")

        # entries
        self.totalTime = ttk.Entry(self, textvariable = self.timeVar, width = 5, justify = "right",
                                   validate = "focusout", validatecommand = vcmdTotal)
        self.startTime = ttk.Entry(self, textvariable = self.startTimeVar, width = 5,
                                   justify = "right", validate = "focusout",
                                   validatecommand = vcmdStart)

        # adding to grid
        self.startTimeLab.grid(column = 0, row = 0, sticky = (N, S, E))
        self.timeLab.grid(column = 0, row = 1, sticky = (N, S, E))
        self.minutesLab.grid(column = 2, row = 0, sticky = (N, S, W))
        self.minutesLab2.grid(column = 2, row = 1, sticky = (N, S, W))

        self.totalTime.grid(column = 1, row = 1, sticky = (N, S, W), padx = 3, pady = 2)
        self.startTime.grid(column = 1, row = 0, sticky = (N, S, W), padx = 3, pady = 2)
Exemplo n.º 7
0
    def __init__(self, root, onChange=False, observe=True):
        super().__init__(root)

        if observe:
            TimeFrame.instances.append(self)
        self.observe = observe

        self.root = root
        self.onChange = onChange

        # variables
        self.timeVar = StringVar()
        self.startTimeVar = StringVar()

        self.timeVar.set(optionGet("DefStopTime", 20, ['int', 'float']))
        self.startTimeVar.set(optionGet("DefStartTime", 0, ['int', 'float']))

        # labels
        self.startTimeLab = ttk.Label(self, text="Start time:")
        self.timeLab = ttk.Label(self, text="Stop time:")
        self.minutesLab = ttk.Label(self, text="minutes")
        self.minutesLab2 = ttk.Label(self, text="minutes")

        # entry validation
        vcmdTotal = (root.register(self.validateTotal), "%P")
        vcmdStart = (root.register(self.validateStart), "%P")

        # entries
        self.totalTime = ttk.Entry(self,
                                   textvariable=self.timeVar,
                                   width=5,
                                   justify="right",
                                   validate="focusout",
                                   validatecommand=vcmdTotal)
        self.startTime = ttk.Entry(self,
                                   textvariable=self.startTimeVar,
                                   width=5,
                                   justify="right",
                                   validate="focusout",
                                   validatecommand=vcmdStart)

        # adding to grid
        self.startTimeLab.grid(column=0, row=0, sticky=(N, S, E))
        self.timeLab.grid(column=0, row=1, sticky=(N, S, E))
        self.minutesLab.grid(column=2, row=0, sticky=(N, S, W))
        self.minutesLab2.grid(column=2, row=1, sticky=(N, S, W))

        self.totalTime.grid(column=1, row=1, sticky=(N, S, W), padx=3, pady=2)
        self.startTime.grid(column=1, row=0, sticky=(N, S, W), padx=3, pady=2)
Exemplo n.º 8
0
def loadFileStorage(root, file=None):
    "loads pickled fileStorage"
    initialdir = optionGet(
        "SelectedFilesDirectory",
        os.path.join(os.getcwd(), "Stuff", "Selected files"), "str", True)
    if not file:
        file = askopenfilename(filetypes=[("Filestorage", "*.files")],
                               initialdir=initialdir)
    else:
        if not os.path.exists(file):
            return
    if file:
        with open(file, mode="rb") as infile:
            loaded = pickle.load(infile).__dict__
            current = root.selectFunction.fileStorage.__dict__
            if "mode" not in loaded or m.mode != loaded["mode"]:
                answ = messagebox.askyesno(
                    message=("Current mode does not correspond "
                             "with the loaded files.\n"
                             "Do you want to still load the files?"),
                    icon="question",
                    title="Proceed?")
                if not answ:
                    return
            for key in loaded:
                if key in current:
                    current[key] = loaded[key]
            current["lastSave"] = file
        root.checkProcessing()
Exemplo n.º 9
0
    def writeLog(self):
        "writes the log"
        filepath = optionGet("LogDirectory",
                             os.path.join(os.getcwd(), "Stuff", "Logs"), "str")
        writeTime = localtime()
        self.filename = os.path.join(
            filepath,
            strftime("%y_%m_%d_%H%M%S", writeTime) + ".txt")

        self.problem = False
        for method in self.methods:
            if self.methodProblems[method]:
                self.problem = True

        with open(self.filename, mode="w") as logfile:
            logfile.write("CM Manager version " + ".".join(version()) + "\n\n")
            logfile.write("Date: " + strftime("%d %b %Y", writeTime) + "\n")
            logfile.write("Time: " + strftime("%H:%M:%S", writeTime) +
                          "\n\n\n")
            self._writeProblems(logfile)
            self._writeMethods(logfile)
            self._writeTime(logfile)
            self._writeSaveIn(logfile)
            logfile.write("Reflections removed in:\n\t" +
                          self.removeReflections + "\n\n\n")
            self._writeFiles(logfile)
            self._writeAddedReflections(logfile)
Exemplo n.º 10
0
def writeResults(file, results):
    "writes 'results' in a 'file'"
    if not os.path.splitext(file)[1]:
        file = file + optionGet("DefProcessOutputFileType", ".txt", "str", True)
    if not os.path.dirname(file):
        file = os.path.join(optionGet("ResultDirectory", os.getcwd(), "str", True), file)
    if os.path.splitext(file)[1] == ".csv":
        results = [[item for item in line.split(",")] for line in results.split("\n")]
        with open(file, mode = "w", newline = "") as f:
            writer = csv.writer(f, dialect = "excel")
            writer.writerows(results)
            f.close()    
    else:
        outfile = open(file, "w")
        outfile.write(results)
        outfile.close()
Exemplo n.º 11
0
    def saveOneImage(self, cm, filename):
        "saves image for one file"
        directory = optionGet("ImageDirectory", os.getcwd(), "str")
        # pridat moznost scale u vsech SVG
        
        what =  self.saveWhatVar.get()    

        if what == "both frames":
            self.svg = SVG(600, 300)
            self.saveArenaFrame(cm)
            self.saveRoomFrame(cm, origin = (300, 0))
        elif what == "arena frame":
            self.svg = SVG(300, 300) 
            self.saveArenaFrame(cm)
        elif what == "room frame":
            self.svg = SVG(300, 300)
            self.saveRoomFrame(cm)
        elif what == "graph":
            self.svg = SVG(600, 120)
            self.saveGraph(cm)
        elif what == "all":
            self.svg = SVG(600, 420)
            self.saveArenaFrame(cm)
            self.saveRoomFrame(cm, origin = (300, 0))
            self.saveGraph(cm, origin = (0, 300))
            
        self.svg.save(os.path.join(directory, os.path.splitext(os.path.basename(filename))[0] +
                                   "_" + what.replace(" ", "_") + ".svg")) # upravit
Exemplo n.º 12
0
    def __init__(self, root, name, options, entryWidth = 10, rightLabWidth = 8):
        super().__init__(root, text = name)
        self.options = options
        
        for row, option in enumerate(options):
            if option[1][2] == 'bool':
                exec("self.{}Var = BooleanVar()".format(option[1][0]))
            else:
                exec("self.{}Var = StringVar()".format(option[1][0]))
            exec("self.{}Var.set({})".format(option[1][0], optionGet(*option[1])))
            exec("self.{}Lab = ttk.Label(self, text = '{}')".format(option[1][0],
                                                                              option[0]))
            exec("self.{}Lab.grid(column = 0, row = {}, pady = 2, sticky = E)".format(option[1][0],
                                                                                      row))
            if option[1][2] == 'bool':
                exec("""self.{}Checkbutton = ttk.Checkbutton(self, variable = self.{}Var,
                     onvalue = True, offvalue = False)""".format(option[1][0], option[1][0]))
                exec("self.{}Checkbutton.grid(column = 1, row = {}, padx = 2, pady = 2)".format(
                    option[1][0], row))
            else:
                exec("""self.{}Entry = ttk.Entry(self, textvariable = self.{}Var, width = {},
                     justify = 'right')""".format(option[1][0], option[1][0], entryWidth))
                exec("self.{}Entry.grid(column = 1, row = {}, padx = 2, pady = 2)".format(
                    option[1][0], row))
            exec("self.{}Sign = ttk.Label(self, text = '{}', width = {})".format(
                option[1][0], option[2], rightLabWidth))
            exec("self.{}Sign.grid(column = 2, row = {}, pady = 2, sticky = W)".format(
                option[1][0], row))

        self.columnconfigure(0, weight = 1)
Exemplo n.º 13
0
    def __init__(self):
        super().__init__()
   
        self.option_add("*tearOff", FALSE)
        self.resizable(FALSE, FALSE)
        self.initialized = False
        
        '''
        # used when size of the window is changed for placeWindow arguments     
        self.after(250, lambda: print(self.winfo_width()))
        self.after(250, lambda: print(self.winfo_height()))
        '''
        x, y = 1000, 770
        placeWindow(self, x, y)

        self.selectFunction = ttk.Notebook(self)
        self.selectFunction.grid()

        self["menu"] = MenuCM(self)

        self.protocol("WM_DELETE_WINDOW", self.closeFun)

        self.initialized = True
        path = optionGet("SelectedFilesDirectory",
                         os.path.join(os.getcwd(), "Stuff", "Selected files"), "str", True)
        loadFileStorage(self, os.path.join(path, "~last.files"))
        self.mainloop()
Exemplo n.º 14
0
    def __init__(self):
        super().__init__()

        self.option_add("*tearOff", FALSE)
        self.resizable(FALSE, FALSE)
        self.initialized = False
        '''
        # used when size of the window is changed for placeWindow arguments     
        self.after(250, lambda: print(self.winfo_width()))
        self.after(250, lambda: print(self.winfo_height()))
        '''
        x, y = 1000, 770
        placeWindow(self, x, y)

        self.selectFunction = ttk.Notebook(self)
        self.selectFunction.grid()

        self["menu"] = MenuCM(self)

        self.protocol("WM_DELETE_WINDOW", self.closeFun)

        self.initialized = True
        path = optionGet("SelectedFilesDirectory",
                         os.path.join(os.getcwd(), "Stuff", "Selected files"),
                         "str", True)
        loadFileStorage(self, os.path.join(path, "~last.files"))
        self.mainloop()
Exemplo n.º 15
0
 def _writeSaveIn(self, logfile):
     "writes information about file where the results were saved in a logfile"
     file = self.saveTo
     if not os.path.splitext(file)[1]:
         file += optionGet("DefProcessOutputFileType", ".txt", "str")
     logfile.write("Results saved in:\n\t" + os.path.abspath(file) +
                   "\n\n\n")
Exemplo n.º 16
0
    def __init__(self, root, name, options):
        super().__init__(root, text = name)
        
        self.options = options
        self.opts = []
        
        entryWidth = 10
        rightLabWidth = 8

        for row, option in enumerate(options):
            self.opts.append({})
            var = BooleanVar if option[1][2] == 'bool' else StringVar
            self.opts[row]["variable"] = var()
            current = optionGet(*option[1])
            if type(current) == str:
                current = "'" + current + "'"
            self.opts[row]["variable"].set(current)
            self.opts[row]["label"] = ttk.Label(self, text = option[0])
            self.opts[row]["label"].grid(column = 0, row = row, pady = 2, sticky = E)
            if option[1][2] == 'bool':
                self.opts[row]["input"] = ttk.Checkbutton(self, onvalue = True, offvalue = False,
                                                          variable = self.opts[row]["variable"])
            else:
                self.opts[row]["input"] = ttk.Entry(self, width = entryWidth, justify = 'right',
                                                    textvariable = self.opts[row]["variable"])
            self.opts[row]["input"].grid(column = 1, row = row, padx = 2, pady = 2)
            self.opts[row]["sign"] = ttk.Label(self, text = option[2], width = rightLabWidth)
            self.opts[row]["sign"].grid(column = 2, row = row, pady = 2, sticky = W)

        self.columnconfigure(0, weight = 1)
Exemplo n.º 17
0
    def saveFun(self):
        "writes results from controlReport to selected file"
        output = self.saveToFrame.saveToVar.get()
        if not self.controlReport.files:
            self.bell()
            self.status.set("No results prepared for saving.")
            return
        if not output:
            self.bell()
            self.status.set("You have to select a name of a file.")
            return

        separator = optionGet("ResultSeparator", ",", "str", True)
        results = separator.join(["File"] + self.controlReport.controls)
        for file in self.controlReport.files:
            filename = returnName(filename=file,
                                  allFiles=self.controlReport.files)
            result = [filename]
            for control in self.controlReport.controls:
                result += [
                    i[3] for i in self.controlReport.results[control]
                    if i[0] == file
                ]
            results += "\n" + separator.join(map(str, result))

        writeResults(output, results)
        self.status.set("Results were saved.")
Exemplo n.º 18
0
 def checkNewPost(self):
     "checks whether there is some post with new information on the web"
     currentPost = optionGet("WebPostNumber", 0, "int")
     webPostNumber = int(self.returnSiteContent("http://www.cmmanagerweb.appspot.com/post"))
     if  webPostNumber > currentPost:
         DialogBox(self, "New information", self.returnSiteContent(
             "http://www.cmmanagerweb.appspot.com/post/message"))
         optionWrite("WebPostNumber", webPostNumber)
Exemplo n.º 19
0
    def __init__(self, root):
        super().__init__(root)

        self["padding"] = (10, 10, 12, 12)
        self.root = root
        self.fileStorage = self.root.fileStorage
        self.selectedBatchTime = optionGet("LastBatchTime", [(0, 20)], "list") # zkontrolovat ""

        # variables    
        self.status = StringVar()
        self.useBatchTimeVar = BooleanVar()
              
        # frames
        self.parametersF = ParameterFrame(self)
        self.fileStorageFrame= FileStorageFrame(self)
        self.saveToFrame = SaveToFrame(self, parent = "processor")
        self.optionFrame = OptionFrame(self, text = "Options")
        self.timeLabFrame = ttk.Labelframe(self, text = "Time")
        self.timeLabFrame.root = self
        self.timeFrame = TimeFrame(self.timeLabFrame)
        
        # buttons
        self.process = ttk.Button(self, text = "Process Files", command = self.processFun,
                                  state = "disabled")
        self.useBatchTime = ttk.Checkbutton(self.timeLabFrame, text = "Use batch time",
                                            variable = self.useBatchTimeVar,
                                            command = self.toggledUseBatchTime)
        self.setBatchTimeBut = ttk.Button(self.timeLabFrame, text = "Set", width = 3,
                                          command = self.setBatchTime)

        # labels
        self.statusBar = ttk.Label(self, textvariable = self.status)
        self.modeLab = ttk.Label(self, text = m.fullname[m.mode], font = ("Helvetica", "16"))
       
        # adding to grid
        self.parametersF.grid(column = 0, row = 3, columnspan = 4, sticky = (N, W), padx = 4)
        self.fileStorageFrame.grid(column = 3, row = 0, pady = 5, padx = 4)
        self.timeLabFrame.grid(column = 1, row = 5, padx = 30, sticky = (N, W))
        self.timeFrame.grid(column = 0, row = 0, columnspan = 2, sticky = (E, W))
        
        self.process.grid(column = 3, row = 7, sticky = (S, E), padx = 4, pady = 3)
        self.useBatchTime.grid(column = 0, row = 1, pady = 5)
        self.setBatchTimeBut.grid(column = 1, row = 1, pady = 5)

        self.statusBar.grid(column = 0, row = 7, columnspan = 3, sticky = (N, S, E, W), padx = 6,
                            pady = 3)
        self.modeLab.grid(column = 0, row = 0)
       
        self.saveToFrame.grid(column = 1, row = 1, columnspan = 3, sticky = (N, S, E, W),
                              padx = 6, pady = 2)

        self.optionFrame.grid(column = 0, row = 5, sticky = (N, E), padx = 6)
  
        # what should be enlarged
        self.columnconfigure(2, weight = 1)
        self.rowconfigure(2, weight = 3)
        self.rowconfigure(4, weight = 2)
        self.rowconfigure(6, weight = 2)
Exemplo n.º 20
0
def getDirectory():
    "recognizes all .dat files in a directory and calls recognizeFiles function"
    cmfiles = []
    for directory in os.walk(askdirectory(initialdir = optionGet("FileDirectory", os.getcwd(),
                                                                 "str"))):
        for file in directory[2]:
            if os.path.splitext(file)[1] == ".dat":
                cmfiles.append(os.path.join(directory[0], file))
    return recognizeFiles(cmfiles)
Exemplo n.º 21
0
 def chooseCommentColor(self):
     "opens dialog for choosing color of comments and immediately saves the selected color"
     color = colorchooser.askcolor(initialcolor = optionGet("CommentColor", "grey90",
                                                            'str', True), parent = self)
     if color and len(color) > 1 and color[1]:
         selected = color[1]
         optionWrite("CommentColor", "'" +  selected + "'", True)
         self.root.explorer.fileFrame.tree.tag_configure("comment", background = selected)
         self.root.controller.contentTree.tag_configure("comment", background = selected)
Exemplo n.º 22
0
def loadFileStorage(root):
    "loads pickled fileStorage"
    initialdir = optionGet("SelectedFilesDirectory", os.path.join(os.getcwd(), "Stuff",
                                                                  "Selected files"), "str")
    file = askopenfilename(filetypes = [("Filestorage", "*.files")], initialdir = initialdir)
    if file:
        with open(file, mode = "rb") as infile:
            root.selectFunction.fileStorage.__dict__ = pickle.load(infile).__dict__
        root.checkProcessing(None)
Exemplo n.º 23
0
def checkNewVersion(version):
    "checks whether there is a new version available"
    newVersion = returnSiteContent(
        "http://www.cmmanagerweb.appspot.com/version").split(".")
    try:
        from optionget import optionGet
        from version import version as currentVersion
        versionSeen = optionGet("DontShowVersion", currentVersion(), "list",
                                True)
    except Exception:
        versionSeen = version
    for i in range(3):
        if int(newVersion[i]) > int(versionSeen[i]):
            code = returnSiteContent(
                "http://www.cmmanagerweb.appspot.com/code")
            curl = "https://raw.github.com/bahniks/CM_Manager_{}_{}_{}/master/Stuff/code.txt"
            curl = urlopen(curl.format(*newVersion))
            ghcode = curl.read().strip()
            if int(code) != int(ghcode):
                return
            message = "New version of Carousel Maze Manager ({}.{}.{}) is available.\n".format(
                *newVersion
            ) + "Do you want to download and install the new version?"
            root = makeRoot()
            answ = messagebox.askyesnocancel(
                message=message,
                icon="question",
                title="New version available",
                default="yes",
                detail="Select 'No' to not be asked again.")
            if answ is None:
                pass
            elif answ:
                root.config(cursor="wait")
                try:
                    download(newVersion)
                    if "version" in sys.modules:
                        imp.reload(sys.modules["version"])
                except Exception as e:
                    messagebox.showinfo(
                        title="Error",
                        icon="error",
                        detail=e,
                        message="Some problem with updating occured.")
                finally:
                    root.config(cursor="")
            else:
                try:
                    print(newVersion)
                    from optionwrite import optionWrite
                    optionWrite("DontShowVersion", newVersion, True)
                except Exception:
                    pass
            root.destroy()
            break
        elif int(newVersion[i]) < int(versionSeen[i]):
            break
Exemplo n.º 24
0
    def __init__(self, root, text = "Parameters"):
        super().__init__(root, text = text)

        basic = ttk.Labelframe(self, text = "Basic")
        advanced = ttk.Labelframe(self, text = "Advanced")
        double = ttk.Labelframe(self, text = "Double Avoidance")
        info = ttk.Labelframe(self, text = "Information")
        experimental = ttk.Labelframe(self, text = "Experimental")
        custom = ttk.Labelframe(self, text = "Custom Written")
        basic.grid(column = 0, row = 0, sticky = (N, S, W), padx = 3, pady = 4)
        advanced.grid(column = 1, row = 0, sticky = (N, S, W), padx = 3, pady = 4)
        double.grid(column = 2, row = 0, sticky = (N, S, W), padx = 3, pady = 4)
        info.grid(column = 3, row = 0, sticky = (N, S, W), padx = 3, pady = 4)
        experimental.grid(column = 4, row = 0, sticky = (N, S, W), padx = 3, pady = 4)
        custom.grid(column = 5, row = 0, sticky = (N, S, W), padx = 3, pady = 4)

        basicNum = 0
        advancedNum = 0
        doubleNum = 0
        infoNum = 0
        experimentalNum = 0
        customNum = 0
        for name, parameter in m.parameters.items():
            if parameter.group == "basic":
                 rowNum = basicNum
                 basicNum += 1
            elif parameter.group == "advanced":
                 rowNum = advancedNum
                 advancedNum += 1
            elif parameter.group == "double":
                 rowNum = doubleNum
                 doubleNum += 1
            elif parameter.group == "info":
                 rowNum = infoNum
                 infoNum += 1
            elif parameter.group == "experimental":
                 rowNum = experimentalNum
                 experimentalNum += 1                       
            elif parameter.group == "custom":
                 rowNum = customNum
                 customNum += 1
            label = name.replace(" ", "")
            exec("self.%s = BooleanVar()" % (label + "Var"))
            exec("self.%sVar.set(%s)" % (label, optionGet("Def" + label, False, 'bool')))
            exec("""self.%sBut = ttk.Checkbutton(%s, text = '%s', variable = self.%sVar,
                 onvalue = True)""" % (label, parameter.group, name, label))
            exec("self.%sBut.grid(column = 0, row = %i, sticky = (S, W), padx = 1, pady = 2)" %\
                 (label, rowNum))

        self.bind("<Button-3>", lambda e: self.popUp(e, "all"))
        basic.bind("<Button-3>", lambda e: self.popUp(e, "basic"))
        advanced.bind("<Button-3>", lambda e: self.popUp(e, "advanced"))
        double.bind("<Button-3>", lambda e: self.popUp(e, "double"))
        info.bind("<Button-3>", lambda e: self.popUp(e, "info"))
        experimental.bind("<Button-3>", lambda e: self.popUp(e, "experimental"))
        custom.bind("<Button-3>", lambda e: self.popUp(e, "custom"))
Exemplo n.º 25
0
def returnName(filename, allFiles):
    "depending on option 'SaveFullPath' returns full name of basename"
    selected = optionGet("SaveFullPath", "Basename", "str")
    if selected == "Unique path":
        sharedName = os.path.split(os.path.commonprefix(allFiles))[0]
        return filename[len(sharedName):].lstrip("/\\")
    elif selected == "Full path":
        return filename
    else:
        return basename(filename)
Exemplo n.º 26
0
def returnName(filename, allFiles):
    "depending on option 'SaveFullPath' returns full name of basename"
    selected = optionGet("SaveFullPath", "Basename", "str")
    if selected == "Unique path":
        sharedName = os.path.split(os.path.commonprefix(allFiles))[0]
        return filename[len(sharedName):].lstrip("/\\")
    elif selected == "Full path":
        return filename
    else:
        return basename(filename)
Exemplo n.º 27
0
def getDirectory():
    "recognizes all .dat files in a directory and calls recognizeFiles function"
    cmfiles = []
    for directory in os.walk(
            askdirectory(
                initialdir=optionGet("FileDirectory", os.getcwd(), "str"))):
        for file in directory[2]:
            if os.path.splitext(file)[1] == ".dat":
                cmfiles.append(os.path.join(directory[0], file))
    return recognizeFiles(cmfiles)
Exemplo n.º 28
0
def saveFileStorage(root):
    "saves picled fileStorage"
    initialdir = optionGet("SelectedFilesDirectory", os.path.join(os.getcwd(), "Stuff",
                                                                  "Selected files"), "str")
    file = asksaveasfilename(filetypes = [("Filestorage", "*.files")], initialdir = initialdir)
    if file:
        if os.path.splitext(file)[1] != ".files":
            file = file + ".files"
        with open(file, mode = "wb") as infile:
            pickle.dump(root.selectFunction.fileStorage, infile)
Exemplo n.º 29
0
 def __init__(self, root, text, optionName, default, options):
     super().__init__(root, text = text)
     self.optionName = optionName
     self.variable = StringVar()
     self.variable.set(optionGet(optionName, default, "str"))
     for count, option in enumerate(options):
         exec("self.{}RB = ttk.Radiobutton(self, text = '{}', variable = self.variable, \
              value = '{}')".format(option.replace(" ", "_"), option, option))
         exec("self.{}RB.grid(row = count, column = 0, padx = 2, pady = 2, sticky = W)".format(
              option.replace(" ", "_")))
Exemplo n.º 30
0
 def __init__(self, root, text, optionName, default, options):
     super().__init__(root, text = text)
     self.optionName = optionName
     self.variable = StringVar()
     self.variable.set(optionGet(optionName, default, "str"))
     for count, option in enumerate(options):
         exec("self.{}RB = ttk.Radiobutton(self, text = '{}', variable = self.variable, \
              value = '{}')".format(option.replace(" ", "_"), option, option))
         exec("self.{}RB.grid(row = count, column = 0, padx = 2, pady = 2, sticky = W)".format(
              option.replace(" ", "_")))
Exemplo n.º 31
0
 def checkNewPost(self):
     "checks whether there is some post with new information on the web"
     currentPost = optionGet("WebPostNumber", 0, "int")
     webPostNumber = int(
         self.returnSiteContent("http://www.cmmanagerweb.appspot.com/post"))
     if webPostNumber > currentPost:
         DialogBox(
             self, "New information",
             self.returnSiteContent(
                 "http://www.cmmanagerweb.appspot.com/post/message"))
         optionWrite("WebPostNumber", webPostNumber)
Exemplo n.º 32
0
 def checkNewVersion(self):
     "checks whether there is a new version available"
     newVersion = self.returnSiteContent("http://www.cmmanagerweb.appspot.com/version").\
                  split(".")
     versionSeen = optionGet("DontShowVersion", version(), "list")
     for i in range(3):
         if int(newVersion[i]) > int(versionSeen[i]):
             DialogBox(self, title = "New version available", message =
                       self.returnSiteContent(
                                     "http://www.cmmanagerweb.appspot.com/version/message"),
                       dontShowOption = "DontShowVersion", optionValue = newVersion)
             break            
Exemplo n.º 33
0
def saveFileStorage(root):
    "saves picled fileStorage"
    initialdir = optionGet(
        "SelectedFilesDirectory",
        os.path.join(os.getcwd(), "Stuff", "Selected files"), "str")
    file = asksaveasfilename(filetypes=[("Filestorage", "*.files")],
                             initialdir=initialdir)
    if file:
        if os.path.splitext(file)[1] != ".files":
            file = file + ".files"
        with open(file, mode="wb") as infile:
            pickle.dump(root.selectFunction.fileStorage, infile)
Exemplo n.º 34
0
def loadFileStorage(root):
    "loads pickled fileStorage"
    initialdir = optionGet(
        "SelectedFilesDirectory",
        os.path.join(os.getcwd(), "Stuff", "Selected files"), "str")
    file = askopenfilename(filetypes=[("Filestorage", "*.files")],
                           initialdir=initialdir)
    if file:
        with open(file, mode="rb") as infile:
            root.selectFunction.fileStorage.__dict__ = pickle.load(
                infile).__dict__
        root.checkProcessing(None)
Exemplo n.º 35
0
 def _writeMethods(self, logfile):
     "writes information about used methods in a logfile"
     logfile.write("Methods used:")
     if self.methods:
         for method in self.methods:
             logfile.write("\n\t" + method)
             if m.parameters[method].options:
                 for option in m.parameters[method].options.values():
                     logfile.write("\n\t\t" + option[1] + ": " + str(optionGet(*option[0])))
     else:
         logfile.write("\n\tNone")
     logfile.write("\n\n\n")
Exemplo n.º 36
0
    def __init__(self, root):
        super().__init__(root)
        self.root = root
        placeWindow(self, 598, 208)
        self.title("Images options")
        self.grab_set()
        self.focus_set()     
        self.resizable(False, False)

        self.oFrame = ttk.Frame(self)
        self.oFrame.grid(column = 0, columnspan = 3, row = 0)

        options = (("Scale", ("LastImageScale", 1, ["int", "float"])),
                   ("Main title ('default' for filename)", ("LastImageMain", "default", "str")),
                   ("Horizontal gap", ("LastImageXgap", 10, ["int", "float"])),
                   ("Vertical gap", ("LastImageYgap", 10, ["int", "float"])),
                   ("x-axis title", ("LastImageXlab", "Time", "str")),
                   ("y-axis title (smart 'default')", ("LastImageYlab", "default", "str")),
                   ("x-axis ticks", ("LastImageXticks", True, "bool")),
                   ("y-axis ticks", ("LastImageYticks", True, "bool")))
        self.options = options

        self.opts = []
        entryWidth = 10

        for row, option in enumerate(options):
            self.opts.append({})
            var = BooleanVar if option[1][2] == 'bool' else StringVar
            self.opts[row]["variable"] = var()
            current = optionGet(*option[1])
            if type(current) == str:
                current = "'" + current + "'"
            self.opts[row]["variable"].set(current)
            self.opts[row]["label"] = ttk.Label(self.oFrame, text = option[0])
            self.opts[row]["label"].grid(column = 0, row = row, pady = 2, sticky = E)
            if option[1][2] == 'bool':
                self.opts[row]["input"] = ttk.Checkbutton(self.oFrame, onvalue = True,
                                                          offvalue = False,
                                                          variable = self.opts[row]["variable"])
            else:
                self.opts[row]["input"] = ttk.Entry(self.oFrame, width = entryWidth,
                                                    justify = 'right',
                                                    textvariable = self.opts[row]["variable"])
            self.opts[row]["input"].grid(column = 1, row = row, padx = 2, pady = 2)
            
        self.okBut = ttk.Button(self, text = "Ok", command = self.okFun)
        self.okBut.grid(column = 2, row = 1, padx = 3, pady = 4)
        self.cancelBut = ttk.Button(self, text = "Cancel", command = self.cancelFun)    
        self.cancelBut.grid(column = 1, row = 1, padx = 3, pady = 4)
        self.resetBut = ttk.Button(self, text = "Reset", command = self.resetFun)
        self.resetBut.grid(column = 0, row = 1, padx = 3, pady = 4)
Exemplo n.º 37
0
    def __init__(self, root, onChange = False):
        super().__init__(root)

        self.root = root
        self.onChange = onChange

        # variables
        self.timeVar = StringVar()
        self.startTimeVar = StringVar()

        self.timeVar.set(optionGet("DefStopTime", 20, ['int', 'float']))
        self.startTimeVar.set(optionGet("DefStartTime", 0, ['int', 'float']))        

        # labels
        self.startTimeLab = ttk.Label(self, text = "Start time:")
        self.timeLab = ttk.Label(self, text = "Stop time:")
        self.minutesLab = ttk.Label(self, text = "minutes")
        self.minutesLab2 = ttk.Label(self, text = "minutes")

        # entry validation
        vcmdTotal = (root.register(self.validateTotal), "%P")
        vcmdStart = (root.register(self.validateStart), "%P")

        # entries
        self.totalTime = ttk.Entry(self, textvariable = self.timeVar, width = 5, justify = "right",
                                   validate = "focusout", validatecommand = vcmdTotal)
        self.startTime = ttk.Entry(self, textvariable = self.startTimeVar, width = 5,
                                   justify = "right", validate = "focusout",
                                   validatecommand = vcmdStart)

        # adding to grid
        self.startTimeLab.grid(column = 0, row = 0, sticky = (N, S, E))
        self.timeLab.grid(column = 0, row = 1, sticky = (N, S, E))
        self.minutesLab.grid(column = 2, row = 0, sticky = (N, S, W))
        self.minutesLab2.grid(column = 2, row = 1, sticky = (N, S, W))

        self.totalTime.grid(column = 1, row = 1, sticky = (N, S, W), padx = 3, pady = 2)
        self.startTime.grid(column = 1, row = 0, sticky = (N, S, W), padx = 3, pady = 2)
Exemplo n.º 38
0
def main():
    if optionGet("Developer", False, 'bool'):
        GUI()
    else:
        try:
            filepath = os.path.join(os.getcwd(), "Stuff", "Bugs")
            writeTime = localtime()
            filename = os.path.join(filepath, strftime("%y_%m_%d_%H%M%S", writeTime) +
                                    "_bugs" + ".txt")
            with open(filename, mode = "w") as bugfile:
                sys.stderr = bugfile
                GUI()
        finally:
            bugfile.close()
Exemplo n.º 39
0
 def getDirectory(self):
     "recognizes all .dat files in a directory and calls recognizeFiles function"
     cmfiles = []
     if FileStorageFrame.lastOpenedDirectory:
         initial = FileStorageFrame.lastOpenedDirectory
     else:
         initial = optionGet("FileDirectory", os.getcwd(), "str")
     selected = askdirectory(initialdir=initial)
     FileStorageFrame.lastOpenedDirectory = selected
     for directory in os.walk(selected):
         for file in directory[2]:
             if os.path.splitext(file)[1] == ".dat":
                 cmfiles.append(os.path.join(directory[0], file))
     return recognizeFiles(cmfiles)
Exemplo n.º 40
0
def saveFileStorage(root, mode, file=None):
    "saves pickled fileStorage"
    initialdir = optionGet(
        "SelectedFilesDirectory",
        os.path.join(os.getcwd(), "Stuff", "Selected files"), "str", True)
    if not file:
        file = asksaveasfilename(filetypes=[("Filestorage", "*.files")],
                                 initialdir=initialdir)
    if file:
        if os.path.splitext(file)[1] != ".files":
            file = file + ".files"
        with open(file, mode="wb") as infile:
            m.fs[mode].lastSave = file
            pickle.dump(m.fs[mode], infile)
Exemplo n.º 41
0
 def validateTotal(self, newValue):
     "validation of total time - checks if new entry is digits only"
     if not self._isfloat(newValue) or eval(newValue) <= eval(self.startTimeVar.get()):
         t = max([optionGet("DefStopTime", m.time[m.mode], ['int', 'float']),
                  eval(self.startTimeVar.get()) + 1])
         self.timeVar.set(str(t))
         self.bell()
     elif self.onChange:
             self.root.root.setTime()
     if self.observe:
         for tf in TimeFrame.instances[m.mode]:
             tf.timeVar.set(self.timeVar.get())
         TimeFrame.stop[m.mode] = self.timeVar.get()
     return True
Exemplo n.º 42
0
 def findParameters(self):
     "finds custom written parameters"
     for file in os.listdir(os.path.join(os.getcwd(), "Stuff", "Parameters")):
         splitted = os.path.splitext(file)
         omit = ["__init__", "template"]
         if len(splitted) > 1 and splitted[1] == ".py" and splitted[0] not in omit:
             exec("from Stuff.Parameters import {}".format(splitted[0]))
             option = "DefParCustom{}".format(
                 eval("{}.name".format(splitted[0])).strip().replace(" ", ""))
             newParameter = [eval("{}.name".format(splitted[0])),
                             "{}.parameter(cm, time = time, startTime = startTime)".format(
                                 splitted[0]), "custom", optionGet(option, False, "bool"),
                             option, splitted[0]]
             self.parameters.append(newParameter)                                         
Exemplo n.º 43
0
def getFiles():
    """asks to select files and returns list of files that doesn't contain 'arena' or 'room'
    in their names and another list of files containing 'arena' in their name"""
    filenames = str(askopenfilenames(initialdir = optionGet("FileDirectory", os.getcwd(), "str"),
                                     filetypes = [("Data files", "*.dat")]))
    if filenames == "":
        return [], []
    if "}" in filenames and "{" in filenames:
        filenames = filenames[1:-1].split("} {")
    else:
        filenames = [x + ".dat" for x in filenames.split(".dat ")]
        if filenames[-1].endswith(".dat.dat"):
            filenames[-1] = filenames[-1][:-4]
    return recognizeFiles(filenames)
Exemplo n.º 44
0
 def findParameters(self):
     "finds custom written parameters"
     for file in os.listdir(os.path.join(os.getcwd(), "Stuff", "Parameters")):
         splitted = os.path.splitext(file)
         omit = ["__init__", "template"]
         if len(splitted) > 1 and splitted[1] == ".py" and splitted[0] not in omit:
             exec("from Stuff.Parameters import {}".format(splitted[0]))
             option = "DefParCustom{}".format(
                 eval("{}.name".format(splitted[0])).strip().replace(" ", ""))
             newParameter = [eval("{}.name".format(splitted[0])),
                             "{}.parameter(cm, time = time, startTime = startTime)".format(
                                 splitted[0]), "custom", optionGet(option, False, "bool"),
                             option, splitted[0]]
             self.parameters.append(newParameter)                                         
Exemplo n.º 45
0
 def checkNewVersion(self):
     "checks whether there is a new version available"
     newVersion = self.returnSiteContent("http://www.cmmanagerweb.appspot.com/version").\
                  split(".")
     versionSeen = optionGet("DontShowVersion", version(), "list")
     for i in range(3):
         if int(newVersion[i]) > int(versionSeen[i]):
             DialogBox(
                 self,
                 title="New version available",
                 message=self.returnSiteContent(
                     "http://www.cmmanagerweb.appspot.com/version/message"),
                 dontShowOption="DontShowVersion",
                 optionValue=newVersion)
             break
Exemplo n.º 46
0
def main():
    if optionGet("Developer", False, 'bool', True):
        GUI()
    else:
        for directory in ["Bugs", "Logs", "Selected files"]:
            dirname = os.path.join(os.getcwd(), "Stuff", directory)
            if not os.path.exists(dirname):
                os.mkdir(dirname)
        filepath = os.path.join(os.getcwd(), "Stuff", "Bugs")
        writeTime = localtime()
        filename = os.path.join(filepath, strftime("%y_%m_%d_%H%M%S", writeTime) +
                                "_bugs" + ".txt")
        with open(filename, mode = "w") as bugfile:
            sys.stderr = bugfile
            GUI()
Exemplo n.º 47
0
def main():
    if optionGet("Developer", False, 'bool'):
        GUI()
    else:
        try:
            filepath = os.path.join(os.getcwd(), "Stuff", "Bugs")
            writeTime = localtime()
            filename = os.path.join(
                filepath,
                strftime("%y_%m_%d_%H%M%S", writeTime) + "_bugs" + ".txt")
            with open(filename, mode="w") as bugfile:
                sys.stderr = bugfile
                GUI()
        finally:
            bugfile.close()
Exemplo n.º 48
0
    def __init__(self, root, text, optionName, default):
        super().__init__(root, text = text)
        
        self.root = root
        self.currentDir = optionGet(optionName, default, "str")

        self.directory = StringVar()
        self.directory.set(self.currentDir)

        self.button = ttk.Button(self, text = "Choose", command = self.chooseFun)
        self.button.grid(column = 1, row = 0, padx = 3, pady = 1)

        self.entry = ttk.Entry(self, textvariable = self.directory, width = 70)
        self.entry.grid(column = 0, row = 0, padx = 3, pady = 1, sticky = (E, W))

        self.columnconfigure(0, weight = 1)
Exemplo n.º 49
0
def getFiles():
    """asks to select files and returns list of files that doesn't contain 'arena' or 'room'
    in their names and another list of files containing 'arena' in their name"""
    filenames = str(
        askopenfilenames(initialdir=optionGet("FileDirectory", os.getcwd(),
                                              "str"),
                         filetypes=[("Data files", "*.dat")]))
    if filenames == "":
        return [], []
    if "}" in filenames and "{" in filenames:
        filenames = filenames[1:-1].split("} {")
    else:
        filenames = [x + ".dat" for x in filenames.split(".dat ")]
        if filenames[-1].endswith(".dat.dat"):
            filenames[-1] = filenames[-1][:-4]
    return recognizeFiles(filenames)
Exemplo n.º 50
0
    def __init__(self, cm, components, root):
        self.start = int(root.timeFrame.startTimeVar.get())
        self.end = int(root.timeFrame.timeVar.get())
        self.parameter = root.graphParameter.get()
        if self.parameter == "nothing":
            self.parameter = ""

        self.cm = cm
        self.components = components
        self.scale = optionGet("LastImageScale", 1, ["int", "float"])
        self.main = optionGet("LastImageMain", "default", "str")
        self.xgap = optionGet("LastImageXgap", 10, ["int", "float"])
        self.ygap = optionGet("LastImageYgap", 10, ["int", "float"])
        self.xlab = optionGet("LastImageXlab", "Time", "str")
        self.ylab = optionGet("LastImageYlab", "default", "str")
        self.xticks = optionGet("LastImageXticks", True, "bool")
        self.yticks = optionGet("LastImageYticks", True, "bool")

        self.addComponents()
        self.computeSize()
        self.addIntro()

        graphWidth = self.x[5] - self.x[2]
        self.graph = eval(root.graphTypeVar.get()[:-5] +
                          'root, cm, purpose = "svg", width = graphWidth)')

        for component in self.components:           
            if component in ["xgap", "ygap"]:
                continue
            elif component == "main":
                self.addMain()
            elif component == "arena":
                self.addArena()
            elif component == "room":
                self.addRoom()
            elif component == "graph":
                self.addGraph()
            elif component == "xticks" and "graph" in self.components:
                self.addXticks()
            elif component == "yticks" and "graph" in self.components:
                self.addYticks()
            elif component == "xlab" and "graph" in self.components:
                self.addXlab()
            elif component == "ylab" and "graph" in self.components:
                self.addYlab()
Exemplo n.º 51
0
def main():
    if optionGet("Developer", False, 'bool', True):
        GUI()
    else:
        for directory in ["Bugs", "Logs", "Selected files"]:
            dirname = os.path.join(os.getcwd(), "Stuff", directory)
            if not os.path.exists(dirname):
                os.mkdir(dirname)
        filepath = os.path.join(os.getcwd(), "Stuff", "Bugs")
        writeTime = localtime()
        filename = os.path.join(
            filepath,
            strftime("%y_%m_%d_%H%M%S", writeTime) + "_bugs" + ".txt")
        with open(filename, mode="w") as bugfile:
            sys.stderr = bugfile
            GUI()
Exemplo n.º 52
0
    def __init__(self, root):
        super().__init__(root)
        self.root = root
        self.task = StringVar()
        self.task.set(optionGet("DefaultTask", "CM", 'str', general = True))
        self.changedTask()

        self.menu_file = Menu(self)
        self.menu_options = Menu(self)
        self.menu_tools = Menu(self)
        self.menu_show = Menu(self)
        self.menu_task = Menu(self)
        self.menu_help = Menu(self)
        
        menuWidth = 8
        self.add_cascade(menu = self.menu_file, label = "{:^{}}".format("File", menuWidth))
        self.add_cascade(menu = self.menu_options, label = "{:^{}}".format("Options", menuWidth))
        self.add_cascade(menu = self.menu_tools, label = "{:^{}}".format("Tools", menuWidth))
        self.add_cascade(menu = self.menu_show, label = "{:^{}}".format("Show", menuWidth))
        self.add_cascade(menu = self.menu_task, label = "{:^{}}".format("Task", menuWidth))
        self.add_cascade(menu = self.menu_help, label = "{:^{}}".format("Help", menuWidth))

        self.menu_file.add_command(label = "Load selected files", command = self.loadSavedFiles)
        self.menu_file.add_command(label = "Save selected files", command = self.saveLoadedFiles)
        self.menu_file.add_separator()
        self.menu_file.add_command(label = "Exit", command = self.exitCM)
        self.menu_options.add_command(label = m.fullname[m.mode] + " options",
                                      command = self.options)
        self.menu_options.add_command(label = "Parameter settings (" + m.fullname[m.mode] + ")",
                                      command = self.advOptions)
        self.menu_options.add_separator()
        self.menu_options.add_command(label = "General options", command = self.generalOptions)
        self.menu_options.add_separator()
        self.menu_options.add_command(label = "Reset all options", command = self.resetOptions)
        self.menu_tools.add_command(label = "Add tags", command = self.addTagsHelper)
        self.menu_show.add_command(label = "Show files", command = self.showFiles)
        self.menu_show.add_command(label = "Show tracks", command = self.showTracks)
        for task, name in m.fullname.items():
            self.menu_task.add_radiobutton(label = name, variable = self.task, value = task,
                                           command = self.changedTask)
        self.menu_help.add_command(label = "About", command = self.about)
        self.menu_help.add_command(label = "Citation", command = self.citation)
        self.menu_help.add_separator()
        self.menu_help.add_command(label = "Check for updates", command = self.checkUpdates)
        self.menu_help.add_separator()        
        self.menu_help.add_command(label = "Help", command = self.helpCM)