From e32ba958cb95146728d4985221b08c7e01b35470 Mon Sep 17 00:00:00 2001 From: tassaron Date: Sat, 24 Jun 2017 23:12:41 -0400 Subject: fixing bugs --- src/core.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index c80d60e..89c1e86 100644 --- a/src/core.py +++ b/src/core.py @@ -29,6 +29,7 @@ class Core(): else: # unfrozen self.wd = os.path.dirname(os.path.realpath(__file__)) + self.componentsPath = os.path.join(self.wd, 'components') self.loadEncoderOptions() self.videoFormats = Core.appendUppercase([ @@ -66,14 +67,12 @@ class Core(): def findComponents(self): def findComponents(): - srcPath = os.path.join(self.wd, 'components') - if os.path.exists(srcPath): - for f in sorted(os.listdir(srcPath)): - name, ext = os.path.splitext(f) - if name.startswith("__"): - continue - elif ext == '.py': - yield name + for f in sorted(os.listdir(self.componentsPath)): + name, ext = os.path.splitext(f) + if name.startswith("__"): + continue + elif ext == '.py': + yield name self.modules = [ import_module('components.%s' % name) for name in findComponents() @@ -93,10 +92,12 @@ class Core(): return None component = self.modules[moduleIndex].Component( - moduleIndex, compPos, self) + moduleIndex, compPos, self + ) self.selectedComponents.insert( compPos, - component) + component + ) self.componentListChanged() # init component's widget for loading/saving presets -- cgit v1.2.3 From 45b55d8e2fbffceefc9a1cd50b9bdb3e7ec9da78 Mon Sep 17 00:00:00 2001 From: tassaron Date: Sat, 24 Jun 2017 23:40:32 -0400 Subject: fixed lack of asterisks after openProject, added asterisk to window title --- src/core.py | 4 +++- src/mainwindow.py | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 89c1e86..fdba1c4 100644 --- a/src/core.py +++ b/src/core.py @@ -178,6 +178,7 @@ class Core(): for i, tup in enumerate(data['Components']): name, vers, preset = tup clearThis = False + modified = False # add loaded named presets to savedPresets dict if 'preset' in preset and preset['preset'] is not None: @@ -187,6 +188,7 @@ class Core(): origSaveValueStore = self.getPreset(filepath2) if origSaveValueStore: self.savedPresets[nam] = dict(origSaveValueStore) + modified = not origSaveValueStore == preset else: # saved preset was renamed or deleted clearThis = True @@ -218,7 +220,7 @@ class Core(): if clearThis: self.clearPreset(i) if hasattr(loader, 'updateComponentTitle'): - loader.updateComponentTitle(i) + loader.updateComponentTitle(i, modified) except: errcode = 1 data = sys.exc_info() diff --git a/src/mainwindow.py b/src/mainwindow.py index 7a9e397..7fae4ea 100644 --- a/src/mainwindow.py +++ b/src/mainwindow.py @@ -286,6 +286,8 @@ class MainWindow(QtWidgets.QMainWindow): appName += ' - %s' % \ os.path.splitext( os.path.basename(self.currentProject))[0] + if self.autosaveExists(identical=False): + appName += '*' self.window.setWindowTitle(appName) @QtCore.pyqtSlot(int, dict) @@ -490,6 +492,7 @@ class MainWindow(QtWidgets.QMainWindow): self.newTask.emit(self.core.selectedComponents) # self.processTask.emit() self.autosave(force) + self.updateWindowTitle() def showPreviewImage(self, image): self.previewWindow.changePixmap(image) @@ -602,11 +605,11 @@ class MainWindow(QtWidgets.QMainWindow): self.currentProject = None self.settings.setValue("currentProject", None) self.drawPreview(True) - self.updateWindowTitle() def saveCurrentProject(self): if self.currentProject: self.core.createProjectFile(self.currentProject) + self.updateWindowTitle() else: self.openSaveProjectDialog() @@ -638,8 +641,8 @@ class MainWindow(QtWidgets.QMainWindow): self.settings.setValue("projectDir", os.path.dirname(filename)) self.settings.setValue("currentProject", filename) self.currentProject = filename - self.updateWindowTitle() self.core.createProjectFile(filename) + self.updateWindowTitle() def openOpenProjectDialog(self): filename, _ = QtWidgets.QFileDialog.getOpenFileName( @@ -651,7 +654,6 @@ class MainWindow(QtWidgets.QMainWindow): def openProject(self, filepath, prompt=True): if not filepath or not os.path.exists(filepath) \ or not filepath.endswith('.avp'): - self.updateWindowTitle() return self.clear() @@ -660,7 +662,6 @@ class MainWindow(QtWidgets.QMainWindow): self.openSaveChangesDialog('opening another project') self.currentProject = filepath - self.updateWindowTitle() self.settings.setValue("currentProject", filepath) self.settings.setValue("projectDir", os.path.dirname(filepath)) # actually load the project using core method -- cgit v1.2.3