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:
|
||||
f.write(Core.stringOrderedDict(saveValueStore))
|
||||
|
||||
def importPreset(self, filepath):
|
||||
print(filepath)
|
||||
|
||||
def exportPreset(self, exportName, compName, vers, origName):
|
||||
pass
|
||||
|
||||
def loadEncoderOptions(self):
|
||||
file_path = os.path.join(self.wd, 'encoder-options.json')
|
||||
with open(file_path) as json_file:
|
||||
|
|
|
@ -60,15 +60,15 @@ class MainWindow(QtCore.QObject):
|
|||
|
||||
# Create data directory, load/create settings
|
||||
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(
|
||||
uic.loadUi(
|
||||
os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||
'presetmanager.ui')),
|
||||
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):
|
||||
os.makedirs(self.dataDir)
|
||||
for neededDirectory in (
|
||||
|
|
|
@ -10,7 +10,8 @@ class PresetManager(QtGui.QDialog):
|
|||
def __init__(self, window, parent):
|
||||
super().__init__(parent.window)
|
||||
self.parent = parent
|
||||
self.core = self.parent.core
|
||||
self.core = parent.core
|
||||
self.settings = parent.settings
|
||||
self.presetDir = self.core.presetDir
|
||||
self.window = window
|
||||
self.findPresets()
|
||||
|
@ -21,6 +22,8 @@ class PresetManager(QtGui.QDialog):
|
|||
self.window.pushButton_delete.clicked.connect(self.openDeletePresetDialog)
|
||||
self.window.pushButton_rename.clicked.connect(self.openRenamePresetDialog)
|
||||
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
|
||||
self.drawFilterList()
|
||||
|
@ -231,3 +234,21 @@ class PresetManager(QtGui.QDialog):
|
|||
self.findPresets()
|
||||
self.drawPresetList()
|
||||
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>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>542</width>
|
||||
<width>475</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -104,13 +104,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_close">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -122,6 +115,26 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
Reference in New Issue