From e481680e7dd4e68008781dcc608f94301ad3f9d5 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 7 Jun 2018 19:43:10 +0200 Subject: [PATCH] LV2 export window is now a simple combo-box --- source/carla_skin.py | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/source/carla_skin.py b/source/carla_skin.py index b4c28a721..8c59a4c3b 100755 --- a/source/carla_skin.py +++ b/source/carla_skin.py @@ -1152,16 +1152,29 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta): # Export LV2 elif actSel == actExportLV2: - ret = QFileDialog.getSaveFileName(self, self.tr("Export Plugin as LV2"), "", "", "", QFileDialog.ShowDirsOnly|QFileDialog.HideNameFilterDetails) - - if config_UseQt5: - ret = ret[0] - if not ret: + filepath = QInputDialog.getItem(self, self.tr("Export LV2 Plugin"), + self.tr("Select LV2 Path where plugin will be exported to:"), + CARLA_DEFAULT_LV2_PATH, editable=False) + if not all(filepath): return - if not self.host.export_plugin_lv2(self.fPluginId, ret): - CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"), - self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) + plugname = self.fPluginInfo['name'] + filepath = os.path.join(filepath[0], plugname.replace(" ","_")) + + if not filepath.endswith(".lv2"): + filepath += ".lv2" + + if os.path.exists(filepath): + if QMessageBox.question(self, self.tr("Export to LV2"), + self.tr("Plugin bundle already exists, overwrite?")) == QMessageBox.Ok: + return + + if not self.host.export_plugin_lv2(self.fPluginId, filepath): + return CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"), + self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) + + QMessageBox.information(self, self.tr("Plugin exported"), + self.tr("Plugin exported successfully, saved in folder:\n%s" % filepath)) # -------------------------------------------------------------