def main(): from filestorage import FileStorage testGUI = Tk() testGUI.fileStorage = FileStorage() processor = Processor(testGUI) processor.grid() testGUI.mainloop()
def __init__(self, storageType="memory"): if storageType == "memory": self.realStorage = MemoryStorage() elif storageType == "file": self.realStorage = FileStorage() elif storageType == "json": self.realStorage = JsonStorage() else: raise TypeError('Wrong storage type!')
def main(): "most probably does not work" from filestorage import FileStorage import os.path import os testGUI = Tk() testGUI.fileStorage = FileStorage() testingDir = os.path.join(os.getcwd(), "TestingFiles") from filestorage import recognizeFiles testGUI.fileStorage.addFiles(recognizeFiles([os.path.join(testingDir, file) for file in os.listdir(testingDir)])) controller = Controller(testGUI) controller.grid() controller.controlFun() controller.saveToFrame.saveToVar.set(os.path.join(os.getcwd(), "Results.txt")) controller.saveFun() testGUI.mainloop()
def main(): import os.path import os from filestorage import FileStorage, recognizeFiles testGUI = Tk() testGUI.fileStorage = FileStorage() testGUI.timeFrame = TimeFrame(testGUI) testingDir = os.path.join(os.getcwd(), "TestingFiles") files = recognizeFiles( [os.path.join(testingDir, file) for file in os.listdir(testingDir)]) testGUI.fileStorage.addFiles(files) testGUI.fileStorage.tag(files[1][1]) testGUI.showtracks = ShowTracks(testGUI, files[1], files[1][1]) testGUI.showtracks.grid() testGUI.showtracks.controlled = True testGUI.wm_withdraw() testGUI.mainloop()
def changedTask(self): """called when mode is changed changes names in Options menu exchanges Process, Explore, Control notepages calls m.changeMode puts old filestorage in m.fs[m.mode] and the self.root.[...].fileStorage is reassigned saves old slaves of GUI's notebook and loads new renames GUI and saves the mode selection to options """ if self.task.get() != m.mode: if m.mode: oldname = m.fullname[m.mode] newname = m.fullname[self.task.get()] self.menu_options.entryconfigure( "Parameter settings (" + oldname + ")", label="Parameter settings (" + newname + ")") self.menu_options.entryconfigure(oldname + " options", label=newname + " options") if m.mode in m.slaves: m.slaves[m.mode][1] = self.root.selectFunction.select() m.changeMode(self.task.get()) if m.mode not in m.fs: m.fs[m.mode] = FileStorage() self.root.selectFunction.fileStorage = m.fs[m.mode] if m.mode not in m.slaves: m.slaves[m.mode] = [ m.Slaves(Processor(self.root.selectFunction), Explorer(self.root.selectFunction), Controller(self.root.selectFunction)), None ] self.root.processor = m.slaves[m.mode][0].processor self.root.explorer = m.slaves[m.mode][0].explorer self.root.controller = m.slaves[m.mode][0].controller self.root.changeSlaves() if m.slaves[m.mode][1]: self.root.selectFunction.select(m.slaves[m.mode][1]) self.root.changeTitle(m.name) optionWrite("DefaultTask", "'" + self.task.get() + "'", general=True)
def __init__(self): super().__init__() self.title("CM Manager " + ".".join(version())) self.option_add("*tearOff", FALSE) self.resizable(FALSE, FALSE) ''' used when size of the window is changed for placeWindow arguments self.after(50, lambda: print(self.winfo_width())) self.after(50, lambda: print(self.winfo_height())) ''' placeWindow(self, 1010, 786) # notebook self.selectFunction = ttk.Notebook(self) self.selectFunction.grid() # FileStorage is associated with the Notebook self.selectFunction.fileStorage = FileStorage() self.processor = Processor(self.selectFunction) self.explorer = Explorer(self.selectFunction) self.controller = Controller(self.selectFunction) notepageWidth = 20 self.selectFunction.add(self.processor, text="{:^{}}".format("Process", notepageWidth)) self.selectFunction.add(self.explorer, text="{:^{}}".format("Explore", notepageWidth)) self.selectFunction.add(self.controller, text="{:^{}}".format("Control", notepageWidth)) self.selectFunction.bind("<<NotebookTabChanged>>", lambda e: self.checkProcessing(e)) # menu self["menu"] = MenuCM(self) # checks for new messages and versions on the web if optionGet("CheckMessages", True, "bool"): self.onStart() self.mainloop()
def __init__(self, directoryToBeIndexed, indexStorageDirectory): self._directory = directoryToBeIndexed self._indexStorageDirectory = indexStorageDirectory self._filestorage = FileStorage() self._fileNameToDocIdMapper = FileNameToDocIdMapper() self._tokenizer = Tokenizer()