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
17 changes: 10 additions & 7 deletions Domain/Generator/RandomGenerator.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# -*- coding: utf-8 -*-

"""
Name: RandomGenerator.py
Brief descritpion: Generate random message.
Author(s): L. Capocchi <capocchi@univ-corse.fr>, B. Poggi <bpoggi@univ-corse.fr>
Version: 1.0
Last modified: 2020.10.18
GENERAL NOTES AND REMARKS:
GLOBAL VARIABLES AND FUNCTIONS:
"""
from DomainInterface.DomainBehavior import DomainBehavior
from DomainInterface.Object import Message

import random

class RandomGenerator(DomainBehavior):
"""
@author: Bastien POGGI
@organization: University Of Corsica
@contact: bpoggi@univ-corse.fr
@since: 2010.12.1
@version: 1.0
""" RandomGenerator Class.
"""

def __init__(self, minValue=0, maxValue=10, minStep=1, maxStep=1, start=0, choice=[]):
Expand Down
2 changes: 2 additions & 0 deletions Domain/Generator/XMLGenerator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
''' XMLGenerator Model.
'''

from Generator.Generator import *
from xml.dom import minidom
Expand Down
28 changes: 22 additions & 6 deletions ImportLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def __init__(self, *args, **kw):
# index = evt.GetItem().GetId()
# self.CheckItem(index, False)

###
def AddItem(self, path, dName, check=False):
""" Add item to the list.
"""
Expand All @@ -101,9 +102,11 @@ def AddItem(self, path, dName, check=False):
self.SetData(index, path)
self.SetItemData(index, index)

###
def GetData(self, id):
return self.map[id]

###
def SetData(self, id, data):
self.map.update({id:data})

Expand All @@ -118,6 +121,7 @@ class DeleteBox(wx.Dialog):
""" Delete box for libraries manager.
"""

###
def __init__(self, *args, **kwargs):
""" Constructor.
"""
Expand All @@ -126,7 +130,8 @@ def __init__(self, *args, **kwargs):
self.InitUI()
self.SetSize((250, 200))
self.Centre()


###
def InitUI(self):
""" Init the user interface.
"""
Expand Down Expand Up @@ -281,6 +286,7 @@ def __init__(self, *args, **kwargs):
e = wx.SizeEvent(self.GetSize())
self.ProcessEvent(e)

###
def CheckDomainPath(self):
"""
"""
Expand All @@ -291,20 +297,23 @@ def CheckDomainPath(self):
dlg.ShowModal()
dlg.Destroy()

###
def OnSelectAll(self, event):
"""
"""
num = self._cb.GetItemCount()
for i in range(num):
self._cb.CheckItem(i,True)

###
def OnDeselectAll(self, event):
"""
"""
num = self._cb.GetItemCount()
for i in range(num):
self._cb.CheckItem(i, False)

###
def OnItemRightClick(self, evt):
"""Launcher creates wxMenu.
"""
Expand Down Expand Up @@ -335,6 +344,7 @@ def OnItemRightClick(self, evt):

menu.Destroy() # destroy to avoid mem leak

###
def DocDirectory(self, path):
""" Return doc of all modules composing path directory by reading its __ini__.py
"""
Expand Down Expand Up @@ -372,6 +382,7 @@ def DocDirectory(self, path):

return doc

###
def OnDoc(self, evt):
""" Documentation of item has been invocked.
"""
Expand All @@ -392,6 +403,7 @@ def OnDoc(self, evt):
d.CenterOnParent(wx.BOTH)
d.ShowModal()

###
def OnDelete(self, evt):
""" Delete Button has been clicked.
"""
Expand Down Expand Up @@ -427,6 +439,7 @@ def OnDelete(self, evt):

self._cb.DeleteItem(index)

###
def EvtCheckListBox(self, evt):
"""
"""
Expand Down Expand Up @@ -465,6 +478,7 @@ def CreateInitFile(path):
f.write("\t\t'%s', \n"%name)
f.write('\t\t ]')

###
def OnNew(self, event):
"""
"""
Expand All @@ -481,7 +495,7 @@ def OnNew(self, event):
# Checking if the list is empty or not
if len(dir) == 0:
if not '__init__.py' in dir:
self.CreateInitFile(path)
ImportLibrary.CreateInitFile(path)

self.DoAdd(path, os.path.basename(path))

Expand All @@ -504,6 +518,7 @@ def OnNew(self, event):
dial = wx.MessageDialog(self, _('%s is already imported!')%dName, _('New librarie manager'), wx.OK|wx.ICON_INFORMATION)
dial.ShowModal()

###
def DoAdd(self, path, dName):
"""
"""
Expand All @@ -522,17 +537,18 @@ def DoAdd(self, path, dName):
if not path.startswith('http') and (not os.path.exists(os.path.join(path,'__init__.py') and len(os.listdir(path)) == 0)):
dial = wx.MessageDialog(self, _('%s directory has no __init__.py file.\nDo you want to create it?')%path, _('New librarie Manager'), wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
if dial.ShowModal() == wx.ID_YES:
self.CreateInitFile(path)
ImportLibrary.CreateInitFile(path)
dial.Destroy()

NotificationMessage(_('Information'), _("Librarie %s has been succeffully added!")%dName, self, timeout=5)

NotificationMessage(_('Information'), _("Library %s has been succeffully added!")%dName, self, timeout=5)

###
def OnAdd(self, evt):
"""
"""
self.OnNew(evt)


###
def OnCloseWindow(self, event):
"""
"""
Expand Down
Loading