MCPcopy Index your code
hub / github.com/rawpython/remi / Project

Class Project

editor/editor.py:318–718  ·  view source on GitHub ↗

The editor project is pure html with specific tag attributes This class loads and save the project file, and also compiles a project in python code.

Source from the content-addressed store, hash-verified

316
317
318class Project(gui.Container):
319 """ The editor project is pure html with specific tag attributes
320 This class loads and save the project file,
321 and also compiles a project in python code.
322 """
323 lastUpdateTime = 0
324
325 def __init__(self, **kwargs):
326 super(Project, self).__init__(**kwargs)
327 self.variable_name = 'App'# + str(id(self))
328 self.style.update({'position': 'relative',
329 'overflow': 'auto',
330 'background-color': 'rgb(250,248,240)',
331 'background-image': "url('/editor_resources:background.png')"})
332 self.attr_editor_newclass = True
333
334 def shouldUpdate(self, filePathName):
335 #returns True if project file changed externally
336 if os.stat(filePathName).st_mtime > self.lastUpdateTime:
337 return True
338 return False
339
340 def load(self, ifile, configuration):
341 self.lastUpdateTime = os.stat(ifile).st_mtime
342 self.ifile = ifile
343
344 _module = load_source(self.ifile)
345
346 configuration.configDict = _module.configuration
347
348 # finding App class
349 clsmembers = inspect.getmembers(_module, inspect.isclass)
350
351 app_init_fnc = None
352 for (name, value) in clsmembers:
353 if issubclass(value, App) and name != 'App':
354 app_init_fnc = value
355
356 if app_init_fnc == None:
357 return None
358
359 members_list = app_init_fnc.__dict__.values()
360 for m in members_list:
361 if inspect.isfunction(m) and m.__name__ not in ['__init__', 'main', 'idle', 'construct_ui']:
362 import types
363 setattr(self, m.__name__, types.MethodType(m, self))
364 print(m.__name__)
365 root_widget = app_init_fnc.construct_ui(self)
366 return root_widget
367
368 def check_pending_listeners(self, widget, widgetVarName, force=False):
369 code_nested_listener = ''
370 # checking if pending listeners code production can be solved
371 for event in self.pending_listener_registration:
372 if force or (hasattr(event['eventsource'], 'path_to_this_widget') and hasattr(event['eventlistener'], 'path_to_this_widget')):
373 if (force or (widget.variable_name in event['eventsource'].path_to_this_widget and widget.variable_name in event['eventlistener'].path_to_this_widget)) and event['done'] == False:
374 # this means that this is the root node from where the leafs(listener and source) departs, hre can be set the listener
375 event['done'] = True

Callers 1

menu_new_clickedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected