start connecting import/export buttons
This commit is contained in:
parent
c51d86dd74
commit
d3f979ef24
6
core.py
6
core.py
|
@ -85,6 +85,12 @@ class Core():
|
||||||
with open(filepath, 'w') as f:
|
with open(filepath, 'w') as f:
|
||||||
f.write(Core.stringOrderedDict(saveValueStore))
|
f.write(Core.stringOrderedDict(saveValueStore))
|
||||||
|
|
||||||
|
def importPreset(self, filepath):
|
||||||
|
print(filepath)
|
||||||
|
|
||||||
|
def exportPreset(self, exportName, compName, vers, origName):
|
||||||
|
pass
|
||||||
|
|
||||||
def loadEncoderOptions(self):
|
def loadEncoderOptions(self):
|
||||||
file_path = os.path.join(self.wd, 'encoder-options.json')
|
file_path = os.path.join(self.wd, 'encoder-options.json')
|
||||||
with open(file_path) as json_file:
|
with open(file_path) as json_file:
|
||||||
|
|
|
@ -60,15 +60,15 @@ class MainWindow(QtCore.QObject):
|
||||||
|
|
||||||
# Create data directory, load/create settings
|
# Create data directory, load/create settings
|
||||||
self.dataDir = self.core.dataDir
|
self.dataDir = self.core.dataDir
|
||||||
|
self.autosavePath = os.path.join(self.dataDir, 'autosave.avp')
|
||||||
|
self.settings = QSettings(
|
||||||
|
os.path.join(self.dataDir, 'settings.ini'), QSettings.IniFormat)
|
||||||
|
LoadDefaultSettings(self)
|
||||||
self.presetManager = PresetManager(
|
self.presetManager = PresetManager(
|
||||||
uic.loadUi(
|
uic.loadUi(
|
||||||
os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||||
'presetmanager.ui')),
|
'presetmanager.ui')),
|
||||||
self)
|
self)
|
||||||
self.autosavePath = os.path.join(self.dataDir, 'autosave.avp')
|
|
||||||
self.settings = QSettings(
|
|
||||||
os.path.join(self.dataDir, 'settings.ini'), QSettings.IniFormat)
|
|
||||||
LoadDefaultSettings(self)
|
|
||||||
if not os.path.exists(self.dataDir):
|
if not os.path.exists(self.dataDir):
|
||||||
os.makedirs(self.dataDir)
|
os.makedirs(self.dataDir)
|
||||||
for neededDirectory in (
|
for neededDirectory in (
|
||||||
|
|
|
@ -10,7 +10,8 @@ class PresetManager(QtGui.QDialog):
|
||||||
def __init__(self, window, parent):
|
def __init__(self, window, parent):
|
||||||
super().__init__(parent.window)
|
super().__init__(parent.window)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.core = self.parent.core
|
self.core = parent.core
|
||||||
|
self.settings = parent.settings
|
||||||
self.presetDir = self.core.presetDir
|
self.presetDir = self.core.presetDir
|
||||||
self.window = window
|
self.window = window
|
||||||
self.findPresets()
|
self.findPresets()
|
||||||
|
@ -21,6 +22,8 @@ class PresetManager(QtGui.QDialog):
|
||||||
self.window.pushButton_delete.clicked.connect(self.openDeletePresetDialog)
|
self.window.pushButton_delete.clicked.connect(self.openDeletePresetDialog)
|
||||||
self.window.pushButton_rename.clicked.connect(self.openRenamePresetDialog)
|
self.window.pushButton_rename.clicked.connect(self.openRenamePresetDialog)
|
||||||
self.window.pushButton_close.clicked.connect(self.close)
|
self.window.pushButton_close.clicked.connect(self.close)
|
||||||
|
self.window.pushButton_import.clicked.connect(self.openImportDialog)
|
||||||
|
self.window.pushButton_export.clicked.connect(self.openExportDialog)
|
||||||
|
|
||||||
# create filter box and preset list
|
# create filter box and preset list
|
||||||
self.drawFilterList()
|
self.drawFilterList()
|
||||||
|
@ -231,3 +234,21 @@ class PresetManager(QtGui.QDialog):
|
||||||
self.findPresets()
|
self.findPresets()
|
||||||
self.drawPresetList()
|
self.drawPresetList()
|
||||||
break
|
break
|
||||||
|
|
||||||
|
def openImportDialog(self):
|
||||||
|
filename = QtGui.QFileDialog.getOpenFileName(
|
||||||
|
self.window, "Import Preset File",
|
||||||
|
self.settings.value("projectDir"),
|
||||||
|
"Preset Files (*.avl)")
|
||||||
|
if filename:
|
||||||
|
self.core.importPreset(filename)
|
||||||
|
|
||||||
|
def openExportDialog(self):
|
||||||
|
filename = QtGui.QFileDialog.getSaveFileName(
|
||||||
|
self.window, "Export Preset",
|
||||||
|
self.settings.value("projectDir"),
|
||||||
|
"Preset Files (*.avl)")
|
||||||
|
if filename:
|
||||||
|
index = self.window.listWidget_presets.currentRow()
|
||||||
|
comp, vers, name = self.presetRows[index]
|
||||||
|
self.core.exportPreset(filename, comp, vers, name)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>542</width>
|
<width>475</width>
|
||||||
<height>360</height>
|
<height>360</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -104,13 +104,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_close">
|
|
||||||
<property name="text">
|
|
||||||
<string>Close</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -122,6 +115,26 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_close">
|
||||||
|
<property name="text">
|
||||||
|
<string>Close</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
Reference in New Issue