def on_actionImport_oil_triggered(self): """加载配置文件""" if (self.cfg == None): QMessageBox(QMessageBox.Information, 'GaInOS Info', 'Please New Configure File Firstly!').exec_() return elif (self.cfg.findModule('OS') == None): QMessageBox(QMessageBox.Information, 'GaInOS Info', 'Please Add Module OS Firstly!').exec_() return file = QFileDialog.getOpenFileName( self, 'Open osek oil File.', '%s/*.oil' % (os.path.dirname(self.arxml)), 'osek standard oil file(*.oil)') if (file != ''): if (oil_gainos.to_oscfg(str(file), self.cfg.findModule('OS').obj)): oil_gainos.post_process(self.cfg.findModule('OS').obj) QMessageBox( QMessageBox.Information, 'GaInOS Info', 'Convert to gainos_tk_os_cfg successfully!').exec_() self.fileIndicate(False) else: QMessageBox(QMessageBox.Critical, 'GaInOS Error', 'Convert to gainos_tk_os_cfg failed!').exec_() return
def gainos_test(oilfile,path): from config.gainos_tk_os_cfg import gainos_tk_os_cfg from oil_adapter import oil_gainos oscfg = gainos_tk_os_cfg('MC9S12'); oil_gainos.to_oscfg(oilfile,oscfg) oil_gainos.post_process(oscfg) oscfg.gen(path); print "Generate file at %s OK!"%(path)
def on_actionImport_oil_triggered(self): """加载配置文件""" if(self.cfg == None): QMessageBox(QMessageBox.Information, 'GaInOS Info', 'Please New Configure File Firstly!').exec_(); return; elif(self.cfg.findModule('OS') == None): QMessageBox(QMessageBox.Information, 'GaInOS Info', 'Please Add Module OS Firstly!').exec_(); return file=QFileDialog.getOpenFileName(self, 'Open osek oil File.', '%s/*.oil'%(os.path.dirname(self.arxml)), 'osek standard oil file(*.oil)'); if(file!=''): if(oil_gainos.to_oscfg(str(file), self.cfg.findModule('OS').obj)): oil_gainos.post_process(self.cfg.findModule('OS').obj); QMessageBox(QMessageBox.Information, 'GaInOS Info', 'Convert to gainos_tk_os_cfg successfully!').exec_(); self.fileIndicate(False) else: QMessageBox(QMessageBox.Critical, 'GaInOS Error', 'Convert to gainos_tk_os_cfg failed!').exec_(); return