def LoadExtensions(self): for extfilename in self.extensions: from util.TranslationCatalogs import AddCatalog from util.BitmapLibrary import AddBitmapFolder extension_folder = os.path.split(os.path.realpath(extfilename))[0] sys.path.append(extension_folder) AddCatalog(os.path.join(extension_folder, "locale")) AddBitmapFolder(os.path.join(extension_folder, "images")) execfile(extfilename, locals())
def InstallLocalRessources(CWD): # Beremiz bitmaps AddBitmapFolder(os.path.join(CWD, "images")) # Internationalization AddCatalog(os.path.join(CWD, "locale")) ## windows7环境下,执行代码报ValueError: embedded null byte时,在原代码前面加一行代码:locale.setlocale(locale.LC_ALL,'en')即可解决 locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') locale.setlocale(locale.LC_CTYPE, 'zh_CN.UTF-8')
def InstallLocalRessources(CWD): # Beremiz bitmaps AddBitmapFolder(os.path.join(CWD, "images")) # Internationalization AddCatalog(os.path.join(CWD, "locale"))
def ImportModules(self): import features features.catalog = [ ('c_ext', _('C extension'), _('Add C code accessing located variables synchronously'), 'c_ext.CFile'), ('MKLogic201', _('MKLogic 201'), _('Plugin for MK201'), 'mk200modules.MK201.MK201ModuleFile'), ('MK200CANOpen', _('MK200 CANOpen'), _('External MK200 modules'), 'mk200modules.MK200CANOpen.RootClass'), ('ModbusTCP master', _('ModbusTCP master'), _('ModbusTCP master'), 'mk200modules.ModbusTcpMaster.RootClass'), ('MK200ModubsRequest', _('MK200 Modbus master request'), _('Plugin for MK201'), 'mk200modules.ModbusMaster.MK200ModbusRequestFile')] features.libraries = [ ('Native', 'NativeLib.NativeLibrary'), ('MK200', 'mk200libs.MK200Library'), ('MK200Modbus', 'mk200libs.MK200Modbus'), ('MK200Time', 'mk200libs.MK200Time'), ('AdditionalConversionTypes', 'mk200libs.MK200AdditionalConversion')] from util.BitmapLibrary import AddBitmapFolder images = os.path.join(os.path.dirname(os.path.realpath(__file__)),"images") AddBitmapFolder(images) import targets from mk200targets import mk200targets, mk200targetsV01 targets.targets = {} targets.targets.update(mk200targets) targets.targets.update(mk200targetsV01) BeremizIDELauncher.ImportModules(self) import BeremizIDE BeremizIDE.ProjectController.GetDefaultTargetName = lambda x: "MKLogik201_HV_2_0" import connectors import mk200connectors connectors.connectors = {} connectors.connectors["MK200"] = lambda: mk200connectors.MK200_connector_factory connectors.connectors["MK201"] = lambda: mk200connectors.MK201_connector_factory """ Adding creation folders inc and src after creation new project """ NewProject = BeremizIDE.ProjectController.NewProject def NewProjectWrapper (self_, ProjectPath, BuildPath=None): rez = NewProject(self_, ProjectPath, BuildPath) if rez == None: includeDir = os.path.join(ProjectPath, "inc") sourceDir = os.path.join(ProjectPath, "src") if not os.path.exists(includeDir): os.mkdir(includeDir) if not os.path.exists(sourceDir): os.mkdir(sourceDir) return rez BeremizIDE.ProjectController.NewProject = NewProjectWrapper # в списко методов PorjectController-а добавляю метод вызова конфигуратора для МК201 # in the list of methods ProductController I add a method of a call of the configurator for MK201 BeremizIDE.ProjectController._callConfigurator = self._Configurator BeremizIDE.ProjectController.StatusMethods.append({"bitmap" : "configurator", "shown" : True, "name" : _("configurator"), "tooltip" : u"Конфигуратор MK201Setup", "method" : '_callConfigurator'}) BeremizIDE.ProjectController._setMK201Connector = self._setMK201Connector BeremizIDE.ProjectController.StatusMethods.insert(-2,{"bitmap" : "set_port", "shown" : True, "name" : _("_setMK201Connector"), "tooltip" : u"Конфигуратор MK201Setup", "method" : '_setMK201Connector'}) BeremizIDE.ProjectController._Connect_MK201 = self._Connect_MK201 for element in BeremizIDE.ProjectController.StatusMethods: for key in element.keys(): if element["method"] == "_Connect": element["method"] = "_Connect_MK201"
from __future__ import absolute_import from etherlab.etherlab import * from util.BitmapLibrary import AddBitmapFolder import util.paths as paths AddBitmapFolder(os.path.join(paths.AbsDir(__file__), "images"))
def InstallLocalRessources(CWD): # Beremiz bitmaps AddBitmapFolder(os.path.join(CWD, "images"))