Cleanup
[klaudia.git] / src / w_klaudia.py
blob49f58edc881e2e436700844226ea70295dcf6997
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 new_path = QFileDialog.getExistingDirectory(parent, parent.tr("Set Path"), current_path, QFileDialog.ShowDirsOnly)
30 if not new_path.isEmpty():
31 lineEdit.setText(new_path)
32 return new_path
34 # Properly convert QString to str
35 def QStringStr(string):
36 return str(unicode(string).encode('utf-8'))
38 # Main Window
39 class KlaudiaMainW(QMainWindow, ui_klaudia.Ui_KlaudiaMainW):
40 def __init__(self, *args):
41 QMainWindow.__init__(self, *args)
42 self.setupUi(self)
44 # Check for Jack
45 if not bool(DBus.jackBus.IsStarted()):
46 try:
47 DBus.jackBus.StartServer()
48 except:
49 QMessageBox.critical(self, self.tr("Error"), self.tr("JACK is not started!\n"
50 "Please start it first, then run Klaudia again"))
51 exit(-1)
53 # Load Settings (GUI state)
54 self.settings = QSettings()
55 if (self.settings.contains("SplitterDAW") and self.settings.contains("SplitterGhostess")):
56 self.loadSettings()
57 else: # First-Run
58 self.splitter_DAW.setSizes([500,200])
59 self.splitter_Host.setSizes([500,200])
60 self.splitter_Instrument.setSizes([500,200])
61 self.splitter_Ghostess.setSizes([500,200])
62 self.splitter_Bristol.setSizes([500,200])
63 self.splitter_Effect.setSizes([500,200])
64 self.splitter_Tool.setSizes([500,200])
66 # For the custom icons
67 self.MyIcons = XIcon()
68 self.MyIcons.addIconPath("/usr/share/klaudia/icons/")
69 self.MyIcons.addThemeName(QStringStr(QIcon.themeName()))
70 self.MyIcons.addThemeName("oxygen") # Just in case...
72 # Set-up GUI
73 self.setWindowIcon(QIcon.fromTheme("klaudia", QIcon(self.MyIcons.getIconPath("klaudia"))))
74 self.b_start.setIcon(QIcon.fromTheme("go-next", QIcon(self.MyIcons.getIconPath("go-next"))))
75 self.b_add.setIcon(QIcon.fromTheme("list-add", QIcon(self.MyIcons.getIconPath("list-add"))))
76 self.b_refresh.setIcon(QIcon.fromTheme("view-refresh", QIcon(self.MyIcons.getIconPath("view-refresh"))))
77 self.b_open.setIcon(QIcon.fromTheme("document-open", QIcon(self.MyIcons.getIconPath("document-open"))))
78 self.b_start.setEnabled(False)
79 self.b_add.setEnabled(False)
81 self.listDAW.setColumnWidth(0, 22)
82 self.listDAW.setColumnWidth(1, 150)
83 self.listDAW.setColumnWidth(2, 125)
85 self.listHost.setColumnWidth(0, 22)
86 self.listHost.setColumnWidth(1, 150)
88 self.listInstrument.setColumnWidth(0, 22)
89 self.listInstrument.setColumnWidth(1, 150)
90 self.listInstrument.setColumnWidth(2, 125)
92 self.listGhostess.setColumnWidth(0, 22)
93 self.listGhostess.setColumnWidth(1, 280)
95 self.listBristol.setColumnWidth(0, 22)
96 self.listBristol.setColumnWidth(1, 100)
98 self.listEffect.setColumnWidth(0, 22)
99 self.listEffect.setColumnWidth(1, 225)
100 self.listEffect.setColumnWidth(2, 125)
102 self.listTool.setColumnWidth(0, 22)
103 self.listTool.setColumnWidth(1, 225)
104 self.listTool.setColumnWidth(2, 125)
106 self.listDAW.setContextMenuPolicy(Qt.CustomContextMenu)
107 self.listHost.setContextMenuPolicy(Qt.CustomContextMenu)
108 self.listInstrument.setContextMenuPolicy(Qt.CustomContextMenu)
109 self.listGhostess.setContextMenuPolicy(Qt.CustomContextMenu)
110 self.listBristol.setContextMenuPolicy(Qt.CustomContextMenu)
111 self.listEffect.setContextMenuPolicy(Qt.CustomContextMenu)
112 self.listTool.setContextMenuPolicy(Qt.CustomContextMenu)
114 self.co_sample_rate.addItem(str(DBus.jackBus.GetSampleRate()))
115 self.b_refresh.setText("")
117 self.studio_root_folder = QString(os.getenv("HOME"))
118 self.le_url.setText(self.studio_root_folder)
119 self.test_url = True
120 self.test_selected = False
122 self.clearInfo_DAW()
123 self.clearInfo_Host()
124 self.clearInfo_Intrument()
125 self.clearInfo_Ghostess()
126 self.clearInfo_Bristol()
127 self.clearInfo_Effect()
128 self.clearInfo_Tool()
130 self.refreshAll()
131 self.refreshStudioList()
133 if (DBus.controlBus):
134 self.enableLADISH(True)
136 self.connect(self.b_start, SIGNAL("clicked()"), self.startApp)
137 self.connect(self.b_add, SIGNAL("clicked()"), self.addApp)
138 self.connect(self.b_refresh, SIGNAL("clicked()"), self.refreshStudioList)
140 self.connect(self.co_ladi_room, SIGNAL("currentIndexChanged(int)"), self.checkSelectedRoom)
141 self.connect(self.groupLADISH, SIGNAL("toggled(bool)"), self.enableLADISH)
143 self.connect(self.le_url, SIGNAL("textChanged(QString)"), self.checkFolderUrl)
144 self.connect(self.tabWidget, SIGNAL("currentChanged(int)"), self.checkSelectedTab)
146 self.connect(self.listDAW, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedDAW)
147 self.connect(self.listHost, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedHost)
148 self.connect(self.listInstrument, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedInstrument)
149 self.connect(self.listGhostess, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedGhostess)
150 self.connect(self.listBristol, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedBristol)
151 self.connect(self.listEffect, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedEffect)
152 self.connect(self.listTool, SIGNAL("currentCellChanged(int, int, int, int)"), self.checkSelectedTool)
153 self.connect(self.listDAW, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListDAW)
154 self.connect(self.listHost, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListHost)
155 self.connect(self.listInstrument, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListInstrument)
156 self.connect(self.listGhostess, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListGhostess)
157 self.connect(self.listBristol, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListBristol)
158 self.connect(self.listEffect, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListEffect)
159 self.connect(self.listTool, SIGNAL("cellDoubleClicked(int, int)"), self.doubleClickedListTool)
161 self.connect(self.url_documentation_daw, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
162 self.connect(self.url_website_daw, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
163 self.connect(self.url_documentation_host, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
164 self.connect(self.url_website_host, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
165 self.connect(self.url_documentation_ins, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
166 self.connect(self.url_website_ins, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
167 self.connect(self.url_documentation_ghostess, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
168 self.connect(self.url_website_ghostess, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
169 self.connect(self.url_documentation_bristol, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
170 self.connect(self.url_website_bristol, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
171 self.connect(self.url_documentation_effect, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
172 self.connect(self.url_website_effect, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
173 self.connect(self.url_documentation_tool, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
174 self.connect(self.url_website_tool, SIGNAL("leftClickedUrl(QString)"), self.openUrl)
176 self.connect(self.b_open, SIGNAL("clicked()"), lambda: getAndSetPath(self, self.le_url.text(), self.le_url))
178 def refreshStudioList(self):
179 self.co_ladi_room.clear()
180 self.co_ladi_room.addItem("<Studio Root>")
181 if (DBus.controlBus):
182 studio_bus = DBus.loopBus.get_object("org.ladish", "/org/ladish/Studio")
183 studio_list_dump = studio_bus.GetRoomList()
184 for i in range(len(studio_list_dump)):
185 self.co_ladi_room.addItem(str(studio_list_dump[i][0]).replace("/org/ladish/Room","")+" - "+studio_list_dump[i][1]['name'])
187 def checkSelectedRoom(self, co_n):
188 if (co_n == -1 or not DBus.controlBus):
189 pass
190 elif (co_n == 0):
191 DBus.studioBus = DBus.loopBus.get_object("org.ladish", "/org/ladish/Studio")
192 DBus.appBus = dbus.Interface(DBus.studioBus, 'org.ladish.AppSupervisor')
193 self.b_open.setEnabled(True)
194 self.le_url.setEnabled(True)
195 self.le_url.setText(self.studio_root_folder)
196 else:
197 room_name = "/org/ladish/Room"+QStringStr(self.co_ladi_room.currentText().split(" ")[0])
198 DBus.studioBus = DBus.loopBus.get_object("org.ladish", room_name)
199 DBus.appBus = dbus.Interface(DBus.studioBus, 'org.ladish.AppSupervisor')
200 room_properties = DBus.studioBus.GetProjectProperties()
201 if (len(room_properties[1])):
202 self.b_open.setEnabled(False)
203 self.le_url.setEnabled(False)
204 self.le_url.setText(QString(room_properties[1]['dir']))
205 else:
206 self.b_open.setEnabled(True)
207 self.le_url.setEnabled(True)
208 self.studio_root_folder = self.le_url.text()
210 def enableLADISH(self, really):
211 if (really):
212 self.groupLADISH.setCheckable(False)
213 self.groupLADISH.setTitle(self.tr("LADISH is enabled"))
215 DBus.controlBus = DBus.loopBus.get_object("org.ladish", "/org/ladish/Control")
216 DBus.studioBus = DBus.loopBus.get_object("org.ladish", "/org/ladish/Studio")
217 DBus.appBus = dbus.Interface(DBus.studioBus, 'org.ladish.AppSupervisor')
219 self.refreshStudioList()
220 self.checkButtons()
222 def getSelectedApp(self):
223 tab = self.tabWidget.currentIndex()
224 if (tab == 0):
225 listSel = self.listDAW
226 elif (tab == 1):
227 listSel = self.listHost
228 elif (tab == 2):
229 listSel = self.listInstrument
230 elif (tab == 3):
231 listSel = self.listGhostess
232 elif (tab == 4):
233 listSel = self.listBristol
234 elif (tab == 5):
235 listSel = self.listEffect
236 elif (tab == 6):
237 listSel = self.listTool
238 else:
239 return ""
241 return listSel.item(listSel.currentRow(), 1 if (tab != 4) else 2).text()
243 def getBinaryFromAppName(self, appname):
244 list_DAW = database.list_DAW
245 for i in range(len(list_DAW)):
246 if (appname == list_DAW[i][1]):
247 binary = list_DAW[i][3]
248 break
250 list_Host = database.list_Host
251 for i in range(len(list_Host)):
252 if (appname == list_Host[i][1]):
253 binary = list_Host[i][4]
254 break
256 list_Instrument = database.list_Instrument
257 for i in range(len(list_Instrument)):
258 if (appname == list_Instrument[i][1]):
259 binary = list_Instrument[i][3]
260 break
262 list_Ghostess = database.list_Ghostess
263 for i in range(len(list_Ghostess)):
264 if (appname == list_Ghostess[i][1]):
265 binary = "ghostess "+list_Ghostess[i][3]+" -hostname "+list_Ghostess[i][3].split(":")[1].replace(" ","_")
266 break
268 list_Bristol = database.list_Bristol
269 for i in range(len(list_Bristol)):
270 if (appname == list_Bristol[i][1]):
271 binary = "startBristol -audio jack -midi jack -"+list_Bristol[i][3]
272 break
274 list_Effect = database.list_Effect
275 for i in range(len(list_Effect)):
276 if (appname == list_Effect[i][1]):
277 binary = list_Effect[i][3]
278 break
280 list_Tool = database.list_Tool
281 for i in range(len(list_Tool)):
282 if (appname == list_Tool[i][1]):
283 binary = list_Tool[i][3]
284 break
286 if (binary):
287 return binary
288 else:
289 print "Error here, cod.002"
290 return ""
292 def doubleClickedListDAW(self, row, column):
293 app = self.listDAW.item(row, 1).text()
294 self.startApp(app)
296 def doubleClickedListHost(self, row, column):
297 app = self.listHost.item(row, 1).text()
298 self.startApp(app)
300 def doubleClickedListInstrument(self, row, column):
301 app = self.listInstrument.item(row, 1).text()
302 self.startApp(app)
304 def doubleClickedListGhostess(self, row, column):
305 app = self.listGhostess.item(row, 1).text()
306 self.startApp(app)
308 def doubleClickedListBristol(self, row, column):
309 app = self.listBristol.item(row, 2).text()
310 self.startApp(app)
312 def doubleClickedListEffect(self, row, column):
313 app = self.listEffect.item(row, 1).text()
314 self.startApp(app)
316 def doubleClickedListTool(self, row, column):
317 app = self.listTool.item(row, 1).text()
318 self.startApp(app)
320 def startApp(self, app=None):
321 if (not app):
322 app = self.getSelectedApp()
323 binary = self.getBinaryFromAppName(app)
324 os.system("cd "+QStringStr(self.le_url.text())+" && "+binary+" &")
326 def addApp(self):
327 app = self.getSelectedApp()
328 binary = self.getBinaryFromAppName(app)
330 ran_check = str(randint(1, 99999))
331 sample_rate = str(self.co_sample_rate.currentText())
332 url_folder = QStringStr(self.le_url.text())
333 proj_bpm = str(self.sb_bpm.text())
335 if (url_folder[-1] != "/"):
336 url_folder += "/"
338 if (binary.split(" ")[0] == "startBristol"):
339 synth = binary.split("-audio jack -midi jack -")[1]
340 proj_folder = url_folder+"bristol_"+synth+"_"+ran_check
341 os.mkdir(proj_folder)
342 if (not self.le_url.isEnabled()): proj_folder = proj_folder.replace(url_folder,"")
343 cmd = binary+" -emulate "+synth+" -cache "+proj_folder+" -memdump "+proj_folder+" -import "+proj_folder+"/memory -exec"
344 DBus.appBus.RunCustom(False, cmd, str(app), 1)
346 elif (app == "Ardour" or app == "ArdourVST" or app == "ArdourVST (32bit)"):
347 proj_folder = url_folder+"Ardour2_"+ran_check
348 os.mkdir(proj_folder)
349 os.system("cp "+sys.path[0]+"/../templates/Ardour2/* '"+proj_folder+"'")
350 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_folder+'/Ardour2.ardour"')
351 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_folder+'/Ardour2.ardour"')
352 os.system("cd '"+proj_folder+"' && mv Ardour2.ardour Ardour2_"+ran_check+".ardour")
353 os.mkdir(proj_folder+"/analysis")
354 os.mkdir(proj_folder+"/dead_sounds")
355 os.mkdir(proj_folder+"/export")
356 os.mkdir(proj_folder+"/interchange")
357 os.mkdir(proj_folder+"/interchange/Ardour")
358 os.mkdir(proj_folder+"/interchange/Ardour/audiofiles")
359 os.mkdir(proj_folder+"/peaks")
360 if (not self.le_url.isEnabled()): proj_folder = proj_folder.replace(url_folder,"")
361 DBus.appBus.RunCustom(False, binary+" '"+proj_folder+"'", str(app), 1)
362 elif (app == "Hydrogen" or app == "Hydrogen (SVN)"):
363 if (app == "Hydrogen (SVN)"):
364 level = 1
365 else:
366 level = 0
367 proj_file = url_folder+"Hydrogen_"+ran_check+".h2song"
368 os.system("cp "+sys.path[0]+"/../templates/Hydrogen.h2song '"+proj_file+"'")
369 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'"')
370 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
371 DBus.appBus.RunCustom(False, "hydrogen -s '"+proj_file+"'", str(app), level)
372 elif (app == "Jacker"):
373 proj_bpm = proj_bpm.split(".")[0] # No decimal bpm support
374 proj_file = url_folder+"Jacker_"+ran_check+".jsong"
375 os.system("cp "+sys.path[0]+"/../templates/Jacker.jsong '"+proj_file+"'")
376 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'"')
377 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
378 DBus.appBus.RunCustom(False, "jacker '"+proj_file+"'", str(app), 1)
379 elif (app == "MusE" or app == "MusE (SVN)"):
380 proj_file = url_folder+"MusE_"+ran_check+".med"
381 os.system("cp "+sys.path[0]+"/../templates/MusE.med '"+proj_file+"'")
382 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
383 DBus.appBus.RunCustom(False, "muse '"+proj_file+"'", str(app), 0)
384 elif (app == "Non-DAW"):
385 proj_file = url_folder+"Non-DAW_"+ran_check
386 os.system("cp -r "+sys.path[0]+"/../templates/Non-DAW '"+proj_file+"'")
387 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'/history"')
388 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'/info"')
389 os.system('mkdir -p "'+proj_file+'/sources"')
390 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
391 DBus.appBus.RunCustom(False, "non-daw '"+proj_file+"'", str(app), 0)
392 elif (app == "Non-Sequencer"):
393 proj_file = url_folder+"Non-Sequencer_"+ran_check+".non"
394 os.system("cp "+sys.path[0]+"/../templates/Non-Sequencer.non '"+proj_file+"'")
395 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
396 DBus.appBus.RunCustom(False, "non-sequencer '"+proj_file+"'", str(app), 0)
397 elif (app == "Qtractor" or app == "QtractorVST" or app == "QtractorVST (32bit)" or app == "Qtractor (SVN)"):
398 proj_file = url_folder+"Qtractor_"+ran_check+".qtr"
399 os.system("cp "+sys.path[0]+"/../templates/Qtractor.qtr '"+proj_file+"'")
400 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'"')
401 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'"')
402 os.system('sed -i "s/X_FOLDER_X-KLAUDIA-X_FOLDER_X/'+url_folder.replace("/","\/")+'/" "'+proj_file+'"')
403 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
404 DBus.appBus.RunCustom(False, binary+" '"+proj_file+"'", str(app), 1)
405 elif (app == "Renoise" or app == "Renoise (64bit)"):
406 os.mkdir(url_folder+"tmp_bu")
407 os.system("cp "+sys.path[0]+"/../templates/Renoise.xml "+url_folder+"/tmp_bu")
408 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+url_folder+'/tmp_bu/Renoise.xml"')
409 os.system("cd '"+url_folder+"tmp_bu' && mv Renoise.xml Song.xml && zip ../Renoise_"+ran_check+".xrns Song.xml")
410 os.system("rm -rf '"+url_folder+"tmp_bu'")
411 if (not self.le_url.isEnabled()): url_folder = ""
412 DBus.appBus.RunCustom(False, binary+" '"+url_folder+"Renoise_"+ran_check+".xrns'", str(app), 0)
413 elif (app == "Rosegarden"):
414 proj_file = url_folder+"Rosegarden_"+ran_check+".rg"
415 os.system("cp "+sys.path[0]+"/../templates/Rosegarden.rg '"+proj_file+"'")
416 os.system('sed -i "s/X_BPM_X-KLAUDIA-X_BPM_X/'+proj_bpm+'/" "'+proj_file+'"')
417 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
418 DBus.appBus.RunCustom(False, "rosegarden '"+proj_file+"'", str(app), 1)
419 elif (app == "Seq24"):
420 proj_file = url_folder+"Seq24_"+ran_check+".midi"
421 os.system("cp "+sys.path[0]+"/../templates/Seq24.midi '"+proj_file+"'")
422 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
423 DBus.appBus.RunCustom(False, "seq24 --manual_alsa_ports '"+proj_file+"'", str(app), 1)
425 elif (app == "Calf Jack Host (GIT)"):
426 proj_file = url_folder+"CalfJackHost_"+ran_check
427 os.system("cp "+sys.path[0]+"/../templates/CalfJackHost '"+proj_file+"'")
428 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
429 DBus.appBus.RunCustom(False, "calfjackhost --load '"+proj_file+"'", str(app), 1)
430 elif (app == "FeSTige"):
431 room_name = ""
432 if (self.co_ladi_room.currentIndex() > 0):
433 room_name = '"' + QStringStr(self.co_ladi_room.currentText()).split(" - ")[1] + '"'
434 DBus.appBus.RunCustom(False, "festige "+url_folder+" "+room_name, str(app), 0)
435 #elif (app == "Ingen" or app == "Ingen (SVN)"):
436 #if (app == "Ingen (SVN)"):
437 #binary = "ingen-svn"
438 #else:
439 #binary = "ingen"
440 #proj_file = url_folder+"/"+"ingen_"+ran_check+".ing.lv2"
441 #os.system("cp -r "+sys.path[0]+"/../templates/ingen.ing.lv2 '"+proj_file+"'")
442 #if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
443 #DBus.appBus.RunCustom(False, binary+" -egl '"+proj_file+"'", str(app), 0)
444 elif (app == "Jack Rack"):
445 proj_file = url_folder+"Jack-Rack_"+ran_check+".xml"
446 os.system("cp "+sys.path[0]+"/../templates/Jack-Rack.xml '"+proj_file+"'")
447 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'"')
448 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
449 DBus.appBus.RunCustom(False, "jack-rack -s '"+str(app)+"' '"+proj_file+"'", str(app), 0)
451 elif (app == "Qsampler" or app == "Qsampler (SVN)"):
452 if (app == "Qsampler (SVN)"):
453 level = 1
454 else:
455 level = 0
456 proj_file = url_folder+"Qsampler_"+ran_check+".lscp"
457 os.system("cp "+sys.path[0]+"/../templates/Qsampler.lscp '"+proj_file+"'")
458 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
459 DBus.appBus.RunCustom(False, "qsampler '"+proj_file+"'", str(app), level)
460 elif (app == "Yoshimi"):
461 proj_file = url_folder+"Yoshimi_"+ran_check+".state"
462 os.system("cp "+sys.path[0]+"/../templates/Yoshimi.state '"+proj_file+"'")
463 os.system('sed -i "s/X_SR_X-KLAUDIA-X_SR_X/'+sample_rate+'/" "'+proj_file+'"')
464 os.system('sed -i "s/X_FILE_X-KLAUDIA-X_FILE_X/'+proj_file.replace("/","\/")+'/" "'+proj_file+'"')
465 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
466 DBus.appBus.RunCustom(False, "yoshimi -j -J --state='"+proj_file+"'", str(app), 1)
468 elif (app == "Jamin"):
469 proj_file = url_folder+"Jamin_"+ran_check+".jam"
470 os.system("cp "+sys.path[0]+"/../templates/Jamin.jam '"+proj_file+"'")
471 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
472 DBus.appBus.RunCustom(False, "jamin -f '"+proj_file+"'", str(app), 0)
474 elif (app == "Jack Mixer"):
475 proj_file = url_folder+"Jack-Mixer_"+ran_check+".xml"
476 os.system("cp "+sys.path[0]+"/../templates/Jack-Mixer.xml '"+proj_file+"'")
477 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
478 DBus.appBus.RunCustom(False, "jack_mixer -c '"+proj_file+"'", str(app), 1)
479 elif (app == "Non-Mixer"):
480 proj_file = url_folder+"Non-Mixer_"+ran_check
481 os.system("cp -r "+sys.path[0]+"/../templates/Non-Mixer '"+proj_file+"'")
482 if (not self.le_url.isEnabled()): proj_file = proj_file.replace(url_folder,"")
483 DBus.appBus.RunCustom(False, "non-mixer '"+proj_file+"'", str(app), 0)
485 else:
486 DBus.appBus.RunCustom(False, binary, str(app), 0)
488 def clearInfo_DAW(self):
489 self.ico_app_daw.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
490 self.label_name_daw.setText("App Name")
491 self.ico_ladspa_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
492 self.ico_dssi_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
493 self.ico_lv2_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
494 self.ico_vst_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
495 self.label_vst_mode_daw.setText("")
496 self.ico_jack_transport_daw.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
497 self.label_midi_mode_daw.setText("---")
498 self.label_ladish_level_daw.setText("0")
499 self.showDoc_DAW(0, 0)
500 self.frame_DAW.setEnabled(False)
502 def clearInfo_Host(self):
503 self.ico_app_host.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
504 self.label_name_host.setText("App Name")
505 self.ico_ladspa_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
506 self.ico_dssi_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
507 self.ico_lv2_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
508 self.ico_vst_host.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
509 self.label_vst_mode_host.setText("")
510 self.label_midi_mode_host.setText("---")
511 self.label_ladish_level_host.setText("0")
512 self.showDoc_Host(0, 0)
513 self.frame_Host.setEnabled(False)
515 def clearInfo_Intrument(self):
516 self.ico_app_ins.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
517 self.label_name_ins.setText("App Name")
518 self.ico_builtin_fx_ins.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
519 self.ico_audio_input_ins.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
520 self.label_midi_mode_ins.setText("---")
521 self.label_ladish_level_ins.setText("0")
522 self.showDoc_Instrument(0, 0)
523 self.frame_Instrument.setEnabled(False)
525 def clearInfo_Ghostess(self):
526 self.ico_app_ghostess.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
527 self.label_name_ghostess.setText("App Name")
528 self.ico_builtin_fx_ghostess.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
529 self.ico_stereo_ghostess.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
530 self.label_midi_mode_ghostess.setText("---")
531 self.label_ladish_level_ghostess.setText("0")
532 self.showDoc_Ghostess(0, 0)
533 self.frame_Ghostess.setEnabled(False)
535 def clearInfo_Bristol(self):
536 self.ico_app_bristol.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
537 self.label_name_bristol.setText("App Name")
538 self.ico_builtin_fx_bristol.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
539 self.ico_audio_input_bristol.setPixmap(QIcon("dialog-cancel").pixmap(16, 16))
540 self.label_midi_mode_bristol.setText("---")
541 self.label_ladish_level_bristol.setText("0")
542 self.showDoc_Bristol(0, 0)
543 self.frame_Bristol.setEnabled(False)
545 def clearInfo_Effect(self):
546 self.ico_app_effect.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
547 self.label_name_effect.setText("App Name")
548 self.ico_stereo_effect.setPixmap(QIcon.fromTheme("dialog-cancel").pixmap(16, 16))
549 self.label_midi_mode_effect.setText("---")
550 self.label_ladish_level_effect.setText("0")
551 self.showDoc_Effect(0, 0)
552 self.frame_Effect.setEnabled(False)
554 def clearInfo_Tool(self):
555 self.ico_app_tool.setPixmap(QIcon.fromTheme("start-here").pixmap(48, 48))
556 self.label_name_tool.setText("App Name")
557 self.label_midi_mode_tool.setText("---")
558 self.label_ladish_level_tool.setText("0")
559 self.showDoc_Tool(0, 0)
560 self.frame_Tool.setEnabled(False)
562 def checkFolderUrl(self, url):
563 if (os.path.exists(QStringStr(url))):
564 self.test_url = True
565 if (self.le_url.isEnabled()):
566 self.studio_root_folder = url
567 else:
568 self.test_url = False
569 self.checkButtons()
571 def checkSelectedTab(self, tab):
572 self.test_selected = False
573 if (tab == 0): # DAW
574 if (self.listDAW.selectedItems()):
575 self.test_selected = True
576 elif (tab == 1): # Host
577 if (self.listHost.selectedItems()):
578 self.test_selected = True
579 elif (tab == 2): # Instrument
580 if (self.listInstrument.selectedItems()):
581 self.test_selected = True
582 elif (tab == 3): # Ghostess
583 if (self.listGhostess.selectedItems()):
584 self.test_selected = True
585 elif (tab == 4): # Bristol
586 if (self.listBristol.selectedItems()):
587 self.test_selected = True
588 elif (tab == 5): # Effect
589 if (self.listEffect.selectedItems()):
590 self.test_selected = True
591 elif (tab == 6): # Tool
592 if (self.listTool.selectedItems()):
593 self.test_selected = True
595 self.checkButtons()
597 def checkSelectedDAW(self, row, column, p_row, p_column):
598 if (row >= 0):
599 self.test_selected = True
601 app_name = self.listDAW.item(row, 1).text()
602 app_info = []
603 list_DAW = database.list_DAW
605 for i in range(len(list_DAW)):
606 if (app_name == list_DAW[i][1]):
607 app_info = list_DAW[i]
608 break
610 if (not app_info):
611 print "Error here, cod.001"
612 return
614 self.frame_DAW.setEnabled(True)
615 self.ico_app_daw.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
616 self.ico_ladspa_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
617 self.ico_dssi_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
618 self.ico_lv2_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][2]), 16)).pixmap(16, 16))
619 self.ico_vst_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][3]), 16)).pixmap(16, 16))
620 self.ico_jack_transport_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][5]), 16)).pixmap(16, 16))
621 self.label_name_daw.setText(app_info[1])
622 self.label_vst_mode_daw.setText(app_info[8][4])
623 self.ico_midi_mode_daw.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][6]), 16)).pixmap(16, 16))
624 self.label_midi_mode_daw.setText(app_info[8][7])
625 self.label_ladish_level_daw.setText(str(app_info[6]))
627 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
628 self.showDoc_DAW(doc, app_info[9][1])
629 else:
630 self.test_selected = False
631 self.clearInfo_DAW()
632 self.checkButtons()
634 def checkSelectedHost(self, row, column, p_row, p_column):
635 if (row >= 0):
636 self.test_selected = True
638 app_name = self.listHost.item(row, 1).text()
639 app_info = []
640 list_Host = database.list_Host
642 for i in range(len(list_Host)):
643 if (app_name == list_Host[i][1]):
644 app_info = list_Host[i]
645 break
647 if (not app_info):
648 print "Error here, cod.003"
649 return
651 self.frame_Host.setEnabled(True)
652 self.ico_app_host.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[5], 48)).pixmap(48, 48))
653 self.ico_internal_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][0]), 16)).pixmap(16, 16))
654 self.ico_ladspa_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][1]), 16)).pixmap(16, 16))
655 self.ico_dssi_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][2]), 16)).pixmap(16, 16))
656 self.ico_lv2_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][3]), 16)).pixmap(16, 16))
657 self.ico_vst_host.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[9][4]), 16)).pixmap(16, 16))
658 self.label_name_host.setText(app_info[1])
659 self.label_vst_mode_host.setText(app_info[9][5])
660 self.label_midi_mode_host.setText(app_info[9][6])
661 self.label_ladish_level_host.setText(str(app_info[7]))
663 doc = app_info[10][0] if (os.path.exists(app_info[10][0].replace("file://",""))) else ""
664 self.showDoc_Host(doc, app_info[10][1])
665 else:
666 self.test_selected = False
667 self.clearInfo_DAW()
668 self.checkButtons()
670 def checkSelectedInstrument(self, row, column, p_row, p_column):
671 if (row >= 0):
672 self.test_selected = True
674 app_name = self.listInstrument.item(row, 1).text()
675 app_info = []
676 list_Instrument = database.list_Instrument
678 for i in range(len(list_Instrument)):
679 if (app_name == list_Instrument[i][1]):
680 app_info = list_Instrument[i]
681 break
683 if (not app_info):
684 print "Error here, cod.004"
685 return
687 self.frame_Instrument.setEnabled(True)
688 self.ico_app_ins.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
689 self.ico_builtin_fx_ins.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
690 self.ico_audio_input_ins.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
691 self.label_name_ins.setText(app_info[1])
692 self.label_midi_mode_ins.setText(app_info[8][2])
693 self.label_ladish_level_ins.setText(str(app_info[6]))
695 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
696 self.showDoc_Instrument(doc, app_info[9][1])
697 else:
698 self.test_selected = False
699 self.clearInfo_Intrument()
700 self.checkButtons()
702 def checkSelectedGhostess(self, row, column, p_row, p_column):
703 if (row >= 0):
704 self.test_selected = True
706 app_name = self.listGhostess.item(row, 1).text()
707 app_info = []
708 list_Ghostess = database.list_Ghostess
710 for i in range(len(list_Ghostess)):
711 if (app_name == list_Ghostess[i][1]):
712 app_info = list_Ghostess[i]
713 break
715 if (not app_info):
716 print "Error here, cod.004"
717 return
719 self.frame_Ghostess.setEnabled(True)
720 self.ico_app_ghostess.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
721 self.ico_builtin_fx_ghostess.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
722 self.ico_stereo_ghostess.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
723 self.label_name_ghostess.setText(app_info[1])
724 self.label_midi_mode_ghostess.setText(app_info[8][2])
725 self.label_ladish_level_ghostess.setText(str(app_info[6]))
727 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
728 self.showDoc_Ghostess(doc, app_info[9][1])
729 else:
730 self.test_selected = False
731 self.clearInfo_Ghostess()
732 self.checkButtons()
734 def checkSelectedBristol(self, row, column, p_row, p_column):
735 if (row >= 0):
736 self.test_selected = True
738 app_name = self.listBristol.item(row, 2).text()
739 app_info = []
740 list_Bristol = database.list_Bristol
742 for i in range(len(list_Bristol)):
743 if (app_name == list_Bristol[i][1]):
744 app_info = list_Bristol[i]
745 break
747 if (not app_info):
748 print "Error here, cod.007"
749 return
751 self.frame_Bristol.setEnabled(True)
752 self.ico_app_bristol.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
753 self.ico_builtin_fx_bristol.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
754 self.ico_audio_input_bristol.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
755 self.label_name_bristol.setText(app_info[1])
756 self.label_midi_mode_bristol.setText(app_info[8][2])
757 self.label_ladish_level_bristol.setText(str(app_info[6]))
759 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
760 self.showDoc_Bristol(doc, app_info[9][1])
761 else:
762 self.test_selected = False
763 self.clearInfo_Bristol()
764 self.checkButtons()
766 def checkSelectedEffect(self, row, column, p_row, p_column):
767 if (row >= 0):
768 self.test_selected = True
770 app_name = self.listEffect.item(row, 1).text()
771 app_info = []
772 list_Effect = database.list_Effect
774 for i in range(len(list_Effect)):
775 if (app_name == list_Effect[i][1]):
776 app_info = list_Effect[i]
777 break
779 if (not app_info):
780 print "Error here, cod.005"
781 return
783 self.frame_Effect.setEnabled(True)
784 self.ico_app_effect.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
785 self.ico_stereo_effect.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][0]), 16)).pixmap(16, 16))
786 self.label_name_effect.setText(app_info[1])
787 self.label_midi_mode_effect.setText(app_info[8][1])
788 self.label_ladish_level_effect.setText(str(app_info[6]))
790 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
791 self.showDoc_Effect(doc, app_info[9][1])
792 else:
793 self.test_selected = False
794 self.clearInfo_Effect()
795 self.checkButtons()
797 def checkSelectedTool(self, row, column, p_row, p_column):
798 if (row >= 0):
799 self.test_selected = True
801 app_name = self.listTool.item(row, 1).text()
802 app_info = []
803 list_Tool = database.list_Tool
805 for i in range(len(list_Tool)):
806 if (app_name == list_Tool[i][1]):
807 app_info = list_Tool[i]
808 break
810 if (not app_info):
811 print "Error here, cod.006"
812 return
814 self.frame_Tool.setEnabled(True)
815 self.ico_app_tool.setPixmap(QIcon(self.MyIcons.getIconPath(app_info[4], 48)).pixmap(48, 48))
816 self.label_name_tool.setText(app_info[1])
817 self.label_midi_mode_tool.setText(app_info[8][0])
818 self.ico_jack_transport_tool.setPixmap(QIcon(self.MyIcons.getIconPath(self.getIconForYesNo(app_info[8][1]), 16)).pixmap(16, 16))
819 self.label_ladish_level_tool.setText(str(app_info[6]))
821 doc = app_info[9][0] if (os.path.exists(app_info[9][0].replace("file://",""))) else ""
822 self.showDoc_Tool(doc, app_info[9][1])
823 else:
824 self.test_selected = False
825 self.clearInfo_Tool()
826 self.checkButtons()
828 def setDocUrl(self, item, link):
829 item.setText(self.tr("<a href='%1'>Documentation</a>").arg(link))
831 def setWebUrl(self, item, link):
832 item.setText(self.tr("<a href='%1'>WebSite</a>").arg(link))
834 def showDoc_DAW(self, doc, web):
835 if (doc):
836 self.url_documentation_daw.setVisible(True)
837 self.setDocUrl(self.url_documentation_daw, doc)
838 else: self.url_documentation_daw.setVisible(False)
840 if (web):
841 self.url_website_daw.setVisible(True)
842 self.setWebUrl(self.url_website_daw, web)
843 else: self.url_website_daw.setVisible(False)
845 if (not doc and not web):
846 self.label_no_help_daw.setVisible(True)
847 else:
848 self.label_no_help_daw.setVisible(False)
850 def showDoc_Host(self, doc, web):
851 if (doc):
852 self.url_documentation_host.setVisible(True)
853 self.setDocUrl(self.url_documentation_host, doc)
854 else: self.url_documentation_host.setVisible(False)
856 if (web):
857 self.url_website_host.setVisible(True)
858 self.setWebUrl(self.url_website_host, web)
859 else: self.url_website_host.setVisible(False)
861 if (not doc and not web):
862 self.label_no_help_host.setVisible(True)
863 else:
864 self.label_no_help_host.setVisible(False)
866 def showDoc_Instrument(self, doc, web):
867 if (doc):
868 self.url_documentation_ins.setVisible(True)
869 self.setDocUrl(self.url_documentation_ins, doc)
870 else: self.url_documentation_ins.setVisible(False)
872 if (web):
873 self.url_website_ins.setVisible(True)
874 self.setWebUrl(self.url_website_ins, web)
875 else: self.url_website_ins.setVisible(False)
877 if (not doc and not web):
878 self.label_no_help_ins.setVisible(True)
879 else:
880 self.label_no_help_ins.setVisible(False)
882 def showDoc_Ghostess(self, doc, web):
883 if (doc):
884 self.url_documentation_ghostess.setVisible(True)
885 self.setDocUrl(self.url_documentation_ghostess, doc)
886 else: self.url_documentation_ghostess.setVisible(False)
888 if (web):
889 self.url_website_ghostess.setVisible(True)
890 self.setWebUrl(self.url_website_ghostess, web)
891 else: self.url_website_ghostess.setVisible(False)
893 if (not doc and not web):
894 self.label_no_help_ghostess.setVisible(True)
895 else:
896 self.label_no_help_ghostess.setVisible(False)
898 def showDoc_Bristol(self, doc, web):
899 if (doc):
900 self.url_documentation_bristol.setVisible(True)
901 self.setDocUrl(self.url_documentation_bristol, doc)
902 else: self.url_documentation_bristol.setVisible(False)
904 if (web):
905 self.url_website_bristol.setVisible(True)
906 self.setWebUrl(self.url_website_bristol, web)
907 else: self.url_website_bristol.setVisible(False)
909 if (not doc and not web):
910 self.label_no_help_bristol.setVisible(True)
911 else:
912 self.label_no_help_bristol.setVisible(False)
914 def showDoc_Effect(self, doc, web):
915 if (doc):
916 self.url_documentation_effect.setVisible(True)
917 self.setDocUrl(self.url_documentation_effect, doc)
918 else: self.url_documentation_effect.setVisible(False)
920 if (web):
921 self.url_website_effect.setVisible(True)
922 self.setWebUrl(self.url_website_effect, web)
923 else: self.url_website_effect.setVisible(False)
925 if (not doc and not web):
926 self.label_no_help_effect.setVisible(True)
927 else:
928 self.label_no_help_effect.setVisible(False)
930 def showDoc_Tool(self, doc, web):
931 if (doc):
932 self.url_documentation_tool.setVisible(True)
933 self.setDocUrl(self.url_documentation_tool, doc)
934 else: self.url_documentation_tool.setVisible(False)
936 if (web):
937 self.url_website_tool.setVisible(True)
938 self.setWebUrl(self.url_website_tool, web)
939 else: self.url_website_tool.setVisible(False)
941 if (not doc and not web):
942 self.label_no_help_tool.setVisible(True)
943 else:
944 self.label_no_help_tool.setVisible(False)
946 def openUrl(self, url):
947 os.system("xdg-open '"+str(url)+"' &")
949 def checkButtons(self):
950 if (self.test_url and self.test_selected):
951 self.b_add.setEnabled(bool(DBus.controlBus))
952 self.b_start.setEnabled(True)
953 else:
954 self.b_add.setEnabled(False)
955 self.b_start.setEnabled(False)
957 def clearAll(self):
958 self.listDAW.clearContents()
959 self.listHost.clearContents()
960 self.listInstrument.clearContents()
961 self.listGhostess.clearContents()
962 self.listBristol.clearContents()
963 self.listEffect.clearContents()
964 self.listTool.clearContents()
965 for i in range(self.listDAW.rowCount()):
966 self.listDAW.removeRow(0)
967 for i in range(self.listHost.rowCount()):
968 self.listHost.removeRow(0)
969 for i in range(self.listInstrument.rowCount()):
970 self.listInstrument.removeRow(0)
971 for i in range(self.listGhostess.rowCount()):
972 self.listGhostess.removeRow(0)
973 for i in range(self.listBristol.rowCount()):
974 self.listBristol.removeRow(0)
975 for i in range(self.listEffect.rowCount()):
976 self.listEffect.removeRow(0)
977 for i in range(self.listTool.rowCount()):
978 self.listTool.removeRow(0)
980 def getIconForYesNo(self, yesno):
981 if (yesno):
982 return "dialog-ok-apply"
983 else:
984 return "dialog-cancel"
986 def refreshAll(self):
987 self.clearAll()
989 if (not SHOW_ALL):
990 pkglist = []
992 if (os.path.exists("/usr/bin/dpkg")):
993 pkg_out = getoutput("dpkg -l").split("\n")
994 for i in range(len(pkg_out)):
995 if (pkg_out[i][0] == "i" and pkg_out[i][1] == "i"):
996 package = pkg_out[i].split()[1]
997 pkglist.append(package)
998 elif (os.path.exists("/usr/bin/pacman")):
999 pkg_out = getoutput("pacman -Qsq").split("\n")
1000 for i in range(len(pkg_out)):
1001 package = pkg_out[i]
1002 pkglist.append(package)
1004 if (not SHOW_ALL and not "ghostess" in pkglist):
1005 self.tabWidget.setTabEnabled(3, False)
1006 if (not SHOW_ALL and not "bristol" in pkglist):
1007 self.tabWidget.setTabEnabled(4, False)
1009 last_pos = 0
1010 list_DAW = database.list_DAW
1011 for i in range(len(list_DAW)):
1012 if (SHOW_ALL or list_DAW[i][0] in pkglist):
1013 AppName = list_DAW[i][1]
1014 Type = list_DAW[i][2]
1015 Binary = list_DAW[i][3]
1016 Icon = list_DAW[i][4]
1017 Save = list_DAW[i][5]
1018 Level = list_DAW[i][6]
1019 Licence = list_DAW[i][7]
1020 Features = list_DAW[i][8]
1021 Docs = list_DAW[i][9]
1023 w_icon = QTableWidgetItem("")
1024 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1025 w_name = QTableWidgetItem(AppName)
1026 w_type = QTableWidgetItem(Type)
1027 w_save = QTableWidgetItem(Save)
1028 w_licc = QTableWidgetItem(Licence)
1030 self.listDAW.insertRow(last_pos)
1031 self.listDAW.setItem(last_pos, 0, w_icon)
1032 self.listDAW.setItem(last_pos, 1, w_name)
1033 self.listDAW.setItem(last_pos, 2, w_type)
1034 self.listDAW.setItem(last_pos, 3, w_save)
1035 self.listDAW.setItem(last_pos, 4, w_licc)
1037 last_pos += 1
1039 last_pos = 0
1040 list_Host = database.list_Host
1041 for i in range(len(list_Host)):
1042 if (SHOW_ALL or list_Host[i][0] in pkglist):
1043 AppName = list_Host[i][1]
1044 Has_Ins = list_Host[i][2]
1045 Has_Eff = list_Host[i][3]
1046 Binary = list_Host[i][4]
1047 Icon = list_Host[i][5]
1048 Save = list_Host[i][6]
1049 Level = list_Host[i][7]
1050 Licence = list_Host[i][8]
1051 Features = list_Host[i][9]
1052 Docs = list_Host[i][10]
1054 w_icon = QTableWidgetItem("")
1055 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1056 w_name = QTableWidgetItem(AppName)
1057 w_h_in = QTableWidgetItem(Has_Ins)
1058 w_h_ef = QTableWidgetItem(Has_Eff)
1059 w_save = QTableWidgetItem(Save)
1060 w_licc = QTableWidgetItem(Licence)
1062 self.listHost.insertRow(last_pos)
1063 self.listHost.setItem(last_pos, 0, w_icon)
1064 self.listHost.setItem(last_pos, 1, w_name)
1065 self.listHost.setItem(last_pos, 2, w_h_in)
1066 self.listHost.setItem(last_pos, 3, w_h_ef)
1067 self.listHost.setItem(last_pos, 4, w_save)
1068 self.listHost.setItem(last_pos, 5, w_licc)
1070 last_pos += 1
1072 last_pos = 0
1073 list_Instrument = database.list_Instrument
1074 for i in range(len(list_Instrument)):
1075 if (SHOW_ALL or list_Instrument[i][0] in pkglist):
1076 AppName = list_Instrument[i][1]
1077 Type = list_Instrument[i][2]
1078 Binary = list_Instrument[i][3]
1079 Icon = list_Instrument[i][4]
1080 Save = list_Instrument[i][5]
1081 Level = list_Instrument[i][6]
1082 Licence = list_Instrument[i][7]
1083 Features = list_Instrument[i][8]
1084 Docs = list_Instrument[i][9]
1086 w_icon = QTableWidgetItem("")
1087 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1088 w_name = QTableWidgetItem(AppName)
1089 w_type = QTableWidgetItem(Type)
1090 w_save = QTableWidgetItem(Save)
1091 w_licc = QTableWidgetItem(Licence)
1093 self.listInstrument.insertRow(last_pos)
1094 self.listInstrument.setItem(last_pos, 0, w_icon)
1095 self.listInstrument.setItem(last_pos, 1, w_name)
1096 self.listInstrument.setItem(last_pos, 2, w_type)
1097 self.listInstrument.setItem(last_pos, 3, w_save)
1098 self.listInstrument.setItem(last_pos, 4, w_licc)
1100 last_pos += 1
1102 last_pos = 0
1103 list_Ghostess = database.list_Ghostess
1104 for i in range(len(list_Ghostess)):
1105 if (SHOW_ALL or list_Ghostess[i][0] in pkglist):
1106 AppName = list_Ghostess[i][1]
1107 Type = list_Ghostess[i][2]
1108 Binary = list_Ghostess[i][3]
1109 Icon = list_Ghostess[i][4]
1110 Save = list_Ghostess[i][5]
1111 Level = list_Ghostess[i][6]
1112 Licence = list_Ghostess[i][7]
1113 Features = list_Ghostess[i][8]
1114 Docs = list_Ghostess[i][9]
1116 w_icon = QTableWidgetItem("")
1117 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1118 w_name = QTableWidgetItem(AppName)
1119 w_type = QTableWidgetItem(Type)
1120 w_save = QTableWidgetItem(Save)
1121 w_licc = QTableWidgetItem(Licence)
1123 self.listGhostess.insertRow(last_pos)
1124 self.listGhostess.setItem(last_pos, 0, w_icon)
1125 self.listGhostess.setItem(last_pos, 1, w_name)
1126 self.listGhostess.setItem(last_pos, 2, w_type)
1127 self.listGhostess.setItem(last_pos, 3, w_save)
1128 self.listGhostess.setItem(last_pos, 4, w_licc)
1130 last_pos += 1
1132 last_pos = 0
1133 list_Bristol = database.list_Bristol
1134 for i in range(len(list_Bristol)):
1135 if (SHOW_ALL or list_Bristol[i][0] in pkglist):
1136 FullName = list_Bristol[i][1]
1137 Type = list_Bristol[i][2]
1138 ShortName = list_Bristol[i][3]
1139 Icon = list_Bristol[i][4]
1140 Save = list_Bristol[i][5]
1141 Level = list_Bristol[i][6]
1142 Licence = list_Bristol[i][7]
1143 Features = list_Bristol[i][8]
1144 Docs = list_Bristol[i][9]
1146 w_icon = QTableWidgetItem("")
1147 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1148 w_fullname = QTableWidgetItem(FullName)
1149 w_shortname = QTableWidgetItem(ShortName)
1151 self.listBristol.insertRow(last_pos)
1152 self.listBristol.setItem(last_pos, 0, w_icon)
1153 self.listBristol.setItem(last_pos, 1, w_shortname)
1154 self.listBristol.setItem(last_pos, 2, w_fullname)
1156 last_pos += 1
1158 last_pos = 0
1159 list_Effect = database.list_Effect
1160 for i in range(len(list_Effect)):
1161 if (SHOW_ALL or list_Effect[i][0] in pkglist):
1162 AppName = list_Effect[i][1]
1163 Type = list_Effect[i][2]
1164 Binary = list_Effect[i][3]
1165 Icon = list_Effect[i][4]
1166 Save = list_Effect[i][5]
1167 Level = list_Effect[i][6]
1168 Licence = list_Effect[i][7]
1169 Features = list_Effect[i][8]
1170 Docs = list_Effect[i][9]
1172 w_icon = QTableWidgetItem("")
1173 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1174 w_name = QTableWidgetItem(AppName)
1175 w_type = QTableWidgetItem(Type)
1176 w_save = QTableWidgetItem(Save)
1177 w_licc = QTableWidgetItem(Licence)
1179 self.listEffect.insertRow(last_pos)
1180 self.listEffect.setItem(last_pos, 0, w_icon)
1181 self.listEffect.setItem(last_pos, 1, w_name)
1182 self.listEffect.setItem(last_pos, 2, w_type)
1183 self.listEffect.setItem(last_pos, 3, w_save)
1184 self.listEffect.setItem(last_pos, 4, w_licc)
1186 last_pos += 1
1188 last_pos = 0
1189 list_Tool = database.list_Tool
1190 for i in range(len(list_Tool)):
1191 if (SHOW_ALL or list_Tool[i][0] in pkglist):
1192 AppName = list_Tool[i][1]
1193 Type = list_Tool[i][2]
1194 Binary = list_Tool[i][3]
1195 Icon = list_Tool[i][4]
1196 Save = list_Tool[i][5]
1197 Level = list_Tool[i][6]
1198 Licence = list_Tool[i][7]
1199 Features = list_Tool[i][8]
1200 Docs = list_Tool[i][9]
1202 w_icon = QTableWidgetItem("")
1203 w_icon.setIcon(QIcon(self.MyIcons.getIconPath(Icon, 16)))
1204 w_name = QTableWidgetItem(AppName)
1205 w_type = QTableWidgetItem(Type)
1206 w_save = QTableWidgetItem(Save)
1207 w_licc = QTableWidgetItem(Licence)
1209 self.listTool.insertRow(last_pos)
1210 self.listTool.setItem(last_pos, 0, w_icon)
1211 self.listTool.setItem(last_pos, 1, w_name)
1212 self.listTool.setItem(last_pos, 2, w_type)
1213 self.listTool.setItem(last_pos, 3, w_save)
1214 self.listTool.setItem(last_pos, 4, w_licc)
1216 last_pos += 1
1218 self.listDAW.setCurrentCell(-1, -1)
1219 self.listHost.setCurrentCell(-1, -1)
1220 self.listInstrument.setCurrentCell(-1, -1)
1221 self.listGhostess.setCurrentCell(-1, -1)
1222 self.listBristol.setCurrentCell(-1, -1)
1223 self.listEffect.setCurrentCell(-1, -1)
1224 self.listTool.setCurrentCell(-1, -1)
1226 self.listDAW.sortByColumn(1, Qt.AscendingOrder)
1227 self.listHost.sortByColumn(1, Qt.AscendingOrder)
1228 self.listInstrument.sortByColumn(1, Qt.AscendingOrder)
1229 self.listGhostess.sortByColumn(1, Qt.AscendingOrder)
1230 self.listBristol.sortByColumn(2, Qt.AscendingOrder)
1231 self.listEffect.sortByColumn(1, Qt.AscendingOrder)
1232 self.listTool.sortByColumn(1, Qt.AscendingOrder)
1234 def saveSettings(self):
1235 self.settings.setValue("Geometry", QVariant(self.saveGeometry()))
1236 self.settings.setValue("SplitterDAW", self.splitter_DAW.saveState())
1237 self.settings.setValue("SplitterHost", self.splitter_Host.saveState())
1238 self.settings.setValue("SplitterInstrument", self.splitter_Instrument.saveState())
1239 self.settings.setValue("SplitterGhostess", self.splitter_Ghostess.saveState())
1240 self.settings.setValue("SplitterBristol", self.splitter_Bristol.saveState())
1241 self.settings.setValue("SplitterEffect", self.splitter_Effect.saveState())
1242 self.settings.setValue("SplitterTool", self.splitter_Tool.saveState())
1244 def loadSettings(self):
1245 self.restoreGeometry(self.settings.value("Geometry").toByteArray())
1246 self.splitter_DAW.restoreState(self.settings.value("SplitterDAW").toByteArray())
1247 self.splitter_Host.restoreState(self.settings.value("SplitterHost").toByteArray())
1248 self.splitter_Instrument.restoreState(self.settings.value("SplitterInstrument").toByteArray())
1249 self.splitter_Ghostess.restoreState(self.settings.value("SplitterGhostess").toByteArray())
1250 self.splitter_Bristol.restoreState(self.settings.value("SplitterBristol").toByteArray())
1251 self.splitter_Effect.restoreState(self.settings.value("SplitterEffect").toByteArray())
1252 self.splitter_Tool.restoreState(self.settings.value("SplitterTool").toByteArray())
1254 def closeEvent(self, event):
1255 self.saveSettings()
1256 event.accept()