Add Jacker (lv1 and template)
[klaudia.git] / src / w_klaudia.py
blobdf064d42fd7e979580d72a3bceaed51af6b12da1
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 == "Jacker"):
377 proj_bpm = proj_bpm.split(".")[0] # No decimal bpm support
378 proj_file = url_folder+"Jacker_"+ran_check+".jsong"
379 os.system("cp "+sys.path[0]+"/../templates/Jacker.jsong '"+proj_file+"'")
380 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'"')
381 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
382 DBus.appBus.RunCustom(False, "jacker '"+proj_file+"'", str(app), 1)
383 elif (app == "MusE" or app == "MusE (SVN)"):
384 proj_file = url_folder+"MusE_"+ran_check+".med"
385 os.system("cp "+sys.path[0]+"/../templates/MusE.med '"+proj_file+"'")
386 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
387 DBus.appBus.RunCustom(False, "muse '"+proj_file+"'", str(app), 0)
388 elif (app == "Non-DAW"):
389 proj_file = url_folder+"Non-DAW_"+ran_check
390 os.system("cp -r "+sys.path[0]+"/../templates/Non-DAW '"+proj_file+"'")
391 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'/history"')
392 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'/info"')
393 os.system('mkdir -p "'+proj_file+'/sources"')
394 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
395 DBus.appBus.RunCustom(False, "non-daw '"+proj_file+"'", str(app), 0)
396 elif (app == "Non-Sequencer"):
397 proj_file = url_folder+"Non-Sequencer_"+ran_check+".non"
398 os.system("cp "+sys.path[0]+"/../templates/Non-Sequencer.non '"+proj_file+"'")
399 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
400 DBus.appBus.RunCustom(False, "non-sequencer '"+proj_file+"'", str(app), 0)
401 elif (app == "Qtractor" or app == "QtractorVST" or app == "QtractorVST (32bit)" or app == "Qtractor (SVN)"):
402 proj_file = url_folder+"Qtractor_"+ran_check+".qtr"
403 os.system("cp "+sys.path[0]+"/../templates/Qtractor.qtr '"+proj_file+"'")
404 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'"')
405 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'"')
406 os.system('sed -i "s/X_FOLDER_X-KLAUDIA-X_FOLDER_X/'+url_folder.replace("/","\/")+'/" "'+proj_file+'"')
407 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
408 DBus.appBus.RunCustom(False, binary+" '"+proj_file+"'", str(app), 1)
409 elif (app == "Renoise" or app == "Renoise (64bit)"):
410 os.mkdir(url_folder+"tmp_bu")
411 os.system("cp "+sys.path[0]+"/../templates/Renoise.xml "+url_folder+"/tmp_bu")
412 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+url_folder+'/tmp_bu/Renoise.xml"')
413 os.system("cd '"+url_folder+"tmp_bu' && mv Renoise.xml Song.xml && zip ../Renoise_"+ran_check+".xrns Song.xml")
414 os.system("rm -rf '"+url_folder+"tmp_bu'")
415 if (not self.le_url.isEnabled()): url_folder = ""
416 DBus.appBus.RunCustom(False, binary+" '"+url_folder+"Renoise_"+ran_check+".xrns'", str(app), 0)
417 elif (app == "Rosegarden"):
418 proj_file = url_folder+"Rosegarden_"+ran_check+".rg"
419 os.system("cp "+sys.path[0]+"/../templates/Rosegarden.rg '"+proj_file+"'")
420 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'"')
421 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
422 DBus.appBus.RunCustom(False, "rosegarden '"+proj_file+"'", str(app), 1)
423 elif (app == "Seq24"):
424 proj_file = url_folder+"Seq24_"+ran_check+".midi"
425 os.system("cp "+sys.path[0]+"/../templates/Seq24.midi '"+proj_file+"'")
426 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
427 DBus.appBus.RunCustom(False, "seq24 --file '"+proj_file+"'", str(app), 1)
429 elif (app == "Calf Jack Host (GIT)"):
430 proj_file = url_folder+"CalfJackHost_"+ran_check
431 os.system("cp "+sys.path[0]+"/../templates/CalfJackHost '"+proj_file+"'")
432 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
433 DBus.appBus.RunCustom(False, "calfjackhost --load '"+proj_file+"'", str(app), 1)
434 elif (app == "FeSTige"):
435 room_name = ""
436 if (self.co_ladi_room.currentIndex() > 0):
437 room_name = '"' + QStringStr(self.co_ladi_room.currentText()).split(" - ")[1] + '"'
438 DBus.appBus.RunCustom(False, "festige "+url_folder+" "+room_name, str(app), 0)
439 #elif (app == "Ingen" or app == "Ingen (SVN)"):
440 #if (app == "Ingen (SVN)"):
441 #binary = "ingen-svn"
442 #else:
443 #binary = "ingen"
444 #proj_file = url_folder+"/"+"ingen_"+ran_check+".ing.lv2"
445 #os.system("cp -r "+sys.path[0]+"/../templates/ingen.ing.lv2 '"+proj_file+"'")
446 #if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
447 #DBus.appBus.RunCustom(False, binary+" -egl '"+proj_file+"'", str(app), 0)
448 elif (app == "Jack Rack"):
449 proj_file = url_folder+"Jack-Rack_"+ran_check+".xml"
450 os.system("cp "+sys.path[0]+"/../templates/Jack-Rack.xml '"+proj_file+"'")
451 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'"')
452 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
453 DBus.appBus.RunCustom(False, "jack-rack -s '"+str(app)+"' '"+proj_file+"'", str(app), 0)
455 elif (app == "Qsampler" or app == "Qsampler (SVN)"):
456 if (app == "Qsampler (SVN)"):
457 level = 1
458 else:
459 level = 0
460 proj_file = url_folder+"Qsampler_"+ran_check+".lscp"
461 os.system("cp "+sys.path[0]+"/../templates/Qsampler.lscp '"+proj_file+"'")
462 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
463 DBus.appBus.RunCustom(False, "qsampler '"+proj_file+"'", str(app), level)
464 elif (app == "Yoshimi"):
465 proj_file = url_folder+"Yoshimi_"+ran_check+".state"
466 os.system("cp "+sys.path[0]+"/../templates/Yoshimi.state '"+proj_file+"'")
467 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'"')
468 os.system('sed -i "s/X_FILE_X-KLAUDIA-X_FILE_X/'+proj_file.replace("/","\/")+'/" "'+proj_file+'"')
469 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
470 DBus.appBus.RunCustom(False, "yoshimi -j -J --state='"+proj_file+"'", str(app), 1)
472 elif (app == "Jamin"):
473 proj_file = url_folder+"Jamin_"+ran_check+".jam"
474 os.system("cp "+sys.path[0]+"/../templates/Jamin.jam '"+proj_file+"'")
475 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
476 DBus.appBus.RunCustom(False, "jamin -f '"+proj_file+"'", str(app), 0)
478 elif (app == "Jack Mixer"):
479 proj_file = url_folder+"Jack-Mixer_"+ran_check+".xml"
480 os.system("cp "+sys.path[0]+"/../templates/Jack-Mixer.xml '"+proj_file+"'")
481 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
482 DBus.appBus.RunCustom(False, "jack_mixer -c '"+proj_file+"'", str(app), 1)
483 elif (app == "Non-Mixer"):
484 proj_file = url_folder+"Non-Mixer_"+ran_check
485 os.system("cp -r "+sys.path[0]+"/../templates/Non-Mixer '"+proj_file+"'")
486 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
487 DBus.appBus.RunCustom(False, "non-mixer '"+proj_file+"'", str(app), 0)
489 else:
490 DBus.appBus.RunCustom(False, binary, str(app), 0)
492 def clearInfo_DAW(self):
493 self.ico_app_daw.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
494 self.label_name_daw.setText("App Name")
495 self.ico_ladspa_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
496 self.ico_dssi_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
497 self.ico_lv2_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
498 self.ico_vst_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
499 self.label_vst_mode_daw.setText("")
500 self.ico_jack_transport_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
501 self.label_midi_mode_daw.setText("---")
502 self.label_ladish_level_daw.setText("0")
503 self.showDoc_DAW(0, 0)
504 self.frame_DAW.setEnabled(False)
506 def clearInfo_Host(self):
507 self.ico_app_host.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
508 self.label_name_host.setText("App Name")
509 self.ico_ladspa_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
510 self.ico_dssi_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
511 self.ico_lv2_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
512 self.ico_vst_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
513 self.label_vst_mode_host.setText("")
514 self.label_midi_mode_host.setText("---")
515 self.label_ladish_level_host.setText("0")
516 self.showDoc_Host(0, 0)
517 self.frame_Host.setEnabled(False)
519 def clearInfo_Intrument(self):
520 self.ico_app_ins.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
521 self.label_name_ins.setText("App Name")
522 self.ico_builtin_fx_ins.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
523 self.ico_audio_input_ins.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
524 self.label_midi_mode_ins.setText("---")
525 self.label_ladish_level_ins.setText("0")
526 self.showDoc_Instrument(0, 0)
527 self.frame_Instrument.setEnabled(False)
529 def clearInfo_Ghostess(self):
530 self.ico_app_ghostess.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
531 self.label_name_ghostess.setText("App Name")
532 self.ico_builtin_fx_ghostess.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
533 self.ico_stereo_ghostess.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
534 self.label_midi_mode_ghostess.setText("---")
535 self.label_ladish_level_ghostess.setText("0")
536 self.showDoc_Ghostess(0, 0)
537 self.frame_Ghostess.setEnabled(False)
539 def clearInfo_Bristol(self):
540 self.ico_app_bristol.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
541 self.label_name_bristol.setText("App Name")
542 self.ico_builtin_fx_bristol.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
543 self.ico_audio_input_bristol.setPixmap(QIcon("dialog-cancel").pixmap(16, 16))
544 self.label_midi_mode_bristol.setText("---")
545 self.label_ladish_level_bristol.setText("0")
546 self.showDoc_Bristol(0, 0)
547 self.frame_Bristol.setEnabled(False)
549 def clearInfo_Effect(self):
550 self.ico_app_effect.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
551 self.label_name_effect.setText("App Name")
552 self.ico_stereo_effect.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
553 self.label_midi_mode_effect.setText("---")
554 self.label_ladish_level_effect.setText("0")
555 self.showDoc_Effect(0, 0)
556 self.frame_Effect.setEnabled(False)
558 def clearInfo_Tool(self):
559 self.ico_app_tool.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
560 self.label_name_tool.setText("App Name")
561 self.label_midi_mode_tool.setText("---")
562 self.label_ladish_level_tool.setText("0")
563 self.showDoc_Tool(0, 0)
564 self.frame_Tool.setEnabled(False)
566 def checkFolderUrl(self, url):
567 if (os.path.exists(QStringStr(url))):
568 self.test_url = True
569 if (self.le_url.isEnabled()):
570 self.studio_root_folder = url
571 else:
572 self.test_url = False
573 self.checkButtons()
575 def checkSelectedTab(self, tab):
576 self.test_selected = False
577 if (tab == 0): # DAW
578 if (self.listDAW.selectedItems()):
579 self.test_selected = True
580 elif (tab == 1): # Host
581 if (self.listHost.selectedItems()):
582 self.test_selected = True
583 elif (tab == 2): # Instrument
584 if (self.listInstrument.selectedItems()):
585 self.test_selected = True
586 elif (tab == 3): # Ghostess
587 if (self.listGhostess.selectedItems()):
588 self.test_selected = True
589 elif (tab == 4): # Bristol
590 if (self.listBristol.selectedItems()):
591 self.test_selected = True
592 elif (tab == 5): # Effect
593 if (self.listEffect.selectedItems()):
594 self.test_selected = True
595 elif (tab == 6): # Tool
596 if (self.listTool.selectedItems()):
597 self.test_selected = True
599 self.checkButtons()
601 def checkSelectedDAW(self, row, column, p_row, p_column):
602 if (row >= 0):
603 self.test_selected = True
605 app_name = self.listDAW.item(row, 1).text()
606 app_info = []
607 list_DAW = database.list_DAW
609 for i in range(len(list_DAW)):
610 if (app_name == list_DAW[i][1]):
611 app_info = list_DAW[i]
612 break
614 if (not app_info):
615 print "Error here, cod.001"
616 return
618 self.frame_DAW.setEnabled(True)
619 self.ico_app_daw.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
620 self.ico_ladspa_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
621 self.ico_dssi_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
622 self.ico_lv2_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][2]), 16)).pixmap(16, 16))
623 self.ico_vst_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][3]), 16)).pixmap(16, 16))
624 self.ico_jack_transport_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][5]), 16)).pixmap(16, 16))
625 self.label_name_daw.setText(app_info[1])
626 self.label_vst_mode_daw.setText(app_info[8][4])
627 self.ico_midi_mode_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][6]), 16)).pixmap(16, 16))
628 self.label_midi_mode_daw.setText(app_info[8][7])
629 self.label_ladish_level_daw.setText(str(app_info[6]))
631 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
632 self.showDoc_DAW(doc, app_info[9][1])
633 else:
634 self.test_selected = False
635 self.clearInfo_DAW()
636 self.checkButtons()
638 def checkSelectedHost(self, row, column, p_row, p_column):
639 if (row >= 0):
640 self.test_selected = True
642 app_name = self.listHost.item(row, 1).text()
643 app_info = []
644 list_Host = database.list_Host
646 for i in range(len(list_Host)):
647 if (app_name == list_Host[i][1]):
648 app_info = list_Host[i]
649 break
651 if (not app_info):
652 print "Error here, cod.003"
653 return
655 self.frame_Host.setEnabled(True)
656 self.ico_app_host.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[5], 48)).pixmap(48, 48))
657 self.ico_internal_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][0]), 16)).pixmap(16, 16))
658 self.ico_ladspa_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][1]), 16)).pixmap(16, 16))
659 self.ico_dssi_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][2]), 16)).pixmap(16, 16))
660 self.ico_lv2_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][3]), 16)).pixmap(16, 16))
661 self.ico_vst_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][4]), 16)).pixmap(16, 16))
662 self.label_name_host.setText(app_info[1])
663 self.label_vst_mode_host.setText(app_info[9][5])
664 self.label_midi_mode_host.setText(app_info[9][6])
665 self.label_ladish_level_host.setText(str(app_info[7]))
667 doc = app_info[10][0] if (os.path.exists(app_info[10][0].replace("file://",""))) else ""
668 self.showDoc_Host(doc, app_info[10][1])
669 else:
670 self.test_selected = False
671 self.clearInfo_DAW()
672 self.checkButtons()
674 def checkSelectedInstrument(self, row, column, p_row, p_column):
675 if (row >= 0):
676 self.test_selected = True
678 app_name = self.listInstrument.item(row, 1).text()
679 app_info = []
680 list_Instrument = database.list_Instrument
682 for i in range(len(list_Instrument)):
683 if (app_name == list_Instrument[i][1]):
684 app_info = list_Instrument[i]
685 break
687 if (not app_info):
688 print "Error here, cod.004"
689 return
691 self.frame_Instrument.setEnabled(True)
692 self.ico_app_ins.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
693 self.ico_builtin_fx_ins.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
694 self.ico_audio_input_ins.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
695 self.label_name_ins.setText(app_info[1])
696 self.label_midi_mode_ins.setText(app_info[8][2])
697 self.label_ladish_level_ins.setText(str(app_info[6]))
699 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
700 self.showDoc_Instrument(doc, app_info[9][1])
701 else:
702 self.test_selected = False
703 self.clearInfo_Intrument()
704 self.checkButtons()
706 def checkSelectedGhostess(self, row, column, p_row, p_column):
707 if (row >= 0):
708 self.test_selected = True
710 app_name = self.listGhostess.item(row, 1).text()
711 app_info = []
712 list_Ghostess = database.list_Ghostess
714 for i in range(len(list_Ghostess)):
715 if (app_name == list_Ghostess[i][1]):
716 app_info = list_Ghostess[i]
717 break
719 if (not app_info):
720 print "Error here, cod.004"
721 return
723 self.frame_Ghostess.setEnabled(True)
724 self.ico_app_ghostess.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
725 self.ico_builtin_fx_ghostess.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
726 self.ico_stereo_ghostess.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
727 self.label_name_ghostess.setText(app_info[1])
728 self.label_midi_mode_ghostess.setText(app_info[8][2])
729 self.label_ladish_level_ghostess.setText(str(app_info[6]))
731 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
732 self.showDoc_Ghostess(doc, app_info[9][1])
733 else:
734 self.test_selected = False
735 self.clearInfo_Ghostess()
736 self.checkButtons()
738 def checkSelectedBristol(self, row, column, p_row, p_column):
739 if (row >= 0):
740 self.test_selected = True
742 app_name = self.listBristol.item(row, 2).text()
743 app_info = []
744 list_Bristol = database.list_Bristol
746 for i in range(len(list_Bristol)):
747 if (app_name == list_Bristol[i][1]):
748 app_info = list_Bristol[i]
749 break
751 if (not app_info):
752 print "Error here, cod.007"
753 return
755 self.frame_Bristol.setEnabled(True)
756 self.ico_app_bristol.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
757 self.ico_builtin_fx_bristol.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
758 self.ico_audio_input_bristol.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
759 self.label_name_bristol.setText(app_info[1])
760 self.label_midi_mode_bristol.setText(app_info[8][2])
761 self.label_ladish_level_bristol.setText(str(app_info[6]))
763 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
764 self.showDoc_Bristol(doc, app_info[9][1])
765 else:
766 self.test_selected = False
767 self.clearInfo_Bristol()
768 self.checkButtons()
770 def checkSelectedEffect(self, row, column, p_row, p_column):
771 if (row >= 0):
772 self.test_selected = True
774 app_name = self.listEffect.item(row, 1).text()
775 app_info = []
776 list_Effect = database.list_Effect
778 for i in range(len(list_Effect)):
779 if (app_name == list_Effect[i][1]):
780 app_info = list_Effect[i]
781 break
783 if (not app_info):
784 print "Error here, cod.005"
785 return
787 self.frame_Effect.setEnabled(True)
788 self.ico_app_effect.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
789 self.ico_stereo_effect.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
790 self.label_name_effect.setText(app_info[1])
791 self.label_midi_mode_effect.setText(app_info[8][1])
792 self.label_ladish_level_effect.setText(str(app_info[6]))
794 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
795 self.showDoc_Effect(doc, app_info[9][1])
796 else:
797 self.test_selected = False
798 self.clearInfo_Effect()
799 self.checkButtons()
801 def checkSelectedTool(self, row, column, p_row, p_column):
802 if (row >= 0):
803 self.test_selected = True
805 app_name = self.listTool.item(row, 1).text()
806 app_info = []
807 list_Tool = database.list_Tool
809 for i in range(len(list_Tool)):
810 if (app_name == list_Tool[i][1]):
811 app_info = list_Tool[i]
812 break
814 if (not app_info):
815 print "Error here, cod.006"
816 return
818 self.frame_Tool.setEnabled(True)
819 self.ico_app_tool.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
820 self.label_name_tool.setText(app_info[1])
821 self.label_midi_mode_tool.setText(app_info[8][0])
822 self.ico_jack_transport_tool.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
823 self.label_ladish_level_tool.setText(str(app_info[6]))
825 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
826 self.showDoc_Tool(doc, app_info[9][1])
827 else:
828 self.test_selected = False
829 self.clearInfo_Tool()
830 self.checkButtons()
832 def setDocUrl(self, item, link):
833 item.setText(self.tr("<a href='%1'>Documentation</a>").arg(link))
835 def setWebUrl(self, item, link):
836 item.setText(self.tr("<a href='%1'>WebSite</a>").arg(link))
838 def showDoc_DAW(self, doc, web):
839 if (doc):
840 self.url_documentation_daw.setVisible(True)
841 self.setDocUrl(self.url_documentation_daw, doc)
842 else: self.url_documentation_daw.setVisible(False)
844 if (web):
845 self.url_website_daw.setVisible(True)
846 self.setWebUrl(self.url_website_daw, web)
847 else: self.url_website_daw.setVisible(False)
849 if (not doc and not web):
850 self.label_no_help_daw.setVisible(True)
851 else:
852 self.label_no_help_daw.setVisible(False)
854 def showDoc_Host(self, doc, web):
855 if (doc):
856 self.url_documentation_host.setVisible(True)
857 self.setDocUrl(self.url_documentation_host, doc)
858 else: self.url_documentation_host.setVisible(False)
860 if (web):
861 self.url_website_host.setVisible(True)
862 self.setWebUrl(self.url_website_host, web)
863 else: self.url_website_host.setVisible(False)
865 if (not doc and not web):
866 self.label_no_help_host.setVisible(True)
867 else:
868 self.label_no_help_host.setVisible(False)
870 def showDoc_Instrument(self, doc, web):
871 if (doc):
872 self.url_documentation_ins.setVisible(True)
873 self.setDocUrl(self.url_documentation_ins, doc)
874 else: self.url_documentation_ins.setVisible(False)
876 if (web):
877 self.url_website_ins.setVisible(True)
878 self.setWebUrl(self.url_website_ins, web)
879 else: self.url_website_ins.setVisible(False)
881 if (not doc and not web):
882 self.label_no_help_ins.setVisible(True)
883 else:
884 self.label_no_help_ins.setVisible(False)
886 def showDoc_Ghostess(self, doc, web):
887 if (doc):
888 self.url_documentation_ghostess.setVisible(True)
889 self.setDocUrl(self.url_documentation_ghostess, doc)
890 else: self.url_documentation_ghostess.setVisible(False)
892 if (web):
893 self.url_website_ghostess.setVisible(True)
894 self.setWebUrl(self.url_website_ghostess, web)
895 else: self.url_website_ghostess.setVisible(False)
897 if (not doc and not web):
898 self.label_no_help_ghostess.setVisible(True)
899 else:
900 self.label_no_help_ghostess.setVisible(False)
902 def showDoc_Bristol(self, doc, web):
903 if (doc):
904 self.url_documentation_bristol.setVisible(True)
905 self.setDocUrl(self.url_documentation_bristol, doc)
906 else: self.url_documentation_bristol.setVisible(False)
908 if (web):
909 self.url_website_bristol.setVisible(True)
910 self.setWebUrl(self.url_website_bristol, web)
911 else: self.url_website_bristol.setVisible(False)
913 if (not doc and not web):
914 self.label_no_help_bristol.setVisible(True)
915 else:
916 self.label_no_help_bristol.setVisible(False)
918 def showDoc_Effect(self, doc, web):
919 if (doc):
920 self.url_documentation_effect.setVisible(True)
921 self.setDocUrl(self.url_documentation_effect, doc)
922 else: self.url_documentation_effect.setVisible(False)
924 if (web):
925 self.url_website_effect.setVisible(True)
926 self.setWebUrl(self.url_website_effect, web)
927 else: self.url_website_effect.setVisible(False)
929 if (not doc and not web):
930 self.label_no_help_effect.setVisible(True)
931 else:
932 self.label_no_help_effect.setVisible(False)
934 def showDoc_Tool(self, doc, web):
935 if (doc):
936 self.url_documentation_tool.setVisible(True)
937 self.setDocUrl(self.url_documentation_tool, doc)
938 else: self.url_documentation_tool.setVisible(False)
940 if (web):
941 self.url_website_tool.setVisible(True)
942 self.setWebUrl(self.url_website_tool, web)
943 else: self.url_website_tool.setVisible(False)
945 if (not doc and not web):
946 self.label_no_help_tool.setVisible(True)
947 else:
948 self.label_no_help_tool.setVisible(False)
950 def openUrl(self, url):
951 os.system("xdg-open '"+str(url)+"' &")
953 def checkButtons(self):
954 if (self.test_url and self.test_selected):
955 self.b_add.setEnabled(bool(DBus.controlBus))
956 self.b_start.setEnabled(True)
957 else:
958 self.b_add.setEnabled(False)
959 self.b_start.setEnabled(False)
961 def clearAll(self):
962 self.listDAW.clearContents()
963 self.listHost.clearContents()
964 self.listInstrument.clearContents()
965 self.listGhostess.clearContents()
966 self.listBristol.clearContents()
967 self.listEffect.clearContents()
968 self.listTool.clearContents()
969 for i in range(self.listDAW.rowCount()):
970 self.listDAW.removeRow(0)
971 for i in range(self.listHost.rowCount()):
972 self.listHost.removeRow(0)
973 for i in range(self.listInstrument.rowCount()):
974 self.listInstrument.removeRow(0)
975 for i in range(self.listGhostess.rowCount()):
976 self.listGhostess.removeRow(0)
977 for i in range(self.listBristol.rowCount()):
978 self.listBristol.removeRow(0)
979 for i in range(self.listEffect.rowCount()):
980 self.listEffect.removeRow(0)
981 for i in range(self.listTool.rowCount()):
982 self.listTool.removeRow(0)
984 def getIconForYesNo(self, yesno):
985 if (yesno):
986 return "dialog-ok-apply"
987 else:
988 return "dialog-cancel"
990 def refreshAll(self):
991 self.clearAll()
993 if (not SHOW_ALL):
994 pkg_out = getoutput("dpkg -l").split("\n")
995 pkglist = []
996 for i in range(len(pkg_out)):
997 if (pkg_out[i][0] == "i" and pkg_out[i][1] == "i"):
998 package = pkg_out[i].split()[1]
999 pkglist.append(package)
1001 if (not SHOW_ALL and not "ghostess" in pkglist):
1002 self.tabWidget.setTabEnabled(3, False)
1003 if (not SHOW_ALL and not "bristol" in pkglist):
1004 self.tabWidget.setTabEnabled(4, False)
1006 last_pos = 0
1007 list_DAW = database.list_DAW
1008 for i in range(len(list_DAW)):
1009 if (SHOW_ALL or list_DAW[i][0] in pkglist):
1010 AppName = list_DAW[i][1]
1011 Type = list_DAW[i][2]
1012 Binary = list_DAW[i][3]
1013 Icon = list_DAW[i][4]
1014 Save = list_DAW[i][5]
1015 Level = list_DAW[i][6]
1016 Licence = list_DAW[i][7]
1017 Features = list_DAW[i][8]
1018 Docs = list_DAW[i][9]
1020 w_icon = QTableWidgetItem("")
1021 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1022 w_name = QTableWidgetItem(AppName)
1023 w_type = QTableWidgetItem(Type)
1024 w_save = QTableWidgetItem(Save)
1025 w_licc = QTableWidgetItem(Licence)
1027 self.listDAW.insertRow(last_pos)
1028 self.listDAW.setItem(last_pos, 0, w_icon)
1029 self.listDAW.setItem(last_pos, 1, w_name)
1030 self.listDAW.setItem(last_pos, 2, w_type)
1031 self.listDAW.setItem(last_pos, 3, w_save)
1032 self.listDAW.setItem(last_pos, 4, w_licc)
1034 last_pos += 1
1036 last_pos = 0
1037 list_Host = database.list_Host
1038 for i in range(len(list_Host)):
1039 if (SHOW_ALL or list_Host[i][0] in pkglist):
1040 AppName = list_Host[i][1]
1041 Has_Ins = list_Host[i][2]
1042 Has_Eff = list_Host[i][3]
1043 Binary = list_Host[i][4]
1044 Icon = list_Host[i][5]
1045 Save = list_Host[i][6]
1046 Level = list_Host[i][7]
1047 Licence = list_Host[i][8]
1048 Features = list_Host[i][9]
1049 Docs = list_Host[i][10]
1051 w_icon = QTableWidgetItem("")
1052 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1053 w_name = QTableWidgetItem(AppName)
1054 w_h_in = QTableWidgetItem(Has_Ins)
1055 w_h_ef = QTableWidgetItem(Has_Eff)
1056 w_save = QTableWidgetItem(Save)
1057 w_licc = QTableWidgetItem(Licence)
1059 self.listHost.insertRow(last_pos)
1060 self.listHost.setItem(last_pos, 0, w_icon)
1061 self.listHost.setItem(last_pos, 1, w_name)
1062 self.listHost.setItem(last_pos, 2, w_h_in)
1063 self.listHost.setItem(last_pos, 3, w_h_ef)
1064 self.listHost.setItem(last_pos, 4, w_save)
1065 self.listHost.setItem(last_pos, 5, w_licc)
1067 last_pos += 1
1069 last_pos = 0
1070 list_Instrument = database.list_Instrument
1071 for i in range(len(list_Instrument)):
1072 if (SHOW_ALL or list_Instrument[i][0] in pkglist):
1073 AppName = list_Instrument[i][1]
1074 Type = list_Instrument[i][2]
1075 Binary = list_Instrument[i][3]
1076 Icon = list_Instrument[i][4]
1077 Save = list_Instrument[i][5]
1078 Level = list_Instrument[i][6]
1079 Licence = list_Instrument[i][7]
1080 Features = list_Instrument[i][8]
1081 Docs = list_Instrument[i][9]
1083 w_icon = QTableWidgetItem("")
1084 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1085 w_name = QTableWidgetItem(AppName)
1086 w_type = QTableWidgetItem(Type)
1087 w_save = QTableWidgetItem(Save)
1088 w_licc = QTableWidgetItem(Licence)
1090 self.listInstrument.insertRow(last_pos)
1091 self.listInstrument.setItem(last_pos, 0, w_icon)
1092 self.listInstrument.setItem(last_pos, 1, w_name)
1093 self.listInstrument.setItem(last_pos, 2, w_type)
1094 self.listInstrument.setItem(last_pos, 3, w_save)
1095 self.listInstrument.setItem(last_pos, 4, w_licc)
1097 last_pos += 1
1099 last_pos = 0
1100 list_Ghostess = database.list_Ghostess
1101 for i in range(len(list_Ghostess)):
1102 if (SHOW_ALL or list_Ghostess[i][0] in pkglist):
1103 AppName = list_Ghostess[i][1]
1104 Type = list_Ghostess[i][2]
1105 Binary = list_Ghostess[i][3]
1106 Icon = list_Ghostess[i][4]
1107 Save = list_Ghostess[i][5]
1108 Level = list_Ghostess[i][6]
1109 Licence = list_Ghostess[i][7]
1110 Features = list_Ghostess[i][8]
1111 Docs = list_Ghostess[i][9]
1113 w_icon = QTableWidgetItem("")
1114 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1115 w_name = QTableWidgetItem(AppName)
1116 w_type = QTableWidgetItem(Type)
1117 w_save = QTableWidgetItem(Save)
1118 w_licc = QTableWidgetItem(Licence)
1120 self.listGhostess.insertRow(last_pos)
1121 self.listGhostess.setItem(last_pos, 0, w_icon)
1122 self.listGhostess.setItem(last_pos, 1, w_name)
1123 self.listGhostess.setItem(last_pos, 2, w_type)
1124 self.listGhostess.setItem(last_pos, 3, w_save)
1125 self.listGhostess.setItem(last_pos, 4, w_licc)
1127 last_pos += 1
1129 last_pos = 0
1130 list_Bristol = database.list_Bristol
1131 for i in range(len(list_Bristol)):
1132 if (SHOW_ALL or list_Bristol[i][0] in pkglist):
1133 FullName = list_Bristol[i][1]
1134 Type = list_Bristol[i][2]
1135 ShortName = list_Bristol[i][3]
1136 Icon = list_Bristol[i][4]
1137 Save = list_Bristol[i][5]
1138 Level = list_Bristol[i][6]
1139 Licence = list_Bristol[i][7]
1140 Features = list_Bristol[i][8]
1141 Docs = list_Bristol[i][9]
1143 w_icon = QTableWidgetItem("")
1144 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1145 w_fullname = QTableWidgetItem(FullName)
1146 w_shortname = QTableWidgetItem(ShortName)
1148 self.listBristol.insertRow(last_pos)
1149 self.listBristol.setItem(last_pos, 0, w_icon)
1150 self.listBristol.setItem(last_pos, 1, w_shortname)
1151 self.listBristol.setItem(last_pos, 2, w_fullname)
1153 last_pos += 1
1155 last_pos = 0
1156 list_Effect = database.list_Effect
1157 for i in range(len(list_Effect)):
1158 if (SHOW_ALL or list_Effect[i][0] in pkglist):
1159 AppName = list_Effect[i][1]
1160 Type = list_Effect[i][2]
1161 Binary = list_Effect[i][3]
1162 Icon = list_Effect[i][4]
1163 Save = list_Effect[i][5]
1164 Level = list_Effect[i][6]
1165 Licence = list_Effect[i][7]
1166 Features = list_Effect[i][8]
1167 Docs = list_Effect[i][9]
1169 w_icon = QTableWidgetItem("")
1170 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1171 w_name = QTableWidgetItem(AppName)
1172 w_type = QTableWidgetItem(Type)
1173 w_save = QTableWidgetItem(Save)
1174 w_licc = QTableWidgetItem(Licence)
1176 self.listEffect.insertRow(last_pos)
1177 self.listEffect.setItem(last_pos, 0, w_icon)
1178 self.listEffect.setItem(last_pos, 1, w_name)
1179 self.listEffect.setItem(last_pos, 2, w_type)
1180 self.listEffect.setItem(last_pos, 3, w_save)
1181 self.listEffect.setItem(last_pos, 4, w_licc)
1183 last_pos += 1
1185 last_pos = 0
1186 list_Tool = database.list_Tool
1187 for i in range(len(list_Tool)):
1188 if (SHOW_ALL or list_Tool[i][0] in pkglist):
1189 AppName = list_Tool[i][1]
1190 Type = list_Tool[i][2]
1191 Binary = list_Tool[i][3]
1192 Icon = list_Tool[i][4]
1193 Save = list_Tool[i][5]
1194 Level = list_Tool[i][6]
1195 Licence = list_Tool[i][7]
1196 Features = list_Tool[i][8]
1197 Docs = list_Tool[i][9]
1199 w_icon = QTableWidgetItem("")
1200 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1201 w_name = QTableWidgetItem(AppName)
1202 w_type = QTableWidgetItem(Type)
1203 w_save = QTableWidgetItem(Save)
1204 w_licc = QTableWidgetItem(Licence)
1206 self.listTool.insertRow(last_pos)
1207 self.listTool.setItem(last_pos, 0, w_icon)
1208 self.listTool.setItem(last_pos, 1, w_name)
1209 self.listTool.setItem(last_pos, 2, w_type)
1210 self.listTool.setItem(last_pos, 3, w_save)
1211 self.listTool.setItem(last_pos, 4, w_licc)
1213 last_pos += 1
1215 self.listDAW.setCurrentCell(-1, -1)
1216 self.listHost.setCurrentCell(-1, -1)
1217 self.listInstrument.setCurrentCell(-1, -1)
1218 self.listGhostess.setCurrentCell(-1, -1)
1219 self.listBristol.setCurrentCell(-1, -1)
1220 self.listEffect.setCurrentCell(-1, -1)
1221 self.listTool.setCurrentCell(-1, -1)
1223 self.listDAW.sortByColumn(1, Qt.AscendingOrder)
1224 self.listHost.sortByColumn(1, Qt.AscendingOrder)
1225 self.listInstrument.sortByColumn(1, Qt.AscendingOrder)
1226 self.listGhostess.sortByColumn(1, Qt.AscendingOrder)
1227 self.listBristol.sortByColumn(2, Qt.AscendingOrder)
1228 self.listEffect.sortByColumn(1, Qt.AscendingOrder)
1229 self.listTool.sortByColumn(1, Qt.AscendingOrder)
1231 def saveSettings(self):
1232 self.settings.setValue("Geometry", QVariant(self.saveGeometry()))
1233 self.settings.setValue("SplitterDAW", self.splitter_DAW.saveState())
1234 self.settings.setValue("SplitterHost", self.splitter_Host.saveState())
1235 self.settings.setValue("SplitterInstrument", self.splitter_Instrument.saveState())
1236 self.settings.setValue("SplitterGhostess", self.splitter_Ghostess.saveState())
1237 self.settings.setValue("SplitterBristol", self.splitter_Bristol.saveState())
1238 self.settings.setValue("SplitterEffect", self.splitter_Effect.saveState())
1239 self.settings.setValue("SplitterTool", self.splitter_Tool.saveState())
1241 def loadSettings(self):
1242 self.restoreGeometry(self.settings.value("Geometry").toByteArray())
1243 self.splitter_DAW.restoreState(self.settings.value("SplitterDAW").toByteArray())
1244 self.splitter_Host.restoreState(self.settings.value("SplitterHost").toByteArray())
1245 self.splitter_Instrument.restoreState(self.settings.value("SplitterInstrument").toByteArray())
1246 self.splitter_Ghostess.restoreState(self.settings.value("SplitterGhostess").toByteArray())
1247 self.splitter_Bristol.restoreState(self.settings.value("SplitterBristol").toByteArray())
1248 self.splitter_Effect.restoreState(self.settings.value("SplitterEffect").toByteArray())
1249 self.splitter_Tool.restoreState(self.settings.value("SplitterTool").toByteArray())
1251 def closeEvent(self, event):
1252 self.saveSettings()
1253 event.accept()