Updated DSSI
[klaudia.git] / src / w_klaudia.py
blob5b9308334b73a4c67d2a8b5d211b334aeac6cfff
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 # Imports
5 from commands import getoutput
6 from random import randint
7 from PyQt4.QtCore import Qt, QSettings, QString, QVariant, SIGNAL
8 from PyQt4.QtGui import QFileDialog, QIcon, QMainWindow, QMessageBox, QTableWidgetItem
9 from xicon import XIcon
10 import dbus, os, sys
11 import database, ui_klaudia
13 # Debug Mode
14 SHOW_ALL = False
16 # DBus connections
17 class DBus(object):
18 __slots__ = [
19 'loopBus',
20 'jackBus',
21 'controlBus',
22 'studioBus',
23 'appBus',
25 DBus = DBus()
27 # QLineEdit and QPushButtom combo
28 def getAndSetPath(parent, current_path, lineEdit):
29 print current_path
30 new_path = QFileDialog.getExistingDirectory(parent, parent.tr("Set Path"), current_path, QFileDialog.ShowDirsOnly)
31 if not new_path.isEmpty():
32 lineEdit.setText(new_path)
34 return new_path
36 # Properly convert QString to str
37 def QStringStr(string):
38 return str(unicode(string).encode('utf-8'))
40 # Main Window
41 class KlaudiaMainW(QMainWindow, ui_klaudia.Ui_KlaudiaMainW):
42 def __init__(self, *args):
43 QMainWindow.__init__(self, *args)
44 self.setupUi(self)
46 # Check for Jack
47 if not bool(DBus.jackBus.IsStarted()):
48 try:
49 DBus.jackBus.StartServer()
50 except:
51 QMessageBox.critical(self, self.tr("Error"), self.tr("Jack is not started!\n"
52 "Please start it first, then run Klaudia again"))
53 exit(-1)
55 # Load Settings (GUI state)
56 self.settings = QSettings()
57 if (self.settings.contains("SplitterDAW") and self.settings.contains("SplitterDSSI")):
58 self.loadSettings()
59 else: # First-Run
60 self.splitter_DAW.setSizes([500,200])
61 self.splitter_Host.setSizes([500,200])
62 self.splitter_Instrument.setSizes([500,200])
63 self.splitter_DSSI.setSizes([500,200])
64 self.splitter_Bristol.setSizes([500,200])
65 self.splitter_Effect.setSizes([500,200])
66 self.splitter_Tool.setSizes([500,200])
68 # For the custom icons
69 self.MyIcons = XIcon()
70 self.MyIcons.addIconPath("/usr/share/klaudia/icons/")
71 self.MyIcons.addThemeName(QStringStr(QIcon.themeName()))
72 self.MyIcons.addThemeName("oxygen") #Just in case...
74 # Set-up GUI
75 self.b_start.setIcon(QIcon.fromTheme("go-next", QIcon(self.MyIcons.getIconPath("go-next"))))
76 self.b_add.setIcon(QIcon.fromTheme("list-add", QIcon(self.MyIcons.getIconPath("list-add"))))
77 self.b_refresh.setIcon(QIcon.fromTheme("view-refresh", QIcon(self.MyIcons.getIconPath("view-refresh"))))
78 self.b_open.setIcon(QIcon.fromTheme("document-open", QIcon(self.MyIcons.getIconPath("document-open"))))
79 self.b_start.setEnabled(False)
80 self.b_add.setEnabled(False)
82 self.listDAW.setColumnWidth(0, 22)
83 self.listDAW.setColumnWidth(1, 150)
84 self.listDAW.setColumnWidth(2, 125)
86 self.listHost.setColumnWidth(0, 22)
87 self.listHost.setColumnWidth(1, 150)
89 self.listInstrument.setColumnWidth(0, 22)
90 self.listInstrument.setColumnWidth(1, 150)
91 self.listInstrument.setColumnWidth(2, 125)
93 self.listDSSI.setColumnWidth(0, 22)
94 self.listDSSI.setColumnWidth(1, 200)
96 self.listBristol.setColumnWidth(0, 22)
97 self.listBristol.setColumnWidth(1, 100)
99 self.listEffect.setColumnWidth(0, 22)
100 self.listEffect.setColumnWidth(1, 225)
101 self.listEffect.setColumnWidth(2, 125)
103 self.listTool.setColumnWidth(0, 22)
104 self.listTool.setColumnWidth(1, 225)
105 self.listTool.setColumnWidth(2, 125)
107 self.listDAW.setContextMenuPolicy(Qt.CustomContextMenu)
108 self.listHost.setContextMenuPolicy(Qt.CustomContextMenu)
109 self.listInstrument.setContextMenuPolicy(Qt.CustomContextMenu)
110 self.listDSSI.setContextMenuPolicy(Qt.CustomContextMenu)
111 self.listBristol.setContextMenuPolicy(Qt.CustomContextMenu)
112 self.listEffect.setContextMenuPolicy(Qt.CustomContextMenu)
113 self.listTool.setContextMenuPolicy(Qt.CustomContextMenu)
115 self.co_sample_rate.addItem(str(DBus.jackBus.GetSampleRate()))
116 self.b_refresh.setText("")
118 self.studio_root_folder = QString(os.getenv("HOME"))
119 self.le_url.setText(self.studio_root_folder)
120 self.test_url = True
121 self.test_selected = False
123 self.clearInfo_DAW()
124 self.clearInfo_Host()
125 self.clearInfo_Intrument()
126 self.clearInfo_DSSI()
127 self.clearInfo_Bristol()
128 self.clearInfo_Effect()
129 self.clearInfo_Tool()
131 self.refreshAll()
132 self.refreshStudioList()
134 if (DBus.controlBus):
135 self.enableLADISH(True)
137 self.connect(self.b_start, SIGNAL("clicked()"), self.startApp)
138 self.connect(self.b_add, SIGNAL("clicked()"), self.addApp)
139 self.connect(self.b_refresh, SIGNAL("clicked()"), self.refreshStudioList)
141 self.connect(self.co_ladi_room, SIGNAL("currentIndexChanged(int)"), self.checkSelectedRoom)
142 self.connect(self.groupLADISH, SIGNAL("toggled(bool)"), self.enableLADISH)
144 self.connect(self.le_url, SIGNAL("textChanged(QString)"), self.checkFolderUrl)
145 self.connect(self.tabWidget, SIGNAL("currentChanged(int)"), self.checkSelectedTab)
147 self.connect(self.listDAW, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedDAW)
148 self.connect(self.listHost, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedHost)
149 self.connect(self.listInstrument, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedInstrument)
150 self.connect(self.listDSSI, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedDSSI)
151 self.connect(self.listBristol, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedBristol)
152 self.connect(self.listEffect, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedEffect)
153 self.connect(self.listTool, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedTool)
154 self.connect(self.listDAW, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListDAW)
155 self.connect(self.listHost, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListHost)
156 self.connect(self.listInstrument, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListInstrument)
157 self.connect(self.listDSSI, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListDSSI)
158 self.connect(self.listBristol, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListBristol)
159 self.connect(self.listEffect, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListEffect)
160 self.connect(self.listTool, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListTool)
162 self.connect(self.url_documentation_daw, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
163 self.connect(self.url_website_daw, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
164 self.connect(self.url_documentation_host, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
165 self.connect(self.url_website_host, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
166 self.connect(self.url_documentation_ins, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
167 self.connect(self.url_website_ins, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
168 self.connect(self.url_documentation_dssi, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
169 self.connect(self.url_website_dssi, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
170 self.connect(self.url_documentation_bristol, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
171 self.connect(self.url_website_bristol, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
172 self.connect(self.url_documentation_effect, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
173 self.connect(self.url_website_effect, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
174 self.connect(self.url_documentation_tool, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
175 self.connect(self.url_website_tool, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
177 self.connect(self.b_open, SIGNAL("clicked()"), lambda: getAndSetPath(self, self.le_url.text(), self.le_url))
179 def refreshStudioList(self):
180 self.co_ladi_room.clear()
181 self.co_ladi_room.addItem("<Studio Root>")
182 if (DBus.controlBus):
183 studio_bus = DBus.loopBus.get_object("org.ladish", "/org/ladish/Studio")
184 studio_list_dump = studio_bus.GetRoomList()
185 for i in range(len(studio_list_dump)):
186 self.co_ladi_room.addItem(str(studio_list_dump[i][0]).replace("/org/ladish/Room","")+" - "+studio_list_dump[i][1]['name'])
188 def checkSelectedRoom(self, co_n):
189 if (co_n == -1 or not DBus.controlBus):
190 print "going -1"
191 elif (co_n == 0):
192 print "selected studio room"
193 DBus.studioBus = DBus.loopBus.get_object("org.ladish", "/org/ladish/Studio")
194 DBus.appBus = dbus.Interface(DBus.studioBus, 'org.ladish.AppSupervisor')
195 self.b_open.setEnabled(True)
196 self.le_url.setEnabled(True)
197 self.le_url.setText(self.studio_root_folder)
198 else:
199 print "selected a room", co_n
200 room_name = "/org/ladish/Room"+QStringStr(self.co_ladi_room.currentText().split(" ")[0])
201 DBus.studioBus = DBus.loopBus.get_object("org.ladish", room_name)
202 DBus.appBus = dbus.Interface(DBus.studioBus, 'org.ladish.AppSupervisor')
203 room_properties = DBus.studioBus.GetProjectProperties()
204 if (len(room_properties[1])):
205 self.b_open.setEnabled(False)
206 self.le_url.setEnabled(False)
207 self.le_url.setText(QString(room_properties[1]['dir']))
208 else:
209 self.b_open.setEnabled(True)
210 self.le_url.setEnabled(True)
211 self.studio_root_folder = self.le_url.text()
213 def enableLADISH(self, really):
214 if (really):
215 self.groupLADISH.setCheckable(False)
216 self.groupLADISH.setTitle(self.tr("LADISH is enabled"))
218 DBus.controlBus = DBus.loopBus.get_object("org.ladish", "/org/ladish/Control")
219 DBus.studioBus = DBus.loopBus.get_object("org.ladish", "/org/ladish/Studio")
220 DBus.appBus = dbus.Interface(DBus.studioBus, 'org.ladish.AppSupervisor')
222 self.refreshStudioList()
223 self.checkButtons()
225 def getSelectedApp(self):
226 tab = self.tabWidget.currentIndex()
227 if (tab == 0):
228 listSel = self.listDAW
229 elif (tab == 1):
230 listSel = self.listHost
231 elif (tab == 2):
232 listSel = self.listInstrument
233 elif (tab == 3):
234 listSel = self.listDSSI
235 elif (tab == 4):
236 listSel = self.listBristol
237 elif (tab == 5):
238 listSel = self.listEffect
239 elif (tab == 6):
240 listSel = self.listTool
241 else:
242 return ""
244 return listSel.item(listSel.currentRow(), 1 if (tab != 4) else 2).text()
246 def getBinaryFromAppName(self, appname):
247 list_DAW = database.list_DAW
248 for i in range(len(list_DAW)):
249 if (appname == list_DAW[i][1]):
250 binary = list_DAW[i][3]
251 break
253 list_Host = database.list_Host
254 for i in range(len(list_Host)):
255 if (appname == list_Host[i][1]):
256 binary = list_Host[i][4]
257 break
259 list_Instrument = database.list_Instrument
260 for i in range(len(list_Instrument)):
261 if (appname == list_Instrument[i][1]):
262 binary = list_Instrument[i][3]
263 break
265 list_DSSI = database.list_DSSI
266 for i in range(len(list_DSSI)):
267 if (appname == list_DSSI[i][1]):
268 binary = "ghostess "+list_DSSI[i][3]+" -hostname "+list_DSSI[i][3].split(":")[1].replace(" ","_")
269 break
271 list_Bristol = database.list_Bristol
272 for i in range(len(list_Bristol)):
273 if (appname == list_Bristol[i][1]):
274 binary = "startBristol -audio jack -midi jack -"+list_Bristol[i][3]
275 break
277 list_Effect = database.list_Effect
278 for i in range(len(list_Effect)):
279 if (appname == list_Effect[i][1]):
280 binary = list_Effect[i][3]
281 break
283 list_Tool = database.list_Tool
284 for i in range(len(list_Tool)):
285 if (appname == list_Tool[i][1]):
286 binary = list_Tool[i][3]
287 break
289 if (binary):
290 return binary
291 else:
292 print "Error here, cod.002"
293 return ""
295 def doubleClickedListDAW(self, row, column):
296 app = self.listDAW.item(row, 1).text()
297 self.startApp(app)
299 def doubleClickedListHost(self, row, column):
300 app = self.listHost.item(row, 1).text()
301 self.startApp(app)
303 def doubleClickedListInstrument(self, row, column):
304 app = self.listInstrument.item(row, 1).text()
305 self.startApp(app)
307 def doubleClickedListDSSI(self, row, column):
308 app = self.listDSSI.item(row, 1).text()
309 self.startApp(app)
311 def doubleClickedListBristol(self, row, column):
312 app = self.listBristol.item(row, 2).text()
313 self.startApp(app)
315 def doubleClickedListEffect(self, row, column):
316 app = self.listEffect.item(row, 1).text()
317 self.startApp(app)
319 def doubleClickedListTool(self, row, column):
320 app = self.listTool.item(row, 1).text()
321 self.startApp(app)
323 def startApp(self, app=None):
324 if (not app):
325 app = self.getSelectedApp()
326 binary = self.getBinaryFromAppName(app)
327 os.system("cd "+QStringStr(self.le_url.text())+" && "+binary+" &")
329 def addApp(self):
330 app = self.getSelectedApp()
331 binary = self.getBinaryFromAppName(app)
333 ran_check = str(randint(1, 99999))
334 sample_rate = str(self.co_sample_rate.currentText())
335 url_folder = QStringStr(self.le_url.text())
336 proj_bpm = str(self.sb_bpm.text())
338 if (url_folder[-1] != "/"):
339 url_folder += "/"
341 if (binary.split(" ")[0] == "startBristol"):
342 synth = binary.split("-audio jack -midi jack -")[1]
343 proj_folder = url_folder+"bristol_"+synth+"_"+ran_check
344 os.mkdir(proj_folder)
345 if (not self.le_url.isEnabled()): proj_folder = proj_folder.replace(url_folder,"")
346 cmd = binary+" -emulate "+synth+" -cache "+proj_folder+" -memdump "+proj_folder+" -import "+proj_folder+"/memory -exec"
347 DBus.appBus.RunCustom(False, cmd, str(app), 1)
349 elif (app == "Ardour" or app == "ArdourVST" or app == "ArdourVST (32bit)"):
350 proj_folder = url_folder+"Ardour2_"+ran_check
351 os.mkdir(proj_folder)
352 os.system("cp "+sys.path[0]+"/../templates/Ardour2/* '"+proj_folder+"'")
353 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_folder+'/Ardour2.ardour"')
354 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_folder+'/Ardour2.ardour"')
355 os.system("cd '"+proj_folder+"' && mv Ardour2.ardour Ardour2_"+ran_check+".ardour")
356 os.mkdir(proj_folder+"/analysis")
357 os.mkdir(proj_folder+"/dead_sounds")
358 os.mkdir(proj_folder+"/export")
359 os.mkdir(proj_folder+"/interchange")
360 os.mkdir(proj_folder+"/interchange/Ardour")
361 os.mkdir(proj_folder+"/interchange/Ardour/audiofiles")
362 os.mkdir(proj_folder+"/peaks")
363 if (not self.le_url.isEnabled()): proj_folder = proj_folder.replace(url_folder,"")
364 DBus.appBus.RunCustom(False, binary+" '"+proj_folder+"'", str(app), 1)
365 elif (app == "Hydrogen" or app == "Hydrogen (SVN)"):
366 if (app == "Hydrogen (SVN)"):
367 level = 1
368 else:
369 level = 0
370 proj_file = url_folder+"Hydrogen_"+ran_check+".h2song"
371 os.system("cp "+sys.path[0]+"/../templates/Hydrogen.h2song '"+proj_file+"'")
372 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'"')
373 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
374 DBus.appBus.RunCustom(False, "hydrogen -s '"+proj_file+"'", str(app), level)
375 elif (app == "MusE" or app == "MusE (SVN)"):
376 proj_file = url_folder+"MusE_"+ran_check+".med"
377 os.system("cp "+sys.path[0]+"/../templates/MusE.med '"+proj_file+"'")
378 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
379 DBus.appBus.RunCustom(False, "muse '"+proj_file+"'", str(app), 0)
380 elif (app == "Non-DAW"):
381 proj_file = url_folder+"Non-DAW_"+ran_check
382 os.system("cp -r "+sys.path[0]+"/../templates/Non-DAW '"+proj_file+"'")
383 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'/history"')
384 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'/info"')
385 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
386 DBus.appBus.RunCustom(False, "non-daw '"+proj_file+"'", str(app), 0)
387 elif (app == "Non-Sequencer"):
388 proj_file = url_folder+"Non-Sequencer_"+ran_check+".non"
389 os.system("cp "+sys.path[0]+"/../templates/Non-Sequencer.non '"+proj_file+"'")
390 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
391 DBus.appBus.RunCustom(False, "non-sequencer '"+proj_file+"'", str(app), 0)
392 elif (app == "Qtractor" or app == "QtractorVST" or app == "QtractorVST (32bit)" or app == "Qtractor (SVN)"):
393 proj_file = url_folder+"Qtractor_"+ran_check+".qtr"
394 os.system("cp "+sys.path[0]+"/../templates/Qtractor.qtr '"+proj_file+"'")
395 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'"')
396 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'"')
397 os.system('sed -i "s/X_FOLDER_X-KLAUDIA-X_FOLDER_X/'+url_folder.replace("/","\/")+'/" "'+proj_file+'"')
398 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
399 DBus.appBus.RunCustom(False, binary+" '"+proj_file+"'", str(app), 1)
400 elif (app == "Renoise" or app == "Renoise (64bit)"):
401 os.mkdir(url_folder+"tmp_bu")
402 os.system("cp "+sys.path[0]+"/../templates/Renoise.xml "+url_folder+"/tmp_bu")
403 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+url_folder+'/tmp_bu/Renoise.xml"')
404 os.system("cd '"+url_folder+"tmp_bu' && mv Renoise.xml Song.xml && zip ../Renoise_"+ran_check+".xrns Song.xml")
405 os.system("rm -rf '"+url_folder+"tmp_bu'")
406 if (not self.le_url.isEnabled()): url_folder = ""
407 DBus.appBus.RunCustom(False, binary+" '"+url_folder+"Renoise_"+ran_check+".xrns'", str(app), 0)
408 elif (app == "Rosegarden"):
409 proj_file = url_folder+"Rosegarden_"+ran_check+".rg"
410 os.system("cp "+sys.path[0]+"/../templates/Rosegarden.rg '"+proj_file+"'")
411 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'"')
412 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
413 DBus.appBus.RunCustom(False, "rosegarden '"+proj_file+"'", str(app), 1)
414 elif (app == "Seq24"):
415 proj_file = url_folder+"Seq24_"+ran_check+".midi"
416 os.system("cp "+sys.path[0]+"/../templates/Seq24.midi '"+proj_file+"'")
417 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
418 DBus.appBus.RunCustom(False, "seq24 --file '"+proj_file+"'", str(app), 1)
420 elif (app == "Calf Jack Host (GIT)"):
421 proj_file = url_folder+"CalfJackHost_"+ran_check
422 os.system("cp "+sys.path[0]+"/../templates/CalfJackHost '"+proj_file+"'")
423 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
424 DBus.appBus.RunCustom(False, "calfjackhost --load '"+proj_file+"'", str(app), 1)
425 elif (app == "FeSTige"):
426 room_name = "" if (self.co_ladi_room.currentIndex() <= 0) else "\""+str(self.co_ladi_room.currentText()).split(" - ")[1]+"\""
427 DBus.appBus.RunCustom(False, "festige "+url_folder+" "+room_name, str(app), 0)
428 #elif (app == "Ingen" or app == "Ingen (SVN)"):
429 #if (app == "Ingen (SVN)"):
430 #binary = "ingen-svn"
431 #else:
432 #binary = "ingen"
433 #proj_file = url_folder+"/"+"ingen_"+ran_check+".ing.lv2"
434 #os.system("cp -r "+sys.path[0]+"/../templates/ingen.ing.lv2 '"+proj_file+"'")
435 #if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
436 #DBus.appBus.RunCustom(False, binary+" -egl '"+proj_file+"'", str(app), 0)
437 elif (app == "Jack Rack"):
438 proj_file = url_folder+"Jack-Rack_"+ran_check+".xml"
439 os.system("cp "+sys.path[0]+"/../templates/Jack-Rack.xml '"+proj_file+"'")
440 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'"')
441 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
442 DBus.appBus.RunCustom(False, "jack-rack -s '"+str(app)+"' '"+proj_file+"'", str(app), 0)
444 elif (app == "Qsampler" or app == "Qsampler (SVN)"):
445 if (app == "Qsampler (SVN)"):
446 level = 1
447 else:
448 level = 0
449 proj_file = url_folder+"Qsampler_"+ran_check+".lscp"
450 os.system("cp "+sys.path[0]+"/../templates/Qsampler.lscp '"+proj_file+"'")
451 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
452 DBus.appBus.RunCustom(False, "qsampler '"+proj_file+"'", str(app), level)
453 elif (app == "Yoshimi"):
454 proj_file = url_folder+"Yoshimi_"+ran_check+".state"
455 os.system("cp "+sys.path[0]+"/../templates/Yoshimi.state '"+proj_file+"'")
456 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'"')
457 os.system('sed -i "s/X_FILE_X-KLAUDIA-X_FILE_X/'+proj_file.replace("/","\/")+'/" "'+proj_file+'"')
458 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
459 DBus.appBus.RunCustom(False, "yoshimi -j -J --state='"+proj_file+"'", str(app), 1)
461 elif (app == "Jamin"):
462 proj_file = url_folder+"Jamin_"+ran_check+".jam"
463 os.system("cp "+sys.path[0]+"/../templates/Jamin.jam '"+proj_file+"'")
464 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
465 DBus.appBus.RunCustom(False, "jamin -f '"+proj_file+"'", str(app), 0)
467 elif (app == "Jack Mixer"):
468 proj_file = url_folder+"Jack-Mixer_"+ran_check+".xml"
469 os.system("cp "+sys.path[0]+"/../templates/Jack-Mixer.xml '"+proj_file+"'")
470 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
471 DBus.appBus.RunCustom(False, "jack_mixer -c '"+proj_file+"'", str(app), 1)
472 elif (app == "Non-Mixer"):
473 proj_file = url_folder+"Non-Mixer_"+ran_check
474 os.system("cp -r "+sys.path[0]+"/../templates/Non-Mixer '"+proj_file+"'")
475 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
476 DBus.appBus.RunCustom(False, "non-mixer '"+proj_file+"'", str(app), 0)
478 else:
479 DBus.appBus.RunCustom(False, binary, str(app), 0)
481 def clearInfo_DAW(self):
482 self.ico_app_daw.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
483 self.label_name_daw.setText("App Name")
484 self.ico_ladspa_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
485 self.ico_dssi_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
486 self.ico_lv2_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
487 self.ico_vst_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
488 self.label_vst_mode_daw.setText("")
489 self.ico_jack_transport_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
490 self.label_midi_mode_daw.setText("---")
491 self.label_ladish_level_daw.setText("0")
492 self.showDoc_DAW(0, 0)
493 self.frame_DAW.setEnabled(False)
495 def clearInfo_Host(self):
496 self.ico_app_host.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
497 self.label_name_host.setText("App Name")
498 self.ico_ladspa_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
499 self.ico_dssi_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
500 self.ico_lv2_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
501 self.ico_vst_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
502 self.label_vst_mode_host.setText("")
503 self.label_midi_mode_host.setText("---")
504 self.label_ladish_level_host.setText("0")
505 self.showDoc_Host(0, 0)
506 self.frame_Host.setEnabled(False)
508 def clearInfo_Intrument(self):
509 self.ico_app_ins.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
510 self.label_name_ins.setText("App Name")
511 self.ico_builtin_fx_ins.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
512 self.ico_audio_input_ins.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
513 self.label_midi_mode_ins.setText("---")
514 self.label_ladish_level_ins.setText("0")
515 self.showDoc_Instrument(0, 0)
516 self.frame_Instrument.setEnabled(False)
518 def clearInfo_DSSI(self):
519 self.ico_app_dssi.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
520 self.label_name_dssi.setText("App Name")
521 self.ico_builtin_fx_dssi.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
522 self.ico_stereo_dssi.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
523 self.label_midi_mode_dssi.setText("---")
524 self.label_ladish_level_dssi.setText("0")
525 self.showDoc_DSSI(0, 0)
526 self.frame_DSSI.setEnabled(False)
528 def clearInfo_Bristol(self):
529 self.ico_app_bristol.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
530 self.label_name_bristol.setText("App Name")
531 self.ico_builtin_fx_bristol.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
532 self.ico_audio_input_bristol.setPixmap(QIcon("dialog-cancel").pixmap(16, 16))
533 self.label_midi_mode_bristol.setText("---")
534 self.label_ladish_level_bristol.setText("0")
535 self.showDoc_Bristol(0, 0)
536 self.frame_Bristol.setEnabled(False)
538 def clearInfo_Effect(self):
539 self.ico_app_effect.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
540 self.label_name_effect.setText("App Name")
541 self.ico_stereo_effect.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
542 self.label_midi_mode_effect.setText("---")
543 self.label_ladish_level_effect.setText("0")
544 self.showDoc_Effect(0, 0)
545 self.frame_Effect.setEnabled(False)
547 def clearInfo_Tool(self):
548 self.ico_app_tool.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
549 self.label_name_tool.setText("App Name")
550 self.label_midi_mode_tool.setText("---")
551 self.label_ladish_level_tool.setText("0")
552 self.showDoc_Tool(0, 0)
553 self.frame_Tool.setEnabled(False)
555 def checkFolderUrl(self, url):
556 if (os.path.exists(QStringStr(url))):
557 self.test_url = True
558 if (self.le_url.isEnabled()):
559 self.studio_root_folder = url
560 else:
561 self.test_url = False
562 self.checkButtons()
564 def checkSelectedTab(self, tab):
565 self.test_selected = False
566 if (tab == 0): # DAW
567 if (self.listDAW.selectedItems()):
568 self.test_selected = True
569 elif (tab == 1): # Host
570 if (self.listHost.selectedItems()):
571 self.test_selected = True
572 elif (tab == 2): # Instrument
573 if (self.listInstrument.selectedItems()):
574 self.test_selected = True
575 elif (tab == 3): # DSSI
576 if (self.listDSSI.selectedItems()):
577 self.test_selected = True
578 elif (tab == 4): # Bristol
579 if (self.listBristol.selectedItems()):
580 self.test_selected = True
581 elif (tab == 5): # Effect
582 if (self.listEffect.selectedItems()):
583 self.test_selected = True
584 elif (tab == 6): # Tool
585 if (self.listTool.selectedItems()):
586 self.test_selected = True
588 self.checkButtons()
590 def checkSelectedDAW(self, row, column, p_row, p_column):
591 if (row >= 0):
592 self.test_selected = True
594 app_name = self.listDAW.item(row, 1).text()
595 app_info = []
596 list_DAW = database.list_DAW
598 for i in range(len(list_DAW)):
599 if (app_name == list_DAW[i][1]):
600 app_info = list_DAW[i]
601 break
603 if (not app_info):
604 print "Error here, cod.001"
605 return
607 self.frame_DAW.setEnabled(True)
608 self.ico_app_daw.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
609 self.ico_ladspa_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
610 self.ico_dssi_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
611 self.ico_lv2_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][2]), 16)).pixmap(16, 16))
612 self.ico_vst_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][3]), 16)).pixmap(16, 16))
613 self.ico_jack_transport_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][5]), 16)).pixmap(16, 16))
614 self.label_name_daw.setText(app_info[1])
615 self.label_vst_mode_daw.setText(app_info[8][4])
616 self.ico_midi_mode_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][6]), 16)).pixmap(16, 16))
617 self.label_midi_mode_daw.setText(app_info[8][7])
618 self.label_ladish_level_daw.setText(str(app_info[6]))
620 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
621 self.showDoc_DAW(doc, app_info[9][1])
622 else:
623 self.test_selected = False
624 self.clearInfo_DAW()
625 self.checkButtons()
627 def checkSelectedHost(self, row, column, p_row, p_column):
628 if (row >= 0):
629 self.test_selected = True
631 app_name = self.listHost.item(row, 1).text()
632 app_info = []
633 list_Host = database.list_Host
635 for i in range(len(list_Host)):
636 if (app_name == list_Host[i][1]):
637 app_info = list_Host[i]
638 break
640 if (not app_info):
641 print "Error here, cod.003"
642 return
644 self.frame_Host.setEnabled(True)
645 self.ico_app_host.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[5], 48)).pixmap(48, 48))
646 self.ico_internal_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][0]), 16)).pixmap(16, 16))
647 self.ico_ladspa_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][1]), 16)).pixmap(16, 16))
648 self.ico_dssi_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][2]), 16)).pixmap(16, 16))
649 self.ico_lv2_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][3]), 16)).pixmap(16, 16))
650 self.ico_vst_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][4]), 16)).pixmap(16, 16))
651 self.label_name_host.setText(app_info[1])
652 self.label_vst_mode_host.setText(app_info[9][5])
653 self.label_midi_mode_host.setText(app_info[9][6])
654 self.label_ladish_level_host.setText(str(app_info[7]))
656 doc = app_info[10][0] if (os.path.exists(app_info[10][0].replace("file://",""))) else ""
657 self.showDoc_Host(doc, app_info[10][1])
658 else:
659 self.test_selected = False
660 self.clearInfo_DAW()
661 self.checkButtons()
663 def checkSelectedInstrument(self, row, column, p_row, p_column):
664 if (row >= 0):
665 self.test_selected = True
667 app_name = self.listInstrument.item(row, 1).text()
668 app_info = []
669 list_Instrument = database.list_Instrument
671 for i in range(len(list_Instrument)):
672 if (app_name == list_Instrument[i][1]):
673 app_info = list_Instrument[i]
674 break
676 if (not app_info):
677 print "Error here, cod.004"
678 return
680 self.frame_Instrument.setEnabled(True)
681 self.ico_app_ins.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
682 self.ico_builtin_fx_ins.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
683 self.ico_audio_input_ins.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
684 self.label_name_ins.setText(app_info[1])
685 self.label_midi_mode_ins.setText(app_info[8][2])
686 self.label_ladish_level_ins.setText(str(app_info[6]))
688 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
689 self.showDoc_Instrument(doc, app_info[9][1])
690 else:
691 self.test_selected = False
692 self.clearInfo_Intrument()
693 self.checkButtons()
695 def checkSelectedDSSI(self, row, column, p_row, p_column):
696 if (row >= 0):
697 self.test_selected = True
699 app_name = self.listDSSI.item(row, 1).text()
700 app_info = []
701 list_DSSI = database.list_DSSI
703 for i in range(len(list_DSSI)):
704 if (app_name == list_DSSI[i][1]):
705 app_info = list_DSSI[i]
706 break
708 if (not app_info):
709 print "Error here, cod.004"
710 return
712 self.frame_DSSI.setEnabled(True)
713 self.ico_app_dssi.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
714 self.ico_builtin_fx_dssi.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
715 self.ico_stereo_dssi.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
716 self.label_name_dssi.setText(app_info[1])
717 self.label_midi_mode_dssi.setText(app_info[8][2])
718 self.label_ladish_level_dssi.setText(str(app_info[6]))
720 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
721 self.showDoc_DSSI(doc, app_info[9][1])
722 else:
723 self.test_selected = False
724 self.clearInfo_DSSI()
725 self.checkButtons()
727 def checkSelectedBristol(self, row, column, p_row, p_column):
728 if (row >= 0):
729 self.test_selected = True
731 app_name = self.listBristol.item(row, 2).text()
732 app_info = []
733 list_Bristol = database.list_Bristol
735 for i in range(len(list_Bristol)):
736 if (app_name == list_Bristol[i][1]):
737 app_info = list_Bristol[i]
738 break
740 if (not app_info):
741 print "Error here, cod.007"
742 return
744 self.frame_Bristol.setEnabled(True)
745 self.ico_app_bristol.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
746 self.ico_builtin_fx_bristol.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
747 self.ico_audio_input_bristol.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
748 self.label_name_bristol.setText(app_info[1])
749 self.label_midi_mode_bristol.setText(app_info[8][2])
750 self.label_ladish_level_bristol.setText(str(app_info[6]))
752 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
753 self.showDoc_Bristol(doc, app_info[9][1])
754 else:
755 self.test_selected = False
756 self.clearInfo_Bristol()
757 self.checkButtons()
759 def checkSelectedEffect(self, row, column, p_row, p_column):
760 if (row >= 0):
761 self.test_selected = True
763 app_name = self.listEffect.item(row, 1).text()
764 app_info = []
765 list_Effect = database.list_Effect
767 for i in range(len(list_Effect)):
768 if (app_name == list_Effect[i][1]):
769 app_info = list_Effect[i]
770 break
772 if (not app_info):
773 print "Error here, cod.005"
774 return
776 self.frame_Effect.setEnabled(True)
777 self.ico_app_effect.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
778 self.ico_stereo_effect.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
779 self.label_name_effect.setText(app_info[1])
780 self.label_midi_mode_effect.setText(app_info[8][1])
781 self.label_ladish_level_effect.setText(str(app_info[6]))
783 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
784 self.showDoc_Effect(doc, app_info[9][1])
785 else:
786 self.test_selected = False
787 self.clearInfo_Effect()
788 self.checkButtons()
790 def checkSelectedTool(self, row, column, p_row, p_column):
791 if (row >= 0):
792 self.test_selected = True
794 app_name = self.listTool.item(row, 1).text()
795 app_info = []
796 list_Tool = database.list_Tool
798 for i in range(len(list_Tool)):
799 if (app_name == list_Tool[i][1]):
800 app_info = list_Tool[i]
801 break
803 if (not app_info):
804 print "Error here, cod.006"
805 return
807 self.frame_Tool.setEnabled(True)
808 self.ico_app_tool.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
809 self.label_name_tool.setText(app_info[1])
810 self.label_midi_mode_tool.setText(app_info[8][0])
811 self.ico_jack_transport_tool.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
812 self.label_ladish_level_tool.setText(str(app_info[6]))
814 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
815 self.showDoc_Tool(doc, app_info[9][1])
816 else:
817 self.test_selected = False
818 self.clearInfo_Tool()
819 self.checkButtons()
821 def setDocUrl(self, item, link):
822 item.setText(self.tr("<a href='%1'>Documentation</a>").arg(link))
824 def setWebUrl(self, item, link):
825 item.setText(self.tr("<a href='%1'>WebSite</a>").arg(link))
827 def showDoc_DAW(self, doc, web):
828 if (doc):
829 self.url_documentation_daw.setVisible(True)
830 self.setDocUrl(self.url_documentation_daw, doc)
831 else: self.url_documentation_daw.setVisible(False)
833 if (web):
834 self.url_website_daw.setVisible(True)
835 self.setWebUrl(self.url_website_daw, web)
836 else: self.url_website_daw.setVisible(False)
838 if (not doc and not web):
839 self.label_no_help_daw.setVisible(True)
840 else:
841 self.label_no_help_daw.setVisible(False)
843 def showDoc_Host(self, doc, web):
844 if (doc):
845 self.url_documentation_host.setVisible(True)
846 self.setDocUrl(self.url_documentation_host, doc)
847 else: self.url_documentation_host.setVisible(False)
849 if (web):
850 self.url_website_host.setVisible(True)
851 self.setWebUrl(self.url_website_host, web)
852 else: self.url_website_host.setVisible(False)
854 if (not doc and not web):
855 self.label_no_help_host.setVisible(True)
856 else:
857 self.label_no_help_host.setVisible(False)
859 def showDoc_Instrument(self, doc, web):
860 if (doc):
861 self.url_documentation_ins.setVisible(True)
862 self.setDocUrl(self.url_documentation_ins, doc)
863 else: self.url_documentation_ins.setVisible(False)
865 if (web):
866 self.url_website_ins.setVisible(True)
867 self.setWebUrl(self.url_website_ins, web)
868 else: self.url_website_ins.setVisible(False)
870 if (not doc and not web):
871 self.label_no_help_ins.setVisible(True)
872 else:
873 self.label_no_help_ins.setVisible(False)
875 def showDoc_DSSI(self, doc, web):
876 if (doc):
877 self.url_documentation_dssi.setVisible(True)
878 self.setDocUrl(self.url_documentation_dssi, doc)
879 else: self.url_documentation_dssi.setVisible(False)
881 if (web):
882 self.url_website_dssi.setVisible(True)
883 self.setWebUrl(self.url_website_dssi, web)
884 else: self.url_website_dssi.setVisible(False)
886 if (not doc and not web):
887 self.label_no_help_dssi.setVisible(True)
888 else:
889 self.label_no_help_dssi.setVisible(False)
891 def showDoc_Bristol(self, doc, web):
892 if (doc):
893 self.url_documentation_bristol.setVisible(True)
894 self.setDocUrl(self.url_documentation_bristol, doc)
895 else: self.url_documentation_bristol.setVisible(False)
897 if (web):
898 self.url_website_bristol.setVisible(True)
899 self.setWebUrl(self.url_website_bristol, web)
900 else: self.url_website_bristol.setVisible(False)
902 if (not doc and not web):
903 self.label_no_help_bristol.setVisible(True)
904 else:
905 self.label_no_help_bristol.setVisible(False)
907 def showDoc_Effect(self, doc, web):
908 if (doc):
909 self.url_documentation_effect.setVisible(True)
910 self.setDocUrl(self.url_documentation_effect, doc)
911 else: self.url_documentation_effect.setVisible(False)
913 if (web):
914 self.url_website_effect.setVisible(True)
915 self.setWebUrl(self.url_website_effect, web)
916 else: self.url_website_effect.setVisible(False)
918 if (not doc and not web):
919 self.label_no_help_effect.setVisible(True)
920 else:
921 self.label_no_help_effect.setVisible(False)
923 def showDoc_Tool(self, doc, web):
924 if (doc):
925 self.url_documentation_tool.setVisible(True)
926 self.setDocUrl(self.url_documentation_tool, doc)
927 else: self.url_documentation_tool.setVisible(False)
929 if (web):
930 self.url_website_tool.setVisible(True)
931 self.setWebUrl(self.url_website_tool, web)
932 else: self.url_website_tool.setVisible(False)
934 if (not doc and not web):
935 self.label_no_help_tool.setVisible(True)
936 else:
937 self.label_no_help_tool.setVisible(False)
939 def openUrl(self, url):
940 os.system("xdg-open '"+str(url)+"' &")
942 def checkButtons(self):
943 if (self.test_url and self.test_selected):
944 self.b_add.setEnabled(bool(DBus.controlBus))
945 self.b_start.setEnabled(True)
946 else:
947 self.b_add.setEnabled(False)
948 self.b_start.setEnabled(False)
950 def clearAll(self):
951 self.listDAW.clearContents()
952 self.listHost.clearContents()
953 self.listInstrument.clearContents()
954 self.listDSSI.clearContents()
955 self.listBristol.clearContents()
956 self.listEffect.clearContents()
957 self.listTool.clearContents()
958 for i in range(self.listDAW.rowCount()):
959 self.listDAW.removeRow(0)
960 for i in range(self.listHost.rowCount()):
961 self.listHost.removeRow(0)
962 for i in range(self.listInstrument.rowCount()):
963 self.listInstrument.removeRow(0)
964 for i in range(self.listDSSI.rowCount()):
965 self.listDSSI.removeRow(0)
966 for i in range(self.listBristol.rowCount()):
967 self.listBristol.removeRow(0)
968 for i in range(self.listEffect.rowCount()):
969 self.listEffect.removeRow(0)
970 for i in range(self.listTool.rowCount()):
971 self.listTool.removeRow(0)
973 def getIconForYesNo(self, yesno):
974 if (yesno):
975 return "dialog-ok-apply"
976 else:
977 return "dialog-cancel"
979 def refreshAll(self):
980 self.clearAll()
982 if (not SHOW_ALL):
983 pkg_out = getoutput("dpkg -l").split("\n")
984 pkglist = []
985 for i in range(len(pkg_out)):
986 if (pkg_out[i][0] == "i" and pkg_out[i][1] == "i"):
987 package = pkg_out[i].split()[1]
988 pkglist.append(package)
990 if (not SHOW_ALL and not "ghostess" in pkglist):
991 self.tabWidget.setTabEnabled(3, False)
992 if (not SHOW_ALL and not "bristol" in pkglist):
993 self.tabWidget.setTabEnabled(4, False)
995 last_pos = 0
996 list_DAW = database.list_DAW
997 for i in range(len(list_DAW)):
998 if (SHOW_ALL or list_DAW[i][0] in pkglist):
999 AppName = list_DAW[i][1]
1000 Type = list_DAW[i][2]
1001 Binary = list_DAW[i][3]
1002 Icon = list_DAW[i][4]
1003 Save = list_DAW[i][5]
1004 Level = list_DAW[i][6]
1005 Licence = list_DAW[i][7]
1006 Features = list_DAW[i][8]
1007 Docs = list_DAW[i][9]
1009 w_icon = QTableWidgetItem("")
1010 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1011 w_name = QTableWidgetItem(AppName)
1012 w_type = QTableWidgetItem(Type)
1013 w_save = QTableWidgetItem(Save)
1014 w_licc = QTableWidgetItem(Licence)
1016 self.listDAW.insertRow(last_pos)
1017 self.listDAW.setItem(last_pos, 0, w_icon)
1018 self.listDAW.setItem(last_pos, 1, w_name)
1019 self.listDAW.setItem(last_pos, 2, w_type)
1020 self.listDAW.setItem(last_pos, 3, w_save)
1021 self.listDAW.setItem(last_pos, 4, w_licc)
1023 last_pos += 1
1025 last_pos = 0
1026 list_Host = database.list_Host
1027 for i in range(len(list_Host)):
1028 if (SHOW_ALL or list_Host[i][0] in pkglist):
1029 AppName = list_Host[i][1]
1030 Has_Ins = list_Host[i][2]
1031 Has_Eff = list_Host[i][3]
1032 Binary = list_Host[i][4]
1033 Icon = list_Host[i][5]
1034 Save = list_Host[i][6]
1035 Level = list_Host[i][7]
1036 Licence = list_Host[i][8]
1037 Features = list_Host[i][9]
1038 Docs = list_Host[i][10]
1040 w_icon = QTableWidgetItem("")
1041 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1042 w_name = QTableWidgetItem(AppName)
1043 w_h_in = QTableWidgetItem(Has_Ins)
1044 w_h_ef = QTableWidgetItem(Has_Eff)
1045 w_save = QTableWidgetItem(Save)
1046 w_licc = QTableWidgetItem(Licence)
1048 self.listHost.insertRow(last_pos)
1049 self.listHost.setItem(last_pos, 0, w_icon)
1050 self.listHost.setItem(last_pos, 1, w_name)
1051 self.listHost.setItem(last_pos, 2, w_h_in)
1052 self.listHost.setItem(last_pos, 3, w_h_ef)
1053 self.listHost.setItem(last_pos, 4, w_save)
1054 self.listHost.setItem(last_pos, 5, w_licc)
1056 last_pos += 1
1058 last_pos = 0
1059 list_Instrument = database.list_Instrument
1060 for i in range(len(list_Instrument)):
1061 if (SHOW_ALL or list_Instrument[i][0] in pkglist):
1062 AppName = list_Instrument[i][1]
1063 Type = list_Instrument[i][2]
1064 Binary = list_Instrument[i][3]
1065 Icon = list_Instrument[i][4]
1066 Save = list_Instrument[i][5]
1067 Level = list_Instrument[i][6]
1068 Licence = list_Instrument[i][7]
1069 Features = list_Instrument[i][8]
1070 Docs = list_Instrument[i][9]
1072 w_icon = QTableWidgetItem("")
1073 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1074 w_name = QTableWidgetItem(AppName)
1075 w_type = QTableWidgetItem(Type)
1076 w_save = QTableWidgetItem(Save)
1077 w_licc = QTableWidgetItem(Licence)
1079 self.listInstrument.insertRow(last_pos)
1080 self.listInstrument.setItem(last_pos, 0, w_icon)
1081 self.listInstrument.setItem(last_pos, 1, w_name)
1082 self.listInstrument.setItem(last_pos, 2, w_type)
1083 self.listInstrument.setItem(last_pos, 3, w_save)
1084 self.listInstrument.setItem(last_pos, 4, w_licc)
1086 last_pos += 1
1088 last_pos = 0
1089 list_DSSI = database.list_DSSI
1090 for i in range(len(list_DSSI)):
1091 if (SHOW_ALL or list_DSSI[i][0] in pkglist):
1092 AppName = list_DSSI[i][1]
1093 Type = list_DSSI[i][2]
1094 Binary = list_DSSI[i][3]
1095 Icon = list_DSSI[i][4]
1096 Save = list_DSSI[i][5]
1097 Level = list_DSSI[i][6]
1098 Licence = list_DSSI[i][7]
1099 Features = list_DSSI[i][8]
1100 Docs = list_DSSI[i][9]
1102 w_icon = QTableWidgetItem("")
1103 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1104 w_name = QTableWidgetItem(AppName)
1105 w_type = QTableWidgetItem(Type)
1106 w_save = QTableWidgetItem(Save)
1107 w_licc = QTableWidgetItem(Licence)
1109 self.listDSSI.insertRow(last_pos)
1110 self.listDSSI.setItem(last_pos, 0, w_icon)
1111 self.listDSSI.setItem(last_pos, 1, w_name)
1112 self.listDSSI.setItem(last_pos, 2, w_type)
1113 self.listDSSI.setItem(last_pos, 3, w_save)
1114 self.listDSSI.setItem(last_pos, 4, w_licc)
1116 last_pos += 1
1118 last_pos = 0
1119 list_Bristol = database.list_Bristol
1120 for i in range(len(list_Bristol)):
1121 if (SHOW_ALL or list_Bristol[i][0] in pkglist):
1122 FullName = list_Bristol[i][1]
1123 Type = list_Bristol[i][2]
1124 ShortName = list_Bristol[i][3]
1125 Icon = list_Bristol[i][4]
1126 Save = list_Bristol[i][5]
1127 Level = list_Bristol[i][6]
1128 Licence = list_Bristol[i][7]
1129 Features = list_Bristol[i][8]
1130 Docs = list_Bristol[i][9]
1132 w_icon = QTableWidgetItem("")
1133 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1134 w_fullname = QTableWidgetItem(FullName)
1135 w_shortname = QTableWidgetItem(ShortName)
1137 self.listBristol.insertRow(last_pos)
1138 self.listBristol.setItem(last_pos, 0, w_icon)
1139 self.listBristol.setItem(last_pos, 1, w_shortname)
1140 self.listBristol.setItem(last_pos, 2, w_fullname)
1142 last_pos += 1
1144 last_pos = 0
1145 list_Effect = database.list_Effect
1146 for i in range(len(list_Effect)):
1147 if (SHOW_ALL or list_Effect[i][0] in pkglist):
1148 AppName = list_Effect[i][1]
1149 Type = list_Effect[i][2]
1150 Binary = list_Effect[i][3]
1151 Icon = list_Effect[i][4]
1152 Save = list_Effect[i][5]
1153 Level = list_Effect[i][6]
1154 Licence = list_Effect[i][7]
1155 Features = list_Effect[i][8]
1156 Docs = list_Effect[i][9]
1158 w_icon = QTableWidgetItem("")
1159 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1160 w_name = QTableWidgetItem(AppName)
1161 w_type = QTableWidgetItem(Type)
1162 w_save = QTableWidgetItem(Save)
1163 w_licc = QTableWidgetItem(Licence)
1165 self.listEffect.insertRow(last_pos)
1166 self.listEffect.setItem(last_pos, 0, w_icon)
1167 self.listEffect.setItem(last_pos, 1, w_name)
1168 self.listEffect.setItem(last_pos, 2, w_type)
1169 self.listEffect.setItem(last_pos, 3, w_save)
1170 self.listEffect.setItem(last_pos, 4, w_licc)
1172 last_pos += 1
1174 last_pos = 0
1175 list_Tool = database.list_Tool
1176 for i in range(len(list_Tool)):
1177 if (SHOW_ALL or list_Tool[i][0] in pkglist):
1178 AppName = list_Tool[i][1]
1179 Type = list_Tool[i][2]
1180 Binary = list_Tool[i][3]
1181 Icon = list_Tool[i][4]
1182 Save = list_Tool[i][5]
1183 Level = list_Tool[i][6]
1184 Licence = list_Tool[i][7]
1185 Features = list_Tool[i][8]
1186 Docs = list_Tool[i][9]
1188 w_icon = QTableWidgetItem("")
1189 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1190 w_name = QTableWidgetItem(AppName)
1191 w_type = QTableWidgetItem(Type)
1192 w_save = QTableWidgetItem(Save)
1193 w_licc = QTableWidgetItem(Licence)
1195 self.listTool.insertRow(last_pos)
1196 self.listTool.setItem(last_pos, 0, w_icon)
1197 self.listTool.setItem(last_pos, 1, w_name)
1198 self.listTool.setItem(last_pos, 2, w_type)
1199 self.listTool.setItem(last_pos, 3, w_save)
1200 self.listTool.setItem(last_pos, 4, w_licc)
1202 last_pos += 1
1205 self.listDAW.setCurrentCell(-1, -1)
1206 self.listHost.setCurrentCell(-1, -1)
1207 self.listInstrument.setCurrentCell(-1, -1)
1208 self.listDSSI.setCurrentCell(-1, -1)
1209 self.listBristol.setCurrentCell(-1, -1)
1210 self.listEffect.setCurrentCell(-1, -1)
1211 self.listTool.setCurrentCell(-1, -1)
1213 self.listDAW.sortByColumn(1, Qt.AscendingOrder)
1214 self.listHost.sortByColumn(1, Qt.AscendingOrder)
1215 self.listInstrument.sortByColumn(1, Qt.AscendingOrder)
1216 self.listDSSI.sortByColumn(1, Qt.AscendingOrder)
1217 self.listBristol.sortByColumn(2, Qt.AscendingOrder)
1218 self.listEffect.sortByColumn(1, Qt.AscendingOrder)
1219 self.listTool.sortByColumn(1, Qt.AscendingOrder)
1221 def saveSettings(self):
1222 self.settings.setValue("Geometry", QVariant(self.saveGeometry()))
1223 self.settings.setValue("SplitterDAW", self.splitter_DAW.saveState())
1224 self.settings.setValue("SplitterHost", self.splitter_Host.saveState())
1225 self.settings.setValue("SplitterInstrument", self.splitter_Instrument.saveState())
1226 self.settings.setValue("SplitterDSSI", self.splitter_DSSI.saveState())
1227 self.settings.setValue("SplitterBristol", self.splitter_Bristol.saveState())
1228 self.settings.setValue("SplitterEffect", self.splitter_Effect.saveState())
1229 self.settings.setValue("SplitterTool", self.splitter_Tool.saveState())
1231 def loadSettings(self):
1232 self.restoreGeometry(self.settings.value("Geometry").toByteArray())
1233 self.splitter_DAW.restoreState(self.settings.value("SplitterDAW").toByteArray())
1234 self.splitter_Host.restoreState(self.settings.value("SplitterHost").toByteArray())
1235 self.splitter_Instrument.restoreState(self.settings.value("SplitterInstrument").toByteArray())
1236 self.splitter_DSSI.restoreState(self.settings.value("SplitterDSSI").toByteArray())
1237 self.splitter_Bristol.restoreState(self.settings.value("SplitterBristol").toByteArray())
1238 self.splitter_Effect.restoreState(self.settings.value("SplitterEffect").toByteArray())
1239 self.splitter_Tool.restoreState(self.settings.value("SplitterTool").toByteArray())
1241 def closeEvent(self, event):
1242 self.saveSettings()
1243 event.accept()