Update, to sync with Claudia from Cadence
[klaudia.git] / src / w_klaudia.py
blob457f44326ea6e38a686e404d666f6c1dde6a902b
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("SplitterGhostess")):
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_Ghostess.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.setWindowIcon(QIcon.fromTheme("klaudia", QIcon(self.MyIcons.getIconPath("klaudia"))))
76 self.b_start.setIcon(QIcon.fromTheme("go-next", QIcon(self.MyIcons.getIconPath("go-next"))))
77 self.b_add.setIcon(QIcon.fromTheme("list-add", QIcon(self.MyIcons.getIconPath("list-add"))))
78 self.b_refresh.setIcon(QIcon.fromTheme("view-refresh", QIcon(self.MyIcons.getIconPath("view-refresh"))))
79 self.b_open.setIcon(QIcon.fromTheme("document-open", QIcon(self.MyIcons.getIconPath("document-open"))))
80 self.b_start.setEnabled(False)
81 self.b_add.setEnabled(False)
83 self.listDAW.setColumnWidth(0, 22)
84 self.listDAW.setColumnWidth(1, 150)
85 self.listDAW.setColumnWidth(2, 125)
87 self.listHost.setColumnWidth(0, 22)
88 self.listHost.setColumnWidth(1, 150)
90 self.listInstrument.setColumnWidth(0, 22)
91 self.listInstrument.setColumnWidth(1, 150)
92 self.listInstrument.setColumnWidth(2, 125)
94 self.listGhostess.setColumnWidth(0, 22)
95 self.listGhostess.setColumnWidth(1, 280)
97 self.listBristol.setColumnWidth(0, 22)
98 self.listBristol.setColumnWidth(1, 100)
100 self.listEffect.setColumnWidth(0, 22)
101 self.listEffect.setColumnWidth(1, 225)
102 self.listEffect.setColumnWidth(2, 125)
104 self.listTool.setColumnWidth(0, 22)
105 self.listTool.setColumnWidth(1, 225)
106 self.listTool.setColumnWidth(2, 125)
108 self.listDAW.setContextMenuPolicy(Qt.CustomContextMenu)
109 self.listHost.setContextMenuPolicy(Qt.CustomContextMenu)
110 self.listInstrument.setContextMenuPolicy(Qt.CustomContextMenu)
111 self.listGhostess.setContextMenuPolicy(Qt.CustomContextMenu)
112 self.listBristol.setContextMenuPolicy(Qt.CustomContextMenu)
113 self.listEffect.setContextMenuPolicy(Qt.CustomContextMenu)
114 self.listTool.setContextMenuPolicy(Qt.CustomContextMenu)
116 self.co_sample_rate.addItem(str(DBus.jackBus.GetSampleRate()))
117 self.b_refresh.setText("")
119 self.studio_root_folder = QString(os.getenv("HOME"))
120 self.le_url.setText(self.studio_root_folder)
121 self.test_url = True
122 self.test_selected = False
124 self.clearInfo_DAW()
125 self.clearInfo_Host()
126 self.clearInfo_Intrument()
127 self.clearInfo_Ghostess()
128 self.clearInfo_Bristol()
129 self.clearInfo_Effect()
130 self.clearInfo_Tool()
132 self.refreshAll()
133 self.refreshStudioList()
135 if (DBus.controlBus):
136 self.enableLADISH(True)
138 self.connect(self.b_start, SIGNAL("clicked()"), self.startApp)
139 self.connect(self.b_add, SIGNAL("clicked()"), self.addApp)
140 self.connect(self.b_refresh, SIGNAL("clicked()"), self.refreshStudioList)
142 self.connect(self.co_ladi_room, SIGNAL("currentIndexChanged(int)"), self.checkSelectedRoom)
143 self.connect(self.groupLADISH, SIGNAL("toggled(bool)"), self.enableLADISH)
145 self.connect(self.le_url, SIGNAL("textChanged(QString)"), self.checkFolderUrl)
146 self.connect(self.tabWidget, SIGNAL("currentChanged(int)"), self.checkSelectedTab)
148 self.connect(self.listDAW, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedDAW)
149 self.connect(self.listHost, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedHost)
150 self.connect(self.listInstrument, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedInstrument)
151 self.connect(self.listGhostess, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedGhostess)
152 self.connect(self.listBristol, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedBristol)
153 self.connect(self.listEffect, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedEffect)
154 self.connect(self.listTool, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedTool)
155 self.connect(self.listDAW, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListDAW)
156 self.connect(self.listHost, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListHost)
157 self.connect(self.listInstrument, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListInstrument)
158 self.connect(self.listGhostess, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListGhostess)
159 self.connect(self.listBristol, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListBristol)
160 self.connect(self.listEffect, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListEffect)
161 self.connect(self.listTool, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListTool)
163 self.connect(self.url_documentation_daw, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
164 self.connect(self.url_website_daw, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
165 self.connect(self.url_documentation_host, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
166 self.connect(self.url_website_host, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
167 self.connect(self.url_documentation_ins, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
168 self.connect(self.url_website_ins, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
169 self.connect(self.url_documentation_ghostess, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
170 self.connect(self.url_website_ghostess, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
171 self.connect(self.url_documentation_bristol, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
172 self.connect(self.url_website_bristol, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
173 self.connect(self.url_documentation_effect, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
174 self.connect(self.url_website_effect, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
175 self.connect(self.url_documentation_tool, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
176 self.connect(self.url_website_tool, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
178 self.connect(self.b_open, SIGNAL("clicked()"), lambda: getAndSetPath(self, self.le_url.text(), self.le_url))
180 def refreshStudioList(self):
181 self.co_ladi_room.clear()
182 self.co_ladi_room.addItem("<Studio Root>")
183 if (DBus.controlBus):
184 studio_bus = DBus.loopBus.get_object("org.ladish", "/org/ladish/Studio")
185 studio_list_dump = studio_bus.GetRoomList()
186 for i in range(len(studio_list_dump)):
187 self.co_ladi_room.addItem(str(studio_list_dump[i][0]).replace("/org/ladish/Room","")+" - "+studio_list_dump[i][1]['name'])
189 def checkSelectedRoom(self, co_n):
190 if (co_n == -1 or not DBus.controlBus):
191 print "going -1"
192 elif (co_n == 0):
193 print "selected studio room"
194 DBus.studioBus = DBus.loopBus.get_object("org.ladish", "/org/ladish/Studio")
195 DBus.appBus = dbus.Interface(DBus.studioBus, 'org.ladish.AppSupervisor')
196 self.b_open.setEnabled(True)
197 self.le_url.setEnabled(True)
198 self.le_url.setText(self.studio_root_folder)
199 else:
200 print "selected a room", co_n
201 room_name = "/org/ladish/Room"+QStringStr(self.co_ladi_room.currentText().split(" ")[0])
202 DBus.studioBus = DBus.loopBus.get_object("org.ladish", room_name)
203 DBus.appBus = dbus.Interface(DBus.studioBus, 'org.ladish.AppSupervisor')
204 room_properties = DBus.studioBus.GetProjectProperties()
205 if (len(room_properties[1])):
206 self.b_open.setEnabled(False)
207 self.le_url.setEnabled(False)
208 self.le_url.setText(QString(room_properties[1]['dir']))
209 else:
210 self.b_open.setEnabled(True)
211 self.le_url.setEnabled(True)
212 self.studio_root_folder = self.le_url.text()
214 def enableLADISH(self, really):
215 if (really):
216 self.groupLADISH.setCheckable(False)
217 self.groupLADISH.setTitle(self.tr("LADISH is enabled"))
219 DBus.controlBus = DBus.loopBus.get_object("org.ladish", "/org/ladish/Control")
220 DBus.studioBus = DBus.loopBus.get_object("org.ladish", "/org/ladish/Studio")
221 DBus.appBus = dbus.Interface(DBus.studioBus, 'org.ladish.AppSupervisor')
223 self.refreshStudioList()
224 self.checkButtons()
226 def getSelectedApp(self):
227 tab = self.tabWidget.currentIndex()
228 if (tab == 0):
229 listSel = self.listDAW
230 elif (tab == 1):
231 listSel = self.listHost
232 elif (tab == 2):
233 listSel = self.listInstrument
234 elif (tab == 3):
235 listSel = self.listGhostess
236 elif (tab == 4):
237 listSel = self.listBristol
238 elif (tab == 5):
239 listSel = self.listEffect
240 elif (tab == 6):
241 listSel = self.listTool
242 else:
243 return ""
245 return listSel.item(listSel.currentRow(), 1 if (tab != 4) else 2).text()
247 def getBinaryFromAppName(self, appname):
248 list_DAW = database.list_DAW
249 for i in range(len(list_DAW)):
250 if (appname == list_DAW[i][1]):
251 binary = list_DAW[i][3]
252 break
254 list_Host = database.list_Host
255 for i in range(len(list_Host)):
256 if (appname == list_Host[i][1]):
257 binary = list_Host[i][4]
258 break
260 list_Instrument = database.list_Instrument
261 for i in range(len(list_Instrument)):
262 if (appname == list_Instrument[i][1]):
263 binary = list_Instrument[i][3]
264 break
266 list_Ghostess = database.list_Ghostess
267 for i in range(len(list_Ghostess)):
268 if (appname == list_Ghostess[i][1]):
269 binary = "ghostess "+list_Ghostess[i][3]+" -hostname "+list_Ghostess[i][3].split(":")[1].replace(" ","_")
270 break
272 list_Bristol = database.list_Bristol
273 for i in range(len(list_Bristol)):
274 if (appname == list_Bristol[i][1]):
275 binary = "startBristol -audio jack -midi jack -"+list_Bristol[i][3]
276 break
278 list_Effect = database.list_Effect
279 for i in range(len(list_Effect)):
280 if (appname == list_Effect[i][1]):
281 binary = list_Effect[i][3]
282 break
284 list_Tool = database.list_Tool
285 for i in range(len(list_Tool)):
286 if (appname == list_Tool[i][1]):
287 binary = list_Tool[i][3]
288 break
290 if (binary):
291 return binary
292 else:
293 print "Error here, cod.002"
294 return ""
296 def doubleClickedListDAW(self, row, column):
297 app = self.listDAW.item(row, 1).text()
298 self.startApp(app)
300 def doubleClickedListHost(self, row, column):
301 app = self.listHost.item(row, 1).text()
302 self.startApp(app)
304 def doubleClickedListInstrument(self, row, column):
305 app = self.listInstrument.item(row, 1).text()
306 self.startApp(app)
308 def doubleClickedListGhostess(self, row, column):
309 app = self.listGhostess.item(row, 1).text()
310 self.startApp(app)
312 def doubleClickedListBristol(self, row, column):
313 app = self.listBristol.item(row, 2).text()
314 self.startApp(app)
316 def doubleClickedListEffect(self, row, column):
317 app = self.listEffect.item(row, 1).text()
318 self.startApp(app)
320 def doubleClickedListTool(self, row, column):
321 app = self.listTool.item(row, 1).text()
322 self.startApp(app)
324 def startApp(self, app=None):
325 if (not app):
326 app = self.getSelectedApp()
327 binary = self.getBinaryFromAppName(app)
328 os.system("cd "+QStringStr(self.le_url.text())+" && "+binary+" &")
330 def addApp(self):
331 app = self.getSelectedApp()
332 binary = self.getBinaryFromAppName(app)
334 ran_check = str(randint(1, 99999))
335 sample_rate = str(self.co_sample_rate.currentText())
336 url_folder = QStringStr(self.le_url.text())
337 proj_bpm = str(self.sb_bpm.text())
339 if (url_folder[-1] != "/"):
340 url_folder += "/"
342 if (binary.split(" ")[0] == "startBristol"):
343 synth = binary.split("-audio jack -midi jack -")[1]
344 proj_folder = url_folder+"bristol_"+synth+"_"+ran_check
345 os.mkdir(proj_folder)
346 if (not self.le_url.isEnabled()): proj_folder = proj_folder.replace(url_folder,"")
347 cmd = binary+" -emulate "+synth+" -cache "+proj_folder+" -memdump "+proj_folder+" -import "+proj_folder+"/memory -exec"
348 DBus.appBus.RunCustom(False, cmd, str(app), 1)
350 elif (app == "Ardour" or app == "ArdourVST" or app == "ArdourVST (32bit)"):
351 proj_folder = url_folder+"Ardour2_"+ran_check
352 os.mkdir(proj_folder)
353 os.system("cp "+sys.path[0]+"/../templates/Ardour2/* '"+proj_folder+"'")
354 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_folder+'/Ardour2.ardour"')
355 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_folder+'/Ardour2.ardour"')
356 os.system("cd '"+proj_folder+"' && mv Ardour2.ardour Ardour2_"+ran_check+".ardour")
357 os.mkdir(proj_folder+"/analysis")
358 os.mkdir(proj_folder+"/dead_sounds")
359 os.mkdir(proj_folder+"/export")
360 os.mkdir(proj_folder+"/interchange")
361 os.mkdir(proj_folder+"/interchange/Ardour")
362 os.mkdir(proj_folder+"/interchange/Ardour/audiofiles")
363 os.mkdir(proj_folder+"/peaks")
364 if (not self.le_url.isEnabled()): proj_folder = proj_folder.replace(url_folder,"")
365 DBus.appBus.RunCustom(False, binary+" '"+proj_folder+"'", str(app), 1)
366 elif (app == "Hydrogen" or app == "Hydrogen (SVN)"):
367 if (app == "Hydrogen (SVN)"):
368 level = 1
369 else:
370 level = 0
371 proj_file = url_folder+"Hydrogen_"+ran_check+".h2song"
372 os.system("cp "+sys.path[0]+"/../templates/Hydrogen.h2song '"+proj_file+"'")
373 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'"')
374 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
375 DBus.appBus.RunCustom(False, "hydrogen -s '"+proj_file+"'", str(app), level)
376 elif (app == "MusE" or app == "MusE (SVN)"):
377 proj_file = url_folder+"MusE_"+ran_check+".med"
378 os.system("cp "+sys.path[0]+"/../templates/MusE.med '"+proj_file+"'")
379 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
380 DBus.appBus.RunCustom(False, "muse '"+proj_file+"'", str(app), 0)
381 elif (app == "Non-DAW"):
382 proj_file = url_folder+"Non-DAW_"+ran_check
383 os.system("cp -r "+sys.path[0]+"/../templates/Non-DAW '"+proj_file+"'")
384 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'/history"')
385 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'/info"')
386 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
387 DBus.appBus.RunCustom(False, "non-daw '"+proj_file+"'", str(app), 0)
388 elif (app == "Non-Sequencer"):
389 proj_file = url_folder+"Non-Sequencer_"+ran_check+".non"
390 os.system("cp "+sys.path[0]+"/../templates/Non-Sequencer.non '"+proj_file+"'")
391 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
392 DBus.appBus.RunCustom(False, "non-sequencer '"+proj_file+"'", str(app), 0)
393 elif (app == "Qtractor" or app == "QtractorVST" or app == "QtractorVST (32bit)" or app == "Qtractor (SVN)"):
394 proj_file = url_folder+"Qtractor_"+ran_check+".qtr"
395 os.system("cp "+sys.path[0]+"/../templates/Qtractor.qtr '"+proj_file+"'")
396 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'"')
397 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'"')
398 os.system('sed -i "s/X_FOLDER_X-KLAUDIA-X_FOLDER_X/'+url_folder.replace("/","\/")+'/" "'+proj_file+'"')
399 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
400 DBus.appBus.RunCustom(False, binary+" '"+proj_file+"'", str(app), 1)
401 elif (app == "Renoise" or app == "Renoise (64bit)"):
402 os.mkdir(url_folder+"tmp_bu")
403 os.system("cp "+sys.path[0]+"/../templates/Renoise.xml "+url_folder+"/tmp_bu")
404 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+url_folder+'/tmp_bu/Renoise.xml"')
405 os.system("cd '"+url_folder+"tmp_bu' && mv Renoise.xml Song.xml && zip ../Renoise_"+ran_check+".xrns Song.xml")
406 os.system("rm -rf '"+url_folder+"tmp_bu'")
407 if (not self.le_url.isEnabled()): url_folder = ""
408 DBus.appBus.RunCustom(False, binary+" '"+url_folder+"Renoise_"+ran_check+".xrns'", str(app), 0)
409 elif (app == "Rosegarden"):
410 proj_file = url_folder+"Rosegarden_"+ran_check+".rg"
411 os.system("cp "+sys.path[0]+"/../templates/Rosegarden.rg '"+proj_file+"'")
412 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'"')
413 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
414 DBus.appBus.RunCustom(False, "rosegarden '"+proj_file+"'", str(app), 1)
415 elif (app == "Seq24"):
416 proj_file = url_folder+"Seq24_"+ran_check+".midi"
417 os.system("cp "+sys.path[0]+"/../templates/Seq24.midi '"+proj_file+"'")
418 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
419 DBus.appBus.RunCustom(False, "seq24 --file '"+proj_file+"'", str(app), 1)
421 elif (app == "Calf Jack Host (GIT)"):
422 proj_file = url_folder+"CalfJackHost_"+ran_check
423 os.system("cp "+sys.path[0]+"/../templates/CalfJackHost '"+proj_file+"'")
424 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
425 DBus.appBus.RunCustom(False, "calfjackhost --load '"+proj_file+"'", str(app), 1)
426 elif (app == "FeSTige"):
427 room_name = ""
428 if (self.co_ladi_room.currentIndex() > 0):
429 room_name = '"' + QStringStr(self.co_ladi_room.currentText()).split(" - ")[1] + '"'
430 DBus.appBus.RunCustom(False, "festige "+url_folder+" "+room_name, str(app), 0)
431 #elif (app == "Ingen" or app == "Ingen (SVN)"):
432 #if (app == "Ingen (SVN)"):
433 #binary = "ingen-svn"
434 #else:
435 #binary = "ingen"
436 #proj_file = url_folder+"/"+"ingen_"+ran_check+".ing.lv2"
437 #os.system("cp -r "+sys.path[0]+"/../templates/ingen.ing.lv2 '"+proj_file+"'")
438 #if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
439 #DBus.appBus.RunCustom(False, binary+" -egl '"+proj_file+"'", str(app), 0)
440 elif (app == "Jack Rack"):
441 proj_file = url_folder+"Jack-Rack_"+ran_check+".xml"
442 os.system("cp "+sys.path[0]+"/../templates/Jack-Rack.xml '"+proj_file+"'")
443 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'"')
444 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
445 DBus.appBus.RunCustom(False, "jack-rack -s '"+str(app)+"' '"+proj_file+"'", str(app), 0)
447 elif (app == "Qsampler" or app == "Qsampler (SVN)"):
448 if (app == "Qsampler (SVN)"):
449 level = 1
450 else:
451 level = 0
452 proj_file = url_folder+"Qsampler_"+ran_check+".lscp"
453 os.system("cp "+sys.path[0]+"/../templates/Qsampler.lscp '"+proj_file+"'")
454 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
455 DBus.appBus.RunCustom(False, "qsampler '"+proj_file+"'", str(app), level)
456 elif (app == "Yoshimi"):
457 proj_file = url_folder+"Yoshimi_"+ran_check+".state"
458 os.system("cp "+sys.path[0]+"/../templates/Yoshimi.state '"+proj_file+"'")
459 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'"')
460 os.system('sed -i "s/X_FILE_X-KLAUDIA-X_FILE_X/'+proj_file.replace("/","\/")+'/" "'+proj_file+'"')
461 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
462 DBus.appBus.RunCustom(False, "yoshimi -j -J --state='"+proj_file+"'", str(app), 1)
464 elif (app == "Jamin"):
465 proj_file = url_folder+"Jamin_"+ran_check+".jam"
466 os.system("cp "+sys.path[0]+"/../templates/Jamin.jam '"+proj_file+"'")
467 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
468 DBus.appBus.RunCustom(False, "jamin -f '"+proj_file+"'", str(app), 0)
470 elif (app == "Jack Mixer"):
471 proj_file = url_folder+"Jack-Mixer_"+ran_check+".xml"
472 os.system("cp "+sys.path[0]+"/../templates/Jack-Mixer.xml '"+proj_file+"'")
473 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
474 DBus.appBus.RunCustom(False, "jack_mixer -c '"+proj_file+"'", str(app), 1)
475 elif (app == "Non-Mixer"):
476 proj_file = url_folder+"Non-Mixer_"+ran_check
477 os.system("cp -r "+sys.path[0]+"/../templates/Non-Mixer '"+proj_file+"'")
478 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
479 DBus.appBus.RunCustom(False, "non-mixer '"+proj_file+"'", str(app), 0)
481 else:
482 DBus.appBus.RunCustom(False, binary, str(app), 0)
484 def clearInfo_DAW(self):
485 self.ico_app_daw.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
486 self.label_name_daw.setText("App Name")
487 self.ico_ladspa_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
488 self.ico_dssi_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
489 self.ico_lv2_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
490 self.ico_vst_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
491 self.label_vst_mode_daw.setText("")
492 self.ico_jack_transport_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
493 self.label_midi_mode_daw.setText("---")
494 self.label_ladish_level_daw.setText("0")
495 self.showDoc_DAW(0, 0)
496 self.frame_DAW.setEnabled(False)
498 def clearInfo_Host(self):
499 self.ico_app_host.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
500 self.label_name_host.setText("App Name")
501 self.ico_ladspa_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
502 self.ico_dssi_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
503 self.ico_lv2_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
504 self.ico_vst_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
505 self.label_vst_mode_host.setText("")
506 self.label_midi_mode_host.setText("---")
507 self.label_ladish_level_host.setText("0")
508 self.showDoc_Host(0, 0)
509 self.frame_Host.setEnabled(False)
511 def clearInfo_Intrument(self):
512 self.ico_app_ins.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
513 self.label_name_ins.setText("App Name")
514 self.ico_builtin_fx_ins.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
515 self.ico_audio_input_ins.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
516 self.label_midi_mode_ins.setText("---")
517 self.label_ladish_level_ins.setText("0")
518 self.showDoc_Instrument(0, 0)
519 self.frame_Instrument.setEnabled(False)
521 def clearInfo_Ghostess(self):
522 self.ico_app_ghostess.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
523 self.label_name_ghostess.setText("App Name")
524 self.ico_builtin_fx_ghostess.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
525 self.ico_stereo_ghostess.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
526 self.label_midi_mode_ghostess.setText("---")
527 self.label_ladish_level_ghostess.setText("0")
528 self.showDoc_Ghostess(0, 0)
529 self.frame_Ghostess.setEnabled(False)
531 def clearInfo_Bristol(self):
532 self.ico_app_bristol.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
533 self.label_name_bristol.setText("App Name")
534 self.ico_builtin_fx_bristol.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
535 self.ico_audio_input_bristol.setPixmap(QIcon("dialog-cancel").pixmap(16, 16))
536 self.label_midi_mode_bristol.setText("---")
537 self.label_ladish_level_bristol.setText("0")
538 self.showDoc_Bristol(0, 0)
539 self.frame_Bristol.setEnabled(False)
541 def clearInfo_Effect(self):
542 self.ico_app_effect.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
543 self.label_name_effect.setText("App Name")
544 self.ico_stereo_effect.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
545 self.label_midi_mode_effect.setText("---")
546 self.label_ladish_level_effect.setText("0")
547 self.showDoc_Effect(0, 0)
548 self.frame_Effect.setEnabled(False)
550 def clearInfo_Tool(self):
551 self.ico_app_tool.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
552 self.label_name_tool.setText("App Name")
553 self.label_midi_mode_tool.setText("---")
554 self.label_ladish_level_tool.setText("0")
555 self.showDoc_Tool(0, 0)
556 self.frame_Tool.setEnabled(False)
558 def checkFolderUrl(self, url):
559 if (os.path.exists(QStringStr(url))):
560 self.test_url = True
561 if (self.le_url.isEnabled()):
562 self.studio_root_folder = url
563 else:
564 self.test_url = False
565 self.checkButtons()
567 def checkSelectedTab(self, tab):
568 self.test_selected = False
569 if (tab == 0): # DAW
570 if (self.listDAW.selectedItems()):
571 self.test_selected = True
572 elif (tab == 1): # Host
573 if (self.listHost.selectedItems()):
574 self.test_selected = True
575 elif (tab == 2): # Instrument
576 if (self.listInstrument.selectedItems()):
577 self.test_selected = True
578 elif (tab == 3): # Ghostess
579 if (self.listGhostess.selectedItems()):
580 self.test_selected = True
581 elif (tab == 4): # Bristol
582 if (self.listBristol.selectedItems()):
583 self.test_selected = True
584 elif (tab == 5): # Effect
585 if (self.listEffect.selectedItems()):
586 self.test_selected = True
587 elif (tab == 6): # Tool
588 if (self.listTool.selectedItems()):
589 self.test_selected = True
591 self.checkButtons()
593 def checkSelectedDAW(self, row, column, p_row, p_column):
594 if (row >= 0):
595 self.test_selected = True
597 app_name = self.listDAW.item(row, 1).text()
598 app_info = []
599 list_DAW = database.list_DAW
601 for i in range(len(list_DAW)):
602 if (app_name == list_DAW[i][1]):
603 app_info = list_DAW[i]
604 break
606 if (not app_info):
607 print "Error here, cod.001"
608 return
610 self.frame_DAW.setEnabled(True)
611 self.ico_app_daw.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
612 self.ico_ladspa_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
613 self.ico_dssi_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
614 self.ico_lv2_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][2]), 16)).pixmap(16, 16))
615 self.ico_vst_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][3]), 16)).pixmap(16, 16))
616 self.ico_jack_transport_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][5]), 16)).pixmap(16, 16))
617 self.label_name_daw.setText(app_info[1])
618 self.label_vst_mode_daw.setText(app_info[8][4])
619 self.ico_midi_mode_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][6]), 16)).pixmap(16, 16))
620 self.label_midi_mode_daw.setText(app_info[8][7])
621 self.label_ladish_level_daw.setText(str(app_info[6]))
623 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
624 self.showDoc_DAW(doc, app_info[9][1])
625 else:
626 self.test_selected = False
627 self.clearInfo_DAW()
628 self.checkButtons()
630 def checkSelectedHost(self, row, column, p_row, p_column):
631 if (row >= 0):
632 self.test_selected = True
634 app_name = self.listHost.item(row, 1).text()
635 app_info = []
636 list_Host = database.list_Host
638 for i in range(len(list_Host)):
639 if (app_name == list_Host[i][1]):
640 app_info = list_Host[i]
641 break
643 if (not app_info):
644 print "Error here, cod.003"
645 return
647 self.frame_Host.setEnabled(True)
648 self.ico_app_host.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[5], 48)).pixmap(48, 48))
649 self.ico_internal_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][0]), 16)).pixmap(16, 16))
650 self.ico_ladspa_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][1]), 16)).pixmap(16, 16))
651 self.ico_dssi_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][2]), 16)).pixmap(16, 16))
652 self.ico_lv2_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][3]), 16)).pixmap(16, 16))
653 self.ico_vst_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][4]), 16)).pixmap(16, 16))
654 self.label_name_host.setText(app_info[1])
655 self.label_vst_mode_host.setText(app_info[9][5])
656 self.label_midi_mode_host.setText(app_info[9][6])
657 self.label_ladish_level_host.setText(str(app_info[7]))
659 doc = app_info[10][0] if (os.path.exists(app_info[10][0].replace("file://",""))) else ""
660 self.showDoc_Host(doc, app_info[10][1])
661 else:
662 self.test_selected = False
663 self.clearInfo_DAW()
664 self.checkButtons()
666 def checkSelectedInstrument(self, row, column, p_row, p_column):
667 if (row >= 0):
668 self.test_selected = True
670 app_name = self.listInstrument.item(row, 1).text()
671 app_info = []
672 list_Instrument = database.list_Instrument
674 for i in range(len(list_Instrument)):
675 if (app_name == list_Instrument[i][1]):
676 app_info = list_Instrument[i]
677 break
679 if (not app_info):
680 print "Error here, cod.004"
681 return
683 self.frame_Instrument.setEnabled(True)
684 self.ico_app_ins.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
685 self.ico_builtin_fx_ins.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
686 self.ico_audio_input_ins.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
687 self.label_name_ins.setText(app_info[1])
688 self.label_midi_mode_ins.setText(app_info[8][2])
689 self.label_ladish_level_ins.setText(str(app_info[6]))
691 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
692 self.showDoc_Instrument(doc, app_info[9][1])
693 else:
694 self.test_selected = False
695 self.clearInfo_Intrument()
696 self.checkButtons()
698 def checkSelectedGhostess(self, row, column, p_row, p_column):
699 if (row >= 0):
700 self.test_selected = True
702 app_name = self.listGhostess.item(row, 1).text()
703 app_info = []
704 list_Ghostess = database.list_Ghostess
706 for i in range(len(list_Ghostess)):
707 if (app_name == list_Ghostess[i][1]):
708 app_info = list_Ghostess[i]
709 break
711 if (not app_info):
712 print "Error here, cod.004"
713 return
715 self.frame_Ghostess.setEnabled(True)
716 self.ico_app_ghostess.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
717 self.ico_builtin_fx_ghostess.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
718 self.ico_stereo_ghostess.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
719 self.label_name_ghostess.setText(app_info[1])
720 self.label_midi_mode_ghostess.setText(app_info[8][2])
721 self.label_ladish_level_ghostess.setText(str(app_info[6]))
723 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
724 self.showDoc_Ghostess(doc, app_info[9][1])
725 else:
726 self.test_selected = False
727 self.clearInfo_Ghostess()
728 self.checkButtons()
730 def checkSelectedBristol(self, row, column, p_row, p_column):
731 if (row >= 0):
732 self.test_selected = True
734 app_name = self.listBristol.item(row, 2).text()
735 app_info = []
736 list_Bristol = database.list_Bristol
738 for i in range(len(list_Bristol)):
739 if (app_name == list_Bristol[i][1]):
740 app_info = list_Bristol[i]
741 break
743 if (not app_info):
744 print "Error here, cod.007"
745 return
747 self.frame_Bristol.setEnabled(True)
748 self.ico_app_bristol.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
749 self.ico_builtin_fx_bristol.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
750 self.ico_audio_input_bristol.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
751 self.label_name_bristol.setText(app_info[1])
752 self.label_midi_mode_bristol.setText(app_info[8][2])
753 self.label_ladish_level_bristol.setText(str(app_info[6]))
755 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
756 self.showDoc_Bristol(doc, app_info[9][1])
757 else:
758 self.test_selected = False
759 self.clearInfo_Bristol()
760 self.checkButtons()
762 def checkSelectedEffect(self, row, column, p_row, p_column):
763 if (row >= 0):
764 self.test_selected = True
766 app_name = self.listEffect.item(row, 1).text()
767 app_info = []
768 list_Effect = database.list_Effect
770 for i in range(len(list_Effect)):
771 if (app_name == list_Effect[i][1]):
772 app_info = list_Effect[i]
773 break
775 if (not app_info):
776 print "Error here, cod.005"
777 return
779 self.frame_Effect.setEnabled(True)
780 self.ico_app_effect.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
781 self.ico_stereo_effect.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
782 self.label_name_effect.setText(app_info[1])
783 self.label_midi_mode_effect.setText(app_info[8][1])
784 self.label_ladish_level_effect.setText(str(app_info[6]))
786 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
787 self.showDoc_Effect(doc, app_info[9][1])
788 else:
789 self.test_selected = False
790 self.clearInfo_Effect()
791 self.checkButtons()
793 def checkSelectedTool(self, row, column, p_row, p_column):
794 if (row >= 0):
795 self.test_selected = True
797 app_name = self.listTool.item(row, 1).text()
798 app_info = []
799 list_Tool = database.list_Tool
801 for i in range(len(list_Tool)):
802 if (app_name == list_Tool[i][1]):
803 app_info = list_Tool[i]
804 break
806 if (not app_info):
807 print "Error here, cod.006"
808 return
810 self.frame_Tool.setEnabled(True)
811 self.ico_app_tool.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
812 self.label_name_tool.setText(app_info[1])
813 self.label_midi_mode_tool.setText(app_info[8][0])
814 self.ico_jack_transport_tool.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
815 self.label_ladish_level_tool.setText(str(app_info[6]))
817 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
818 self.showDoc_Tool(doc, app_info[9][1])
819 else:
820 self.test_selected = False
821 self.clearInfo_Tool()
822 self.checkButtons()
824 def setDocUrl(self, item, link):
825 item.setText(self.tr("<a href='%1'>Documentation</a>").arg(link))
827 def setWebUrl(self, item, link):
828 item.setText(self.tr("<a href='%1'>WebSite</a>").arg(link))
830 def showDoc_DAW(self, doc, web):
831 if (doc):
832 self.url_documentation_daw.setVisible(True)
833 self.setDocUrl(self.url_documentation_daw, doc)
834 else: self.url_documentation_daw.setVisible(False)
836 if (web):
837 self.url_website_daw.setVisible(True)
838 self.setWebUrl(self.url_website_daw, web)
839 else: self.url_website_daw.setVisible(False)
841 if (not doc and not web):
842 self.label_no_help_daw.setVisible(True)
843 else:
844 self.label_no_help_daw.setVisible(False)
846 def showDoc_Host(self, doc, web):
847 if (doc):
848 self.url_documentation_host.setVisible(True)
849 self.setDocUrl(self.url_documentation_host, doc)
850 else: self.url_documentation_host.setVisible(False)
852 if (web):
853 self.url_website_host.setVisible(True)
854 self.setWebUrl(self.url_website_host, web)
855 else: self.url_website_host.setVisible(False)
857 if (not doc and not web):
858 self.label_no_help_host.setVisible(True)
859 else:
860 self.label_no_help_host.setVisible(False)
862 def showDoc_Instrument(self, doc, web):
863 if (doc):
864 self.url_documentation_ins.setVisible(True)
865 self.setDocUrl(self.url_documentation_ins, doc)
866 else: self.url_documentation_ins.setVisible(False)
868 if (web):
869 self.url_website_ins.setVisible(True)
870 self.setWebUrl(self.url_website_ins, web)
871 else: self.url_website_ins.setVisible(False)
873 if (not doc and not web):
874 self.label_no_help_ins.setVisible(True)
875 else:
876 self.label_no_help_ins.setVisible(False)
878 def showDoc_Ghostess(self, doc, web):
879 if (doc):
880 self.url_documentation_ghostess.setVisible(True)
881 self.setDocUrl(self.url_documentation_ghostess, doc)
882 else: self.url_documentation_ghostess.setVisible(False)
884 if (web):
885 self.url_website_ghostess.setVisible(True)
886 self.setWebUrl(self.url_website_ghostess, web)
887 else: self.url_website_ghostess.setVisible(False)
889 if (not doc and not web):
890 self.label_no_help_ghostess.setVisible(True)
891 else:
892 self.label_no_help_ghostess.setVisible(False)
894 def showDoc_Bristol(self, doc, web):
895 if (doc):
896 self.url_documentation_bristol.setVisible(True)
897 self.setDocUrl(self.url_documentation_bristol, doc)
898 else: self.url_documentation_bristol.setVisible(False)
900 if (web):
901 self.url_website_bristol.setVisible(True)
902 self.setWebUrl(self.url_website_bristol, web)
903 else: self.url_website_bristol.setVisible(False)
905 if (not doc and not web):
906 self.label_no_help_bristol.setVisible(True)
907 else:
908 self.label_no_help_bristol.setVisible(False)
910 def showDoc_Effect(self, doc, web):
911 if (doc):
912 self.url_documentation_effect.setVisible(True)
913 self.setDocUrl(self.url_documentation_effect, doc)
914 else: self.url_documentation_effect.setVisible(False)
916 if (web):
917 self.url_website_effect.setVisible(True)
918 self.setWebUrl(self.url_website_effect, web)
919 else: self.url_website_effect.setVisible(False)
921 if (not doc and not web):
922 self.label_no_help_effect.setVisible(True)
923 else:
924 self.label_no_help_effect.setVisible(False)
926 def showDoc_Tool(self, doc, web):
927 if (doc):
928 self.url_documentation_tool.setVisible(True)
929 self.setDocUrl(self.url_documentation_tool, doc)
930 else: self.url_documentation_tool.setVisible(False)
932 if (web):
933 self.url_website_tool.setVisible(True)
934 self.setWebUrl(self.url_website_tool, web)
935 else: self.url_website_tool.setVisible(False)
937 if (not doc and not web):
938 self.label_no_help_tool.setVisible(True)
939 else:
940 self.label_no_help_tool.setVisible(False)
942 def openUrl(self, url):
943 os.system("xdg-open '"+str(url)+"' &")
945 def checkButtons(self):
946 if (self.test_url and self.test_selected):
947 self.b_add.setEnabled(bool(DBus.controlBus))
948 self.b_start.setEnabled(True)
949 else:
950 self.b_add.setEnabled(False)
951 self.b_start.setEnabled(False)
953 def clearAll(self):
954 self.listDAW.clearContents()
955 self.listHost.clearContents()
956 self.listInstrument.clearContents()
957 self.listGhostess.clearContents()
958 self.listBristol.clearContents()
959 self.listEffect.clearContents()
960 self.listTool.clearContents()
961 for i in range(self.listDAW.rowCount()):
962 self.listDAW.removeRow(0)
963 for i in range(self.listHost.rowCount()):
964 self.listHost.removeRow(0)
965 for i in range(self.listInstrument.rowCount()):
966 self.listInstrument.removeRow(0)
967 for i in range(self.listGhostess.rowCount()):
968 self.listGhostess.removeRow(0)
969 for i in range(self.listBristol.rowCount()):
970 self.listBristol.removeRow(0)
971 for i in range(self.listEffect.rowCount()):
972 self.listEffect.removeRow(0)
973 for i in range(self.listTool.rowCount()):
974 self.listTool.removeRow(0)
976 def getIconForYesNo(self, yesno):
977 if (yesno):
978 return "dialog-ok-apply"
979 else:
980 return "dialog-cancel"
982 def refreshAll(self):
983 self.clearAll()
985 if (not SHOW_ALL):
986 pkg_out = getoutput("dpkg -l").split("\n")
987 pkglist = []
988 for i in range(len(pkg_out)):
989 if (pkg_out[i][0] == "i" and pkg_out[i][1] == "i"):
990 package = pkg_out[i].split()[1]
991 pkglist.append(package)
993 if (not SHOW_ALL and not "ghostess" in pkglist):
994 self.tabWidget.setTabEnabled(3, False)
995 if (not SHOW_ALL and not "bristol" in pkglist):
996 self.tabWidget.setTabEnabled(4, False)
998 last_pos = 0
999 list_DAW = database.list_DAW
1000 for i in range(len(list_DAW)):
1001 if (SHOW_ALL or list_DAW[i][0] in pkglist):
1002 AppName = list_DAW[i][1]
1003 Type = list_DAW[i][2]
1004 Binary = list_DAW[i][3]
1005 Icon = list_DAW[i][4]
1006 Save = list_DAW[i][5]
1007 Level = list_DAW[i][6]
1008 Licence = list_DAW[i][7]
1009 Features = list_DAW[i][8]
1010 Docs = list_DAW[i][9]
1012 w_icon = QTableWidgetItem("")
1013 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1014 w_name = QTableWidgetItem(AppName)
1015 w_type = QTableWidgetItem(Type)
1016 w_save = QTableWidgetItem(Save)
1017 w_licc = QTableWidgetItem(Licence)
1019 self.listDAW.insertRow(last_pos)
1020 self.listDAW.setItem(last_pos, 0, w_icon)
1021 self.listDAW.setItem(last_pos, 1, w_name)
1022 self.listDAW.setItem(last_pos, 2, w_type)
1023 self.listDAW.setItem(last_pos, 3, w_save)
1024 self.listDAW.setItem(last_pos, 4, w_licc)
1026 last_pos += 1
1028 last_pos = 0
1029 list_Host = database.list_Host
1030 for i in range(len(list_Host)):
1031 if (SHOW_ALL or list_Host[i][0] in pkglist):
1032 AppName = list_Host[i][1]
1033 Has_Ins = list_Host[i][2]
1034 Has_Eff = list_Host[i][3]
1035 Binary = list_Host[i][4]
1036 Icon = list_Host[i][5]
1037 Save = list_Host[i][6]
1038 Level = list_Host[i][7]
1039 Licence = list_Host[i][8]
1040 Features = list_Host[i][9]
1041 Docs = list_Host[i][10]
1043 w_icon = QTableWidgetItem("")
1044 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1045 w_name = QTableWidgetItem(AppName)
1046 w_h_in = QTableWidgetItem(Has_Ins)
1047 w_h_ef = QTableWidgetItem(Has_Eff)
1048 w_save = QTableWidgetItem(Save)
1049 w_licc = QTableWidgetItem(Licence)
1051 self.listHost.insertRow(last_pos)
1052 self.listHost.setItem(last_pos, 0, w_icon)
1053 self.listHost.setItem(last_pos, 1, w_name)
1054 self.listHost.setItem(last_pos, 2, w_h_in)
1055 self.listHost.setItem(last_pos, 3, w_h_ef)
1056 self.listHost.setItem(last_pos, 4, w_save)
1057 self.listHost.setItem(last_pos, 5, w_licc)
1059 last_pos += 1
1061 last_pos = 0
1062 list_Instrument = database.list_Instrument
1063 for i in range(len(list_Instrument)):
1064 if (SHOW_ALL or list_Instrument[i][0] in pkglist):
1065 AppName = list_Instrument[i][1]
1066 Type = list_Instrument[i][2]
1067 Binary = list_Instrument[i][3]
1068 Icon = list_Instrument[i][4]
1069 Save = list_Instrument[i][5]
1070 Level = list_Instrument[i][6]
1071 Licence = list_Instrument[i][7]
1072 Features = list_Instrument[i][8]
1073 Docs = list_Instrument[i][9]
1075 w_icon = QTableWidgetItem("")
1076 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1077 w_name = QTableWidgetItem(AppName)
1078 w_type = QTableWidgetItem(Type)
1079 w_save = QTableWidgetItem(Save)
1080 w_licc = QTableWidgetItem(Licence)
1082 self.listInstrument.insertRow(last_pos)
1083 self.listInstrument.setItem(last_pos, 0, w_icon)
1084 self.listInstrument.setItem(last_pos, 1, w_name)
1085 self.listInstrument.setItem(last_pos, 2, w_type)
1086 self.listInstrument.setItem(last_pos, 3, w_save)
1087 self.listInstrument.setItem(last_pos, 4, w_licc)
1089 last_pos += 1
1091 last_pos = 0
1092 list_Ghostess = database.list_Ghostess
1093 for i in range(len(list_Ghostess)):
1094 if (SHOW_ALL or list_Ghostess[i][0] in pkglist):
1095 AppName = list_Ghostess[i][1]
1096 Type = list_Ghostess[i][2]
1097 Binary = list_Ghostess[i][3]
1098 Icon = list_Ghostess[i][4]
1099 Save = list_Ghostess[i][5]
1100 Level = list_Ghostess[i][6]
1101 Licence = list_Ghostess[i][7]
1102 Features = list_Ghostess[i][8]
1103 Docs = list_Ghostess[i][9]
1105 w_icon = QTableWidgetItem("")
1106 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1107 w_name = QTableWidgetItem(AppName)
1108 w_type = QTableWidgetItem(Type)
1109 w_save = QTableWidgetItem(Save)
1110 w_licc = QTableWidgetItem(Licence)
1112 self.listGhostess.insertRow(last_pos)
1113 self.listGhostess.setItem(last_pos, 0, w_icon)
1114 self.listGhostess.setItem(last_pos, 1, w_name)
1115 self.listGhostess.setItem(last_pos, 2, w_type)
1116 self.listGhostess.setItem(last_pos, 3, w_save)
1117 self.listGhostess.setItem(last_pos, 4, w_licc)
1119 last_pos += 1
1121 last_pos = 0
1122 list_Bristol = database.list_Bristol
1123 for i in range(len(list_Bristol)):
1124 if (SHOW_ALL or list_Bristol[i][0] in pkglist):
1125 FullName = list_Bristol[i][1]
1126 Type = list_Bristol[i][2]
1127 ShortName = list_Bristol[i][3]
1128 Icon = list_Bristol[i][4]
1129 Save = list_Bristol[i][5]
1130 Level = list_Bristol[i][6]
1131 Licence = list_Bristol[i][7]
1132 Features = list_Bristol[i][8]
1133 Docs = list_Bristol[i][9]
1135 w_icon = QTableWidgetItem("")
1136 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1137 w_fullname = QTableWidgetItem(FullName)
1138 w_shortname = QTableWidgetItem(ShortName)
1140 self.listBristol.insertRow(last_pos)
1141 self.listBristol.setItem(last_pos, 0, w_icon)
1142 self.listBristol.setItem(last_pos, 1, w_shortname)
1143 self.listBristol.setItem(last_pos, 2, w_fullname)
1145 last_pos += 1
1147 last_pos = 0
1148 list_Effect = database.list_Effect
1149 for i in range(len(list_Effect)):
1150 if (SHOW_ALL or list_Effect[i][0] in pkglist):
1151 AppName = list_Effect[i][1]
1152 Type = list_Effect[i][2]
1153 Binary = list_Effect[i][3]
1154 Icon = list_Effect[i][4]
1155 Save = list_Effect[i][5]
1156 Level = list_Effect[i][6]
1157 Licence = list_Effect[i][7]
1158 Features = list_Effect[i][8]
1159 Docs = list_Effect[i][9]
1161 w_icon = QTableWidgetItem("")
1162 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1163 w_name = QTableWidgetItem(AppName)
1164 w_type = QTableWidgetItem(Type)
1165 w_save = QTableWidgetItem(Save)
1166 w_licc = QTableWidgetItem(Licence)
1168 self.listEffect.insertRow(last_pos)
1169 self.listEffect.setItem(last_pos, 0, w_icon)
1170 self.listEffect.setItem(last_pos, 1, w_name)
1171 self.listEffect.setItem(last_pos, 2, w_type)
1172 self.listEffect.setItem(last_pos, 3, w_save)
1173 self.listEffect.setItem(last_pos, 4, w_licc)
1175 last_pos += 1
1177 last_pos = 0
1178 list_Tool = database.list_Tool
1179 for i in range(len(list_Tool)):
1180 if (SHOW_ALL or list_Tool[i][0] in pkglist):
1181 AppName = list_Tool[i][1]
1182 Type = list_Tool[i][2]
1183 Binary = list_Tool[i][3]
1184 Icon = list_Tool[i][4]
1185 Save = list_Tool[i][5]
1186 Level = list_Tool[i][6]
1187 Licence = list_Tool[i][7]
1188 Features = list_Tool[i][8]
1189 Docs = list_Tool[i][9]
1191 w_icon = QTableWidgetItem("")
1192 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1193 w_name = QTableWidgetItem(AppName)
1194 w_type = QTableWidgetItem(Type)
1195 w_save = QTableWidgetItem(Save)
1196 w_licc = QTableWidgetItem(Licence)
1198 self.listTool.insertRow(last_pos)
1199 self.listTool.setItem(last_pos, 0, w_icon)
1200 self.listTool.setItem(last_pos, 1, w_name)
1201 self.listTool.setItem(last_pos, 2, w_type)
1202 self.listTool.setItem(last_pos, 3, w_save)
1203 self.listTool.setItem(last_pos, 4, w_licc)
1205 last_pos += 1
1207 self.listDAW.setCurrentCell(-1, -1)
1208 self.listHost.setCurrentCell(-1, -1)
1209 self.listInstrument.setCurrentCell(-1, -1)
1210 self.listGhostess.setCurrentCell(-1, -1)
1211 self.listBristol.setCurrentCell(-1, -1)
1212 self.listEffect.setCurrentCell(-1, -1)
1213 self.listTool.setCurrentCell(-1, -1)
1215 self.listDAW.sortByColumn(1, Qt.AscendingOrder)
1216 self.listHost.sortByColumn(1, Qt.AscendingOrder)
1217 self.listInstrument.sortByColumn(1, Qt.AscendingOrder)
1218 self.listGhostess.sortByColumn(1, Qt.AscendingOrder)
1219 self.listBristol.sortByColumn(2, Qt.AscendingOrder)
1220 self.listEffect.sortByColumn(1, Qt.AscendingOrder)
1221 self.listTool.sortByColumn(1, Qt.AscendingOrder)
1223 def saveSettings(self):
1224 self.settings.setValue("Geometry", QVariant(self.saveGeometry()))
1225 self.settings.setValue("SplitterDAW", self.splitter_DAW.saveState())
1226 self.settings.setValue("SplitterHost", self.splitter_Host.saveState())
1227 self.settings.setValue("SplitterInstrument", self.splitter_Instrument.saveState())
1228 self.settings.setValue("SplitterGhostess", self.splitter_Ghostess.saveState())
1229 self.settings.setValue("SplitterBristol", self.splitter_Bristol.saveState())
1230 self.settings.setValue("SplitterEffect", self.splitter_Effect.saveState())
1231 self.settings.setValue("SplitterTool", self.splitter_Tool.saveState())
1233 def loadSettings(self):
1234 self.restoreGeometry(self.settings.value("Geometry").toByteArray())
1235 self.splitter_DAW.restoreState(self.settings.value("SplitterDAW").toByteArray())
1236 self.splitter_Host.restoreState(self.settings.value("SplitterHost").toByteArray())
1237 self.splitter_Instrument.restoreState(self.settings.value("SplitterInstrument").toByteArray())
1238 self.splitter_Ghostess.restoreState(self.settings.value("SplitterGhostess").toByteArray())
1239 self.splitter_Bristol.restoreState(self.settings.value("SplitterBristol").toByteArray())
1240 self.splitter_Effect.restoreState(self.settings.value("SplitterEffect").toByteArray())
1241 self.splitter_Tool.restoreState(self.settings.value("SplitterTool").toByteArray())
1243 def closeEvent(self, event):
1244 self.saveSettings()
1245 event.accept()