def __init__(self, requires=None, provides=None, parent=None, project=None, enabled=True, pref_manager=None): ## The package which contains the collection node. self.parentPackage = parent # The preferences manager of the node. if pref_manager is None: self.pref_manager = PreferencesManager() else: self.pref_manager = pref_manager ## The node's enabled state. # # Mark the collection node as enabled or disabled. self.enabled = enabled ## The collection node's output. # # The output dictionary can be used to pass parameters to the next # node in the collection. self.output = {} # The variables required by the node. self.requires = requires # The variables provided by the node. self.provides = provides ## The current pSysmon project. # self.project = project ## The parent collection holding the node instance. # self.parentCollection = None # If the node is executed in a collection thread a thread ID is # assigned. self.procName = None
def __init__(self, name, mode, category, tags, enabled=True, docEntryPoint=None, parentStack=None): ''' The constructor ''' # The name of the stack node. self.name = name # The mode of the stack node (editable, uneditable). self.mode = mode # The category of the stack node. self.category = category # The tags assigned to the stack node. self.tags = tags # The result of the processing node. self.results = {} # The preferences of the stack node. self.pref_manager = PreferencesManager() # The entry point of the documentation of the node. self.docEntryPoint = docEntryPoint # The parent stack holding the stack node. self.parentStack = parentStack # The enabled state of the node. self.enabled = enabled
def setUp(self): self.app = PSysmonApp() self.app.Init() # The widget inspection tool can be called using CTRL+ALT+i self.pref = PreferencesManager() # Add the logging page. self.pref.add_page('Logging') self.pref.add_page('List editor') # Add a single_choice field. item = SingleChoicePrefItem(name = 'single_choice', group = 'test group 1', limit = ('CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'), value = 'ERROR', tool_tip = 'tooltip of the single choice control element' ) self.pref.add_item(pagename = 'Logging', item = item) # Add a multi_choice field. item = MultiChoicePrefItem(name = 'multi_choice', group = 'test group 1', limit = ('value 1', 'value 2', 'value 3', 'value 4', 'value 5'), value = ['value 2', 'value 4'], tool_tip = 'tooltip of the multi choice control element' ) self.pref.add_item(pagename = 'Logging', item = item) # Add a textedit field. item = TextEditPrefItem(name = 'textedit', group = 'test group 1', value = 'this is a textedit field', tool_tip = 'tooltip of the textedit control element' ) self.pref.add_item(pagename = 'Logging', item = item) # Add a integer_control field. item = IntegerControlPrefItem(name = 'integer_control', group = 'test group 1', value = 10, tool_tip = 'tooltip of the integer control element' ) self.pref.add_item(pagename = 'Logging', item = item) # Add an integer_range field. item = IntegerSpinPrefItem(name = 'integer_range', group = 'test group 1', value = 10, limit = (0, 100), tool_tip = 'tooltip of the integer spin control element' ) self.pref.add_item(pagename = 'Logging', item = item) # Add an float_spin field. item = FloatSpinPrefItem(name = 'float_spin', group = 'test group 1', value = 10.3, limit = (0, 100), tool_tip = 'tooltip of the float spin control element' ) self.pref.add_item(pagename = 'Logging', item = item) # Add a datetime_edit field. item = DateTimeEditPrefItem(name = 'datetime', group = 'test group 1', value = udt.UTCDateTime('2014-01-01T01:02:03.123456'), tool_tip = 'tooltip of the datetime edit control element' ) self.pref.add_item(pagename = 'Logging', item = item) # Add an filebrowse field. item = FileBrowsePrefItem(name = 'filebrowse', group = 'test group 2', value = '', filemask = 'comma separated version (*.csv)|*.csv|' \ 'all files (*)|*', tool_tip = 'tooltip of the file browse control element' ) self.pref.add_item(pagename = 'Logging', item = item) # Add an dirbrowse field. item = DirBrowsePrefItem(name = 'dirbrowse', group = 'test group 2', value = '', tool_tip = 'tooltip of the dir browse control element' ) self.pref.add_item(pagename = 'Logging', item = item) # Add a list grid edit field. item = ListCtrlEditPrefItem(name = 'list ctrl', group = 'list editor', value = [[21, 22, 23, 24]], limit = [[11, 12, 13, 14],[21, 22, 23, 24], [31, 32, 33, 34]], column_labels = ['eins', 'zwei', 'drei', 'vier'], tool_tip = 'tooltip of the list ctrl edit control element' ) self.pref.add_item(pagename = 'List editor', item = item) # Add a list grid edit field. item = ListGridEditPrefItem(name = 'list grid', group = 'list editor', value = [], column_labels = ['eins', 'zwei', 'drei', 'vier'], tool_tip = 'tooltip of the list grid edit control element' ) self.pref.add_item(pagename = 'List editor', item = item)
def setUp(self): self.pref = PreferencesManager()
def __init__(self, name, user, psybase=None, base_dir='', dbDialect='mysql', dbDriver=None, dbHost='localhost', pkg_version=None, db_version={}, dbName="", createTime=None, dbTables={}): '''The constructor. Create an instance of the Project class. Parameters ---------- psybase : :class:`~psysmon.core.base.Base` The related pSysmon base instance. name : String The name of the project. base_dir : String The base directory of the project. user : :class:`~User` instance The admin user of the project. dbDialect : String, optional The database dialect to be used by sqlalchemy (default: mysql). dbDriver : String, optional The database driver to be used by sqlalchemy (default: None). dbHost : String, optional The database host (default: localhost). dbName : String, optional The name of the database associated with the project (default: ""). createTime : :class:`~psysmon.core.UTCDateTime`, optional The time when the project has been created (default: UTCDateTime()) dbTables : Dictionary of Strings, optional The database tablenames used by the project. The name of the table (without prefix) is the key of the dictionary (default: {}). pkg_version : Dictionary of Strings The package version strings of the packages which were present when the project was created. The name of the package is the key of the dictionary. db_version : Dictionary of Strings The package version strings of the packages for which a database table was created. The name of the package is the key of the dictionary. ''' # The logger. loggerName = __name__ + "." + self.__class__.__name__ self.logger = logging.getLogger(loggerName) # The parent psysmon base. if psybase is not None: self._psybase = weakref.ref(psybase) else: self._psybase = None # The project name. self.name = name # The slug of the project name. self.slug = self.name.lower().replace(' ', '_') # The time when the project has been created. if createTime is None: self.createTime = utcdatetime.UTCDateTime() else: self.createTime = createTime # The project's base directory. self.base_dir = base_dir # The database engine to be used. self.dbDialect = dbDialect # The database driver to be used. self.dbDriver = dbDriver # The host on which the mySQL database server is running. self.dbHost = dbHost # The mySQL database name. if not dbName: self.dbName = "psysmon_" + user.name else: self.dbName = dbName # A dictionary of the project databaser table names. self.dbTables = dbTables # The sqlAlchemy database base instance. self.dbBase = None # The sqlAlchemy database session. self.dbSessionClass = None # The project file. self.projectFile = self.slug + ".ppr" # The version dictionary of the package versions. self.pkg_version = {} if pkg_version is None: for cur_pkg in self.psybase.packageMgr.packages.itervalues(): self.pkg_version[cur_pkg.name] = cur_pkg.version else: self.pkg_version = pkg_version # The version dictionary of the packages which created at least # one database table. self.db_version = db_version # Is the project saved? self.saved = False # The thread lock object. self.threadMutex = None # A list of users associated with this project. self.user = [] # The currently active user. self.activeUser = None # Add the user(s) to the project user list. if isinstance(user, list): self.user.extend(user) else: self.user.append(user) self.setActiveUser(self.user[0].name) # The project's waveclients. self.waveclient = {} # The default waveclient. self.defaultWaveclient = None # The association of the SCNLs to the data sources (the waveclients). self.scnlDataSources = {} # The project preferences. self.pref_manager = PreferencesManager() # The geometry inventory. self.geometry_inventory = None
def __init__(self, name, mode, category, tags, group='general', icons=None, parent=None, docEntryPoint=None, position_pref=0, *kwargs): ''' The constructor. Create an instance of the PluginNode. Parameters ---------- name : String The name of the plugin-node. mode : String The mode of the plugin-node (option, command, interactive, view). category : String The category of the plugin-node. tags : list of String A list of strings containing the tags of the collection node. These values are not limited but they should contain one of the three development state tags: - stable - experimental - damaged group : String The group of the plugin-node. A group contains the categories (default = 'general'). icons : List of Strings The icons used in the ribbonbar. nodeClass : String The name of the class for which the plugin-node has been written. parent : :class:`~psysmon.core.packageNodes.CollectionNode` The parent collectionNode which has loaded the plugin. docEntryPoint : String The path to where the documentation's index.html file can be found. position_pref : Integer The preferred position of the tool in the category section of the ribbon bar. ''' # The name of the plugin. self.name = name # The mode of the plugin. self.mode = mode # The group of the plugin. self.group = group # The category of the plugin. self.category = category # The tags of the plugin. self.tags = tags # The parent collection node which contains the plugin. self.parent = parent # The preferences of the plugin. self.pref_manager = PreferencesManager() # The path to the html index file containing the documentation of the # plugin. self.docEntryPoint = docEntryPoint # The icons of the plugin. # The dictionary has to be filled in the constructor of the # plugin node. The icons icons['active'] and icons['inactive'] # should be set. self.icons = {} # The activation state of the tool. This is used by view- and # interactive tools. For other tool modes, the active state is # always False. self.active = False # The preferred position within a category. self.position_pref = position_pref