def __init__(self, standalone=None): QWidget.__init__(self) self.standalone=standalone global config load_config() #Load Form self.ui_kademarstart = Ui_Form() self.ui_kademarstart.setupUi(self) self.ui_kademarstart.pages.setCurrentWidget(self.ui_kademarstart.tab_ppal) #if not standalone: self.ui_kademarstart.b_band_cat.setVisible(0) self.ui_kademarstart.b_band_esp.setVisible(0) #print config if not int(config.autostart): self.ui_kademarstart.cb_autostart.setVisible(0) ##################### # Signals & Slots Buttons ##################### #Sortir i Enrera self.connect(self.ui_kademarstart.b_sortir, SIGNAL("clicked()"), self.close) self.connect(self.ui_kademarstart.b_enrera, SIGNAL("clicked()"), self.boto_enrera) # Banderes self.connect(self.ui_kademarstart.b_band_cat, SIGNAL("clicked()"), self.boto_cat) self.connect(self.ui_kademarstart.b_band_esp, SIGNAL("clicked()"), self.boto_esp) # Principal self.connect(self.ui_kademarstart.b_notes, SIGNAL("clicked()"), self.boto_notesversio) self.connect(self.ui_kademarstart.b_configurar, SIGNAL("clicked()"), self.boto_configurarsistema) self.connect(self.ui_kademarstart.b_equip, SIGNAL("clicked()"), self.boto_equip) self.connect(self.ui_kademarstart.b_suport, SIGNAL("clicked()"), self.boto_suport) # Programes self.connect(self.ui_kademarstart.b_cadi, SIGNAL("clicked()"), self.boto_cadi) self.connect(self.ui_kademarstart.b_kcontrol, SIGNAL("clicked()"), self.boto_kcontrol) # Suport self.connect(self.ui_kademarstart.b_faq, SIGNAL("clicked()"), self.boto_faq) self.connect(self.ui_kademarstart.b_foro, SIGNAL("clicked()"), self.boto_foro) self.connect(self.ui_kademarstart.b_doc, SIGNAL("clicked()"), self.boto_doc) self.connect(self.ui_kademarstart.b_email, SIGNAL("clicked()"), self.boto_email) #if no Notes versio, do not show ruta="/usr/share/kademar/utils/kademarcenter/html/" if path.exists(ruta+"notesversio_ca.html") or path.exists(ruta+"notesversio_es.html"): pass else: self.ui_kademarstart.pages.removeTab(1) self.ui_kademarstart.b_notes.setEnabled(0) ##################### # END Signals & Slots Buttons ##################### #locale = QLocale.system().name() #ca_ES #global qtTranslator, idioma #idioma=locale.split("_")[0] #qtTranslator = QTranslator() #if qtTranslator.load("/usr/share/kademar/utils/kademarcenter/tr/"+locale.split("_")[0]+".qm"): #app.installTranslator(qtTranslator) #print "Loaded "+locale #elif qtTranslator.load("/usr/share/kademar/utils/kademarcenter/tr/es.qm"): #app.installTranslator(qtTranslator) #print "Loaded en" #Set kademar Label versiokademar=funcions_k.versiokademar() tipuskademar=funcions_k.tipuskademar() self.ui_kademarstart.l_kademar.setText("kademar "+tipuskademar+" "+versiokademar+" GNU/Linux") locale = QLocale.system().name() idioma=locale.split("_")[0] if path.exists("file:///usr/share/kademar/utils/kademarcenter/html/equip_"+idioma+".html"): self.ui_kademarstart.web_equip.setUrl(QUrl("file:///usr/share/kademar/utils/kademarcenter/html/equip_"+idioma+".html")) else: self.ui_kademarstart.web_equip.setUrl(QUrl("file:///usr/share/kademar/utils/kademarcenter/html/equip_es.html")) if path.exists("file:///usr/share/kademar/utils/kademarcenter/html/notesversio_"+idioma+".html"): self.ui_kademarstart.web_notes.setUrl(QUrl("file:///usr/share/kademar/utils/kademarcenter/html/notesversio_"+idioma+".html")) else: self.ui_kademarstart.web_notes.setUrl(QUrl("file:///usr/share/kademar/utils/kademarcenter/html/notesversio_es.html"))
class kademarstart(QWidget): def __init__(self, standalone=None): QWidget.__init__(self) self.standalone=standalone global config load_config() #Load Form self.ui_kademarstart = Ui_Form() self.ui_kademarstart.setupUi(self) self.ui_kademarstart.pages.setCurrentWidget(self.ui_kademarstart.tab_ppal) #if not standalone: self.ui_kademarstart.b_band_cat.setVisible(0) self.ui_kademarstart.b_band_esp.setVisible(0) #print config if not int(config.autostart): self.ui_kademarstart.cb_autostart.setVisible(0) ##################### # Signals & Slots Buttons ##################### #Sortir i Enrera self.connect(self.ui_kademarstart.b_sortir, SIGNAL("clicked()"), self.close) self.connect(self.ui_kademarstart.b_enrera, SIGNAL("clicked()"), self.boto_enrera) # Banderes self.connect(self.ui_kademarstart.b_band_cat, SIGNAL("clicked()"), self.boto_cat) self.connect(self.ui_kademarstart.b_band_esp, SIGNAL("clicked()"), self.boto_esp) # Principal self.connect(self.ui_kademarstart.b_notes, SIGNAL("clicked()"), self.boto_notesversio) self.connect(self.ui_kademarstart.b_configurar, SIGNAL("clicked()"), self.boto_configurarsistema) self.connect(self.ui_kademarstart.b_equip, SIGNAL("clicked()"), self.boto_equip) self.connect(self.ui_kademarstart.b_suport, SIGNAL("clicked()"), self.boto_suport) # Programes self.connect(self.ui_kademarstart.b_cadi, SIGNAL("clicked()"), self.boto_cadi) self.connect(self.ui_kademarstart.b_kcontrol, SIGNAL("clicked()"), self.boto_kcontrol) # Suport self.connect(self.ui_kademarstart.b_faq, SIGNAL("clicked()"), self.boto_faq) self.connect(self.ui_kademarstart.b_foro, SIGNAL("clicked()"), self.boto_foro) self.connect(self.ui_kademarstart.b_doc, SIGNAL("clicked()"), self.boto_doc) self.connect(self.ui_kademarstart.b_email, SIGNAL("clicked()"), self.boto_email) #if no Notes versio, do not show ruta="/usr/share/kademar/utils/kademarcenter/html/" if path.exists(ruta+"notesversio_ca.html") or path.exists(ruta+"notesversio_es.html"): pass else: self.ui_kademarstart.pages.removeTab(1) self.ui_kademarstart.b_notes.setEnabled(0) ##################### # END Signals & Slots Buttons ##################### #locale = QLocale.system().name() #ca_ES #global qtTranslator, idioma #idioma=locale.split("_")[0] #qtTranslator = QTranslator() #if qtTranslator.load("/usr/share/kademar/utils/kademarcenter/tr/"+locale.split("_")[0]+".qm"): #app.installTranslator(qtTranslator) #print "Loaded "+locale #elif qtTranslator.load("/usr/share/kademar/utils/kademarcenter/tr/es.qm"): #app.installTranslator(qtTranslator) #print "Loaded en" #Set kademar Label versiokademar=funcions_k.versiokademar() tipuskademar=funcions_k.tipuskademar() self.ui_kademarstart.l_kademar.setText("kademar "+tipuskademar+" "+versiokademar+" GNU/Linux") locale = QLocale.system().name() idioma=locale.split("_")[0] if path.exists("file:///usr/share/kademar/utils/kademarcenter/html/equip_"+idioma+".html"): self.ui_kademarstart.web_equip.setUrl(QUrl("file:///usr/share/kademar/utils/kademarcenter/html/equip_"+idioma+".html")) else: self.ui_kademarstart.web_equip.setUrl(QUrl("file:///usr/share/kademar/utils/kademarcenter/html/equip_es.html")) if path.exists("file:///usr/share/kademar/utils/kademarcenter/html/notesversio_"+idioma+".html"): self.ui_kademarstart.web_notes.setUrl(QUrl("file:///usr/share/kademar/utils/kademarcenter/html/notesversio_"+idioma+".html")) else: self.ui_kademarstart.web_notes.setUrl(QUrl("file:///usr/share/kademar/utils/kademarcenter/html/notesversio_es.html")) #if idioma=="ca": #self.boto_cat() #elif idioma=="es": #self.boto_esp() def boto_faq(self): system("x-www-browser http://www.kademar.org/kademarstart/boto_faq.php &") def boto_foro(self): system("x-www-browser http://www.kademar.org/kademarstart/boto_foro.php &") def boto_doc(self): system("x-www-browser http://www.kademar.org/kademarstart/boto_doc.php &") def boto_email(self): system("x-www-browser http://www.kademar.org/kademarstart/boto_email.php &") def boto_kcontrol(self): if funcions_k.kdeversion() == 4: system("systemsettings &") else: system("kcontrol &") def boto_cadi(self): system("cadi &") def boto_enrera(self): self.ui_kademarstart.pages.setCurrentWidget(self.ui_kademarstart.tab_ppal) #print "notesversio" def boto_notesversio(self): self.ui_kademarstart.pages.setCurrentWidget(self.ui_kademarstart.tab_notes) #print "notesversio" def boto_configurarsistema(self): self.ui_kademarstart.pages.setCurrentWidget(self.ui_kademarstart.tab_configurar) #print "configurar sistema" def boto_equip(self): self.ui_kademarstart.pages.setCurrentWidget(self.ui_kademarstart.tab_equip) #print "equip" def boto_suport(self): self.ui_kademarstart.pages.setCurrentWidget(self.ui_kademarstart.tab_suport) #print "suport" def boto_cat(self): global idioma idioma="ca" self.ui_kademarstart.b_band_cat.setEnabled(0) self.ui_kademarstart.b_band_esp.setEnabled(1) self.translateForm() def boto_esp(self): global idioma idioma="es" self.ui_kademarstart.b_band_cat.setEnabled(1) self.ui_kademarstart.b_band_esp.setEnabled(0) self.translateForm() def boto_eng(self): global idioma idioma="es" self.translateForm() def translateForm(self): global qtTranslator, idioma app.removeTranslator(qtTranslator) qtTranslator = QTranslator() qtTranslator.load("/usr/share/kademar/utils/kademarcenter/tr/"+idioma+".qm") app.installTranslator(qtTranslator) self.ui_kademarstart.retranslateUi(self) #Set kademar Label versiokademar=funcions_k.versiokademar() tipuskademar=funcions_k.tipuskademar() self.ui_kademarstart.l_kademar.setText("kademar "+tipuskademar+" "+versiokademar+" GNU/Linux") path="/usr/share/kademar/html/" def closeEvent(self, event): global localfile, home if self.ui_kademarstart.cb_autostart.isChecked(): #system("rm -f $home/.kde/Auto*/kademar.desktop 2>/dev/null") #home=getoutput("echo $HOME") system("mkdir -p "+home+"/.kademar") f=open(localfile,'w') f.writelines("autostart=0") f.close() self.setVisible(0) if not self.standalone: event.ignore()