Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions AttributeEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@

import wx

import gettext
_ = gettext.gettext

import DiagramNotebook

from PropertiesGridCtrl import PropertiesGridCtrl, CodeCB
Expand Down
3 changes: 2 additions & 1 deletion CheckerGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@

from traceback import format_exception

_ = wx.GetTranslation
import gettext
_ = gettext.gettext

if __name__ == '__main__':
import builtins
Expand Down
9 changes: 9 additions & 0 deletions ConnectDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,18 @@
import wx
import os

import gettext
_ = gettext.gettext

def function(obj, i):
return 'iPort %d'%i if obj[i].__class__.__name__ == "INode" else 'oPort %d'%i

## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
#
# CLASSES DEFINITION
#
## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##

###
class ConnectDialog(wx.Frame):
def __init__(self, parent, id, title, sn="Source", snL=[None,None], tn="Target", tnL=[None,None]):
Expand Down
7 changes: 6 additions & 1 deletion ConnectionThread.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
import tempfile
import zipfile

import gettext
_ = gettext.gettext

__version_lib__ = 0.2

class unzip:
Expand Down Expand Up @@ -120,7 +123,9 @@ def LoadZip(self, url):
temp.seek(0)
finally:

dlg = wx.MessageDialog(None, _("Are you sure to upgrade librairies from new version ?"), _("Upgrade Manager"), wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
dlg = wx.MessageDialog(None, _("Are you sure to upgrade librairies from new version ?"),
_("Upgrade Manager"),
wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)

if dlg.ShowModal() == wx.ID_YES:
unzipper = unzip()
Expand Down
13 changes: 7 additions & 6 deletions Container.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
from traceback import format_exception
from math import * ### for eval

if builtins.__dict__.get('GUI_FLAG',True):
if builtins.__dict__.get('GUI_FLAG', True):
import ConnectDialog
import DiagramConstantsDialog
import SpreadSheet
Expand All @@ -75,14 +75,15 @@
import WizardGUI
import LabelGUI

RED = '#d91e1e'
GREEN = '#90ee90'
BLACK = '#000000'
BLUE = '#add8e6'
### Color definition
RED = '#d91e1e'
GREEN = '#90ee90'
BLACK = '#000000'
BLUE = '#add8e6'

import Components

if builtins.__dict__.get('GUI_FLAG',True):
if builtins.__dict__.get('GUI_FLAG', True):
import Menu

#import ReloadModule
Expand Down
6 changes: 6 additions & 0 deletions ControlNotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
from AttributeEditor import AttributeEditor
from Mixins.Attributable import Attributable

## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
#
# CLASSES DEFINITION
#
## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##

### --------------------------------------------------------------------------
class GeneralNotebook(Observer):
def __init__(self, *args, **kwargs):
Expand Down
2 changes: 2 additions & 0 deletions DSV.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@
from functools import reduce
os.putenv('LANG', 'C')

import gettext
_ = gettext.gettext

import wx
import wx.grid
Expand Down
3 changes: 3 additions & 0 deletions Decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
import pickle
import cProfile, pstats, io

import gettext
_ = gettext.gettext

if builtins.__dict__.get('GUI_FLAG',True):
import wx
if wx.VERSION_STRING < '4.0':
Expand Down
3 changes: 3 additions & 0 deletions DetachedFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import wx
import builtins

import gettext
_ = gettext.gettext

if wx.VERSION_STRING >= '4.0':
wx.ST_SIZEGRIP = wx.STB_SIZEGRIP

Expand Down
8 changes: 5 additions & 3 deletions DomainInterface/DomainBehavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,19 @@ def phaseIs(self, phase:str)->bool:
return phase == self.state['status']

def passivate(self)->None:
self.passivateIn('passive')
return self.passivateIn('passive')

def passivateIn(self, phase:str="")->None:
self.holdIn(phase, sigma=INFINITY)
return self.holdIn(phase, sigma=INFINITY)

def holdIn(self, phase:str="", sigma:float=0.0)->None:
''' "Holding in phase " + phase + " for time " + sigma
'''
self.state['status'] = phase
self.state['sigma'] = sigma

return self.state

###
def pokePyPDEVS(self, p, v)->dict:
### adapted with PyPDEVS
Expand Down Expand Up @@ -143,7 +145,7 @@ def getMsgPyDEVSTime(self, msg):
def getMsgPyPDEVSTime(self, msg):
return msg[1][0]

def getFlatComponentSet (self):
def getFlatComponentSet(self):
return {self.name : self}

def getSigma(self)->float:
Expand Down
1 change: 0 additions & 1 deletion Editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#
## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##


import wx
import os
import sys
Expand Down
3 changes: 3 additions & 0 deletions ExperimentGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import Container
import DetachedFrame

import gettext
_ = gettext.gettext

class ExperimentGenerator:
"""
"""
Expand Down
5 changes: 4 additions & 1 deletion ImportLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
from wx.lib.mixins.listctrl import CheckListCtrlMixin, ListCtrlAutoWidthMixin
import wx.lib.dialogs
from concurrent.futures import ThreadPoolExecutor

import gettext
_ = gettext.gettext

from Utilities import checkURL, getDirectorySize, RecurseSubDirs, getPYFileListFromInit, NotificationMessage
from Decorators import BuzyCursorNotification
Expand Down Expand Up @@ -417,7 +420,7 @@ def OnDelete(self, evt):

### delete files
if db.rb2.GetValue():
dial = wx.MessageDialog(None, _('Are you sure to delete python files into the %s directory?')%(label), label, wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
dial = wx.MessageDialog(None, _('Are you sure to delete python files into the %s directory?')%(label), _("Delete Directory"), wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)

if dial.ShowModal() == wx.ID_YES:
try:
Expand Down
22 changes: 16 additions & 6 deletions LibraryTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@

from pubsub import pub

_ = wx.GetTranslation
import gettext
_ = gettext.gettext

## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
#
Expand Down Expand Up @@ -199,12 +200,15 @@ def OnMotion(self, evt):
if model_list:
tip = _("Models:\n -")
tip += '\n -'.join(model_list)
tip += '\n'
else:
tip = ""

tip += _("\nSub-Domains:\n")
tip += '\n -'.join(domain_list)
if len(domain_list) > 0:
tip += _("\n\nSub-Domains:")
if len(domain_list) == 1:
tip += " "+domain_list[0]
else:
tip += '\n -'.join(domain_list)

### is last item
else:
Expand Down Expand Up @@ -323,7 +327,10 @@ def OnDelete(self, evt):

if os.path.isdir(path):

dial = wx.MessageDialog(None, _('Are you sure to delete from disk the librairie %s ?')%(label), label, wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
dial = wx.MessageDialog(None,
_('Are you sure to delete from disk the librairie %s ?')%(label),
_("Delete Directory"),
wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
if dial.ShowModal() == wx.ID_YES:
try:
### delete directory
Expand All @@ -339,7 +346,10 @@ def OnDelete(self, evt):

else:

dial = wx.MessageDialog(None, _('Are you sure to delete from disk the python file %s ?')%(label), label, wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
dial = wx.MessageDialog(None,
_('Are you sure to delete from disk the python file %s ?')%(label),
_("Delete File"),
wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
if dial.ShowModal() == wx.ID_YES:
try:
### delete file
Expand Down
3 changes: 2 additions & 1 deletion Menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
from PluginManager import PluginManager
from ExperimentGenerator import ExperimentGenerator

_ = wx.GetTranslation
import gettext
_ = gettext.gettext

if wx.VERSION_STRING > '4.0.1': wx.NewId = wx.NewIdRef

Expand Down
3 changes: 3 additions & 0 deletions Mixins/Abstractable.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

import sys

import gettext
_ = gettext.gettext

from Mixins.Attributable import Attributable

import Container
Expand Down
3 changes: 3 additions & 0 deletions Patterns/Factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

import builtins

import gettext
_ = gettext.gettext

if builtins.__dict__.get('GUI_FLAG',True):
import wx

Expand Down
3 changes: 3 additions & 0 deletions PrintOut.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import sys
import copy

import gettext
_ = gettext.gettext

class Printout(wx.Printout):

def __init__(self, canvas, title = "", size=(800, 800)):
Expand Down
3 changes: 1 addition & 2 deletions SimulationGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
def timer():
last = time.time()
delta = 0
time.clock()
time.time()
while True:
now = time.time()
delta += now - last
Expand Down Expand Up @@ -753,7 +753,6 @@ def ErrorManager(self, msg):
### if user want to correct error through an editor, we stop simulation process for trying again after the error is corrected.
self.OnStop(event)
else:
print(msg)
raise MyBad(msg)

class SimulationDialogPanel(Base, wx.Panel):
Expand Down
3 changes: 2 additions & 1 deletion SimulationNoGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def __init__(self, master, time):

###
def Run(self):
""" run simulation
""" run simulation.
"""

assert(self.master is not None)
Expand All @@ -231,6 +231,7 @@ def Run(self):
from SimulationGUI import simulator_factory
if not self.ntl:
self.master.FINAL_TIME = float(self.time)

self.thread = simulator_factory(self.master, self.selected_strategy, self.prof, self.ntl, self.verbose, self.dynamic_structure_flag, self.real_time_flag)

return self.thread
4 changes: 4 additions & 0 deletions SpreadSheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
from PlotGUI import *
from Utilities import printOnStatusBar

import gettext
_ = gettext.gettext

###
class MySheet(sheet.CSheet):
"""
Expand Down Expand Up @@ -142,6 +145,7 @@ def __init__(self, parent, id, title, aDEVS, separator=" "):
toolbar.AddSeparator()
self.chart = toolbar.AddTool(wx.NewIdRef(), wx.Bitmap(os.path.join(ICON_PATH,'graph_guru.png')), _('Chart'), '')
else:

new = toolbar.AddTool(wx.NewIdRef(), "", wx.Bitmap(os.path.join(ICON_PATH,'new.png')), _('New'))
open_file = toolbar.AddTool(wx.NewIdRef(), "", wx.Bitmap(os.path.join(ICON_PATH,'open.png')), _('Open'))
saveas = toolbar.AddTool(wx.NewIdRef(), "", wx.Bitmap(os.path.join(ICON_PATH,'save.png')), _('SaveAs'))
Expand Down
4 changes: 3 additions & 1 deletion Utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ def printOnStatusBar(statusbar, data={}):
for k,v in list(data.items()):
statusbar.SetStatusText(v, k)

def NotificationMessage(title,message,parent,flag=wx.ICON_INFORMATION, timeout=False):
def NotificationMessage(title,message,parent, flag=2048, timeout=False):
""" 2048 is wx.ICON_INFORMATION
"""
if builtins.__dict__['NOTIFICATION']:
notify = wx.adv.NotificationMessage(
title=title,
Expand Down
3 changes: 3 additions & 0 deletions XMLModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
import tempfile
import wx

import gettext
_ = gettext.gettext

import xml.etree.ElementTree as ET
from xml.dom import minidom

Expand Down
9 changes: 8 additions & 1 deletion devsimpy-nogui.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
'LOG_FILE': os.devnull, # log file (null by default)
'DEFAULT_SIM_STRATEGY': 'bag-based', #choose the default simulation strategy for PyDEVS
'PYDEVS_SIM_STRATEGY_DICT' : {'original':'SimStrategy1', 'bag-based':'SimStrategy2', 'direct-coupling':'SimStrategy3'}, # list of available simulation strategy for PyDEVS package
'PYPDEVS_SIM_STRATEGY_DICT' : {'classic':'SimStrategy4', 'distributed':'SimStrategy5', 'parallel':'SimStrategy6'}, # list of available simulation strategy for PyPDEVS package
'PYPDEVS_SIM_STRATEGY_DICT' : {'classic':'SimStrategy4', 'parallel':'SimStrategy5'}, # list of available simulation strategy for PyPDEVS package
'PYPDEVS_221_SIM_STRATEGY_DICT' : {'classic':'SimStrategy4', 'parallel':'SimStrategy5'}, # list of available simulation strategy for PyPDEVS package
'HELP_PATH' : os.path.join('doc', 'html'), # path of help directory
'NTL' : False, # No Time Limit for the simulation
'DYNAMIC_STRUCTURE' : False, #Dynamic structure for PyPDEVS simulation
Expand Down Expand Up @@ -101,6 +102,8 @@ def simulate(devs, duration, simu_name, is_remote):
parser.add_argument("-name", help="simulation name", type=str, default="simu")
# optional kernel for simulation kernel
parser.add_argument("-kernel", help="simulation kernel [pyDEVS|PyPDEVS]", type=str, default="pyDEVS")
# optional real time
parser.add_argument("-rt", help="real time simulation (only for PyPDEVS)", action="store_true")
# non-simulation options
group = parser.add_mutually_exclusive_group()
group.add_argument("-js", "--javascript",help="generate JS file", action="store_true")
Expand All @@ -114,6 +117,10 @@ def simulate(devs, duration, simu_name, is_remote):
if 'PyPDEVS' in args.kernel:
builtins.__dict__['DEFAULT_DEVS_DIRNAME'] = 'PyPDEVS_221'
builtins.__dict__['DEFAULT_SIM_STRATEGY'] = 'parallel'

### Real time only for PyPDEVS...
if args.rt:
builtins.__dict__['REAL_TIME'] = True

filename = args.filename

Expand Down
Loading