class mainWindow(QtGui.QMainWindow, Ui_MainWindow): def __init__(self): # QtGui.QMainWindow.__init__(self) self.setupUi(self) self.i18n() self.plugins = pluginManager() self.actionList = EActionList(self, self.plugins) self.actionListLayout.addWidget( self.actionList ) #QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered (bool)"), self.exit) #QtCore.QObject.connect(self.actionBuild_from_Installation, QtCore.SIGNAL("triggered (bool)"), self.pasoBuildfromIns) #self.setWindowTitle("%s - %s" %(const.NAME, self.pasoFName)) self.move(( (QtGui.QApplication.desktop().width()- self.width()) / 2 ), ( (QtGui.QApplication.desktop().height()- self.height()) / 2 )) self.checkInputList() ## # def checkInputList(self): files = "" for arg in sys.argv[1:]: if os.path.isfile(arg): self.actionList.addItem([unicode(arg)]) def exit(self): self.close() def message(self, msg, inf=""): msgBox = QtGui.QMessageBox() msgBox.setText(msg) msgBox.setInformativeText( inf ) msgBox.exec_() def i18n(self): self.msg = range(40) self.msg[0] = QtGui.QApplication.translate("MainDialog", "Welcome, Paso needs your personal information, please continue and create your profile.", None, QtGui.QApplication.UnicodeUTF8)
def __init__(self): # QtGui.QMainWindow.__init__(self) self.setupUi(self) self.i18n() self.plugins = pluginManager() self.actionList = EActionList(self, self.plugins) self.actionListLayout.addWidget( self.actionList ) #QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered (bool)"), self.exit) #QtCore.QObject.connect(self.actionBuild_from_Installation, QtCore.SIGNAL("triggered (bool)"), self.pasoBuildfromIns) #self.setWindowTitle("%s - %s" %(const.NAME, self.pasoFName)) self.move(( (QtGui.QApplication.desktop().width()- self.width()) / 2 ), ( (QtGui.QApplication.desktop().height()- self.height()) / 2 )) self.checkInputList()
def __init__(self, installTranslator): QtGui.QMainWindow.__init__(self) self.setupUi(self) self.i18n() if not os.path.isdir(const.EVIRE_PATH): self.firstRun() self.pluginsOutputOverwriteStatus = pos_None self.pluginActionRunStatus = True self.pref = preferences() self.plugins = pluginLoader(QtCore.QLocale.system().name()) try: self.plugins.load(installTranslator) except cException as e: details = "" for bad in self.plugins.badPlugins: details += "%s [%s]\n\n" %(self.msg[bad.code], bad.data) QMessage(str(self.msg[e.code]) %(str(len(self.plugins.badPlugins))), QtGui.QMessageBox.Information, False, False, details) if self.plugins.getNames() == []: QMessage(self.msg["m_anyPluginWarning"], QtGui.QMessageBox.Information) self.on_actionPlugins_triggered() self.actionList = EActionList(self, self.plugins) self.actionListLayout.addWidget( self.actionList ) QtCore.QObject.connect(self.actionMergeSelected, QtCore.SIGNAL("triggered (bool)"), self.actionList.mergeSelected) QtCore.QObject.connect(self.actionRemove, QtCore.SIGNAL("triggered (bool)"), self.actionList.remove) QtCore.QObject.connect(self.actionMergeAll, QtCore.SIGNAL("triggered (bool)"), self.actionList.mergeAll) QtCore.QObject.connect(self.actionSplit, QtCore.SIGNAL("triggered (bool)"), self.actionList.split) QtCore.QObject.connect(self.actionSplitToPieces, QtCore.SIGNAL("triggered (bool)"), self.actionList.splitToPieces) self.move(( (QtGui.QApplication.desktop().width()- self.width()) / 2 ), ( (QtGui.QApplication.desktop().height()- self.height()) / 2 )) self.setWindowTitle("%s - %s" %(const.NAME, const.VERSION)) self.checkInputList()
class mainWindow(QtGui.QMainWindow, Ui_MainWindow): def __init__(self, installTranslator): QtGui.QMainWindow.__init__(self) self.setupUi(self) self.i18n() if not os.path.isdir(const.EVIRE_PATH): self.firstRun() self.pluginsOutputOverwriteStatus = pos_None self.pluginActionRunStatus = True self.pref = preferences() self.plugins = pluginLoader(QtCore.QLocale.system().name()) try: self.plugins.load(installTranslator) except cException as e: details = "" for bad in self.plugins.badPlugins: details += "%s [%s]\n\n" %(self.msg[bad.code], bad.data) QMessage(str(self.msg[e.code]) %(str(len(self.plugins.badPlugins))), QtGui.QMessageBox.Information, False, False, details) if self.plugins.getNames() == []: QMessage(self.msg["m_anyPluginWarning"], QtGui.QMessageBox.Information) self.on_actionPlugins_triggered() self.actionList = EActionList(self, self.plugins) self.actionListLayout.addWidget( self.actionList ) QtCore.QObject.connect(self.actionMergeSelected, QtCore.SIGNAL("triggered (bool)"), self.actionList.mergeSelected) QtCore.QObject.connect(self.actionRemove, QtCore.SIGNAL("triggered (bool)"), self.actionList.remove) QtCore.QObject.connect(self.actionMergeAll, QtCore.SIGNAL("triggered (bool)"), self.actionList.mergeAll) QtCore.QObject.connect(self.actionSplit, QtCore.SIGNAL("triggered (bool)"), self.actionList.split) QtCore.QObject.connect(self.actionSplitToPieces, QtCore.SIGNAL("triggered (bool)"), self.actionList.splitToPieces) self.move(( (QtGui.QApplication.desktop().width()- self.width()) / 2 ), ( (QtGui.QApplication.desktop().height()- self.height()) / 2 )) self.setWindowTitle("%s - %s" %(const.NAME, const.VERSION)) self.checkInputList() def checkInputList(self): for arg in sys.argv[1:]: if os.path.isfile(arg) and fileNode(arg).ext in self.plugins.getExtList(): self.actionList.addItem([unicode(arg)]) @QtCore.pyqtSignature("void") def on_actionButton_clicked(self): prg = progress() prg.show() self.pluginsOutputOverwriteStatus = pos_None self.pluginActionRunStatus = True jobCounter = 0 for action in self.actionList.getActionItems(): jobCounter += 1 act = action.activePlugin.action(action.activePlugin.mconf, \ action.jobItem.getList(), \ action.pluginDataList[action.activePlugin.mconf.install.mname], \ self.askOverwriteOutputFile) prg.setTotalJobs(len(self.actionList.getActionItems())) prg.setCurrentJob(jobCounter) act.onLogging.addEventListener(prg.addLog) act.onProcessing.addEventListener(prg.updateJobValue) prg.onStop.addEventListener(act.stopOperation) act.runPlugin() prg.onStop.removeEventListener(act.stopOperation) if prg.stopFlag or not self.pluginActionRunStatus: break prg.operationCompleted() prg.exec_() def askOverwriteOutputFile(self, f): if self.pluginsOutputOverwriteStatus == pos_YesToAll: return(True) reply = QMessage(self.msg["m_pluginOutputOverwrite"], QtGui.QMessageBox.Question, f, \ QtGui.QMessageBox.Yes | QtGui.QMessageBox.YesToAll | QtGui.QMessageBox.No | QtGui.QMessageBox.Abort, \ False, QtGui.QMessageBox.Yes) if reply == QtGui.QMessageBox.Yes: return(True) elif reply == QtGui.QMessageBox.YesToAll: self.pluginsOutputOverwriteStatus = pos_YesToAll return(True) if reply == QtGui.QMessageBox.No: return(False) if reply == QtGui.QMessageBox.Abort: self.pluginActionRunStatus = False return(False) @QtCore.pyqtSignature("void") def on_actionPreferences_triggered(self): self.pref.exec_() @QtCore.pyqtSignature("void") def on_actionPlugins_triggered(self): dialog = pluginManager(self.plugins) dialog.exec_() @QtCore.pyqtSignature("void") def on_actionAdd_triggered(self): filter = self.msg["d_ALLFiles"]+" (*.*)" for group in const.EXTENSION_GROUPS: filter += self.msg["d_"+group+"Files"]+" (" for ext in vars(const)[group+"_EXTENSIONS"]: filter += "*.%s " %ext filter += ");;" #filter += self.msg["d_ALLFiles"]+" (*.*)" fileName = QtGui.QFileDialog.getOpenFileNames(self, self.msg["d_addFilesCaption"], const.USER_HOME_PATH, filter) if fileName: for f in fileName: if fileNode(unicode(f)).ext in self.plugins.getExtList(): self.actionList.addItem([unicode(f)]) @QtCore.pyqtSignature("void") def on_closeButton_clicked(self): self.close() def firstRun(self): os.makedirs(const.USER_PLUGIN_PATH) os.makedirs(const.USER_CONF_PATH) QMessage(self.msg["m_firstTimeWarning"], QtGui.QMessageBox.Information) self.preferences() @QtCore.pyqtSignature("void") def on_actionAbout_triggered(self): about = aboutDialog() about.exec_() def i18n(self): self.msg = {} self.msg["m_firstTimeWarning"] = QtGui.QApplication.translate("MainWindow", "Welcome, Evire needs your personal information, please continue and create your profile.", None, QtGui.QApplication.UnicodeUTF8) self.msg["m_anyPluginWarning"] = QtGui.QApplication.translate("MainWindow", "Evire could not be fonud any plugin. Plugin manager dialog will be opened for installing some plugins. You can also find it at Options/plugins menu item later.", None, QtGui.QApplication.UnicodeUTF8) self.msg[pluginloader.e_plbadPluginsFound] = QtGui.QApplication.translate("MainWindow", "%s Plugins have some problems.", None, QtGui.QApplication.UnicodeUTF8) self.msg[pluginloader.e_plMConfCorrupt] = QtGui.QApplication.translate("MainWindow", "Plugin configuration is corrupt.", None, QtGui.QApplication.UnicodeUTF8) self.msg[pluginloader.e_plEPSConflict] = QtGui.QApplication.translate("MainWindow", "Plugin EPS is invalid.", None, QtGui.QApplication.UnicodeUTF8) self.msg[pluginloader.e_plImportError] = QtGui.QApplication.translate("MainWindow", "Plugin could not be imported.", None, QtGui.QApplication.UnicodeUTF8) self.msg[pluginloader.e_plCompatibilityFail] = QtGui.QApplication.translate("MainWindow", "Plugin is not compatible to Evire.", None, QtGui.QApplication.UnicodeUTF8) self.msg["m_pluginOutputOverwrite"] = QtGui.QApplication.translate("MainWindow", "Do you want to owerwrite.", None, QtGui.QApplication.UnicodeUTF8) self.msg["d_addFilesCaption"] = QtGui.QApplication.translate("MainWindow", "Select files for processing", None, QtGui.QApplication.UnicodeUTF8) self.msg["d_VIDEOFiles"] = QtGui.QApplication.translate("MainWindow", "Video files", None, QtGui.QApplication.UnicodeUTF8) self.msg["d_AUDIOFiles"] = QtGui.QApplication.translate("MainWindow", "Audio files", None, QtGui.QApplication.UnicodeUTF8) self.msg["d_IMAGEFiles"] = QtGui.QApplication.translate("MainWindow", "Image files", None, QtGui.QApplication.UnicodeUTF8) self.msg["d_ALLFiles"] = QtGui.QApplication.translate("MainWindow", "All files", None, QtGui.QApplication.UnicodeUTF8)