Exemplo n.º 1
0
    def __init__(self, parent, ID, log, title, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE):
        pre = wx.PreDialog()
        pre.Create(parent, ID, title, pos, size, style)
        self.this = pre.this
        self.parent = parent
        self.log = log

 #~ ------------------------------
        nodeLbl = wx.StaticText(self, -1, "Node")
        default = "enter/select node to run"
        self.nodeTxtCtrl = wx.TextCtrl(self, NODE_TXTCTRL_ID, default, size=(300, -1), style=wx.TE_PROCESS_ENTER )

        wx.EVT_TEXT_ENTER(self, self.nodeTxtCtrl.GetId(), self.OnOk)
        
        self.logCheckBox = wx.CheckBox(self, -1, "Direct output to a logfile", style=wx.ALIGN_RIGHT)
        self.logCheckBox.SetValue(True)
        wx.EVT_CHECKBOX(self, self.logCheckBox.GetId(), self.OnCheck)
        
        logBoxLabel = wx.StaticText(self, -1, "Log File")
        self.logTxtCtrl = wx.TextCtrl(self, -1, "run.log", size=(300, -1), style=wx.TE_PROCESS_ENTER)
        #self.logTxtCtrl.SetEditable(False)

        self.bg_bmp = images.getGridBGBitmap()
        wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
        #---------------------------------
        # button fixtures
        bBrowseID = wx.NewId()
        bBrowse = wx.Button(self, bBrowseID, "browse")
        bBrowse.SetBackgroundColour("BLACK")
        bBrowse.SetForegroundColour("WHITE")

        wx.EVT_BUTTON(self, bBrowse.GetId(), self.OnBrowse)

        bOk = wx.Button(self, wx.ID_OK, "OK")
        bOk.SetDefault()
        wx.EVT_BUTTON(self, bOk.GetId(), self.OnOk)
        bCan = wx.Button(self, wx.ID_CANCEL, "Cancel")
        wx.EVT_BUTTON(self, bCan.GetId(), self.OnCancel)

        bsizer = wx.BoxSizer(wx.HORIZONTAL)
        bsizer.Add(bBrowse, 0, wx.GROW|wx.ALL, 4)
        bsizer.Add(bOk, 0, wx.GROW|wx.ALL, 4)
        bsizer.Add(bCan, 0, wx.GROW|wx.ALL, 4)

        sizer = wx.FlexGridSizer(cols=3, hgap=6, vgap=6)
        sizer.AddMany([nodeLbl, self.nodeTxtCtrl, (0,0), (0,0), self.logCheckBox,  (0,0), logBoxLabel, self.logTxtCtrl, (0, 0),
                        (0,0),bsizer,(0,0),])
        border = wx.BoxSizer(wx.VERTICAL)
        border.Add(sizer, 0, wx.ALL, 25)



        self.SetSizer(border)
        self.SetAutoLayout(True)
Exemplo n.º 2
0
    def __init__(self, parent):
        wx.ScrolledWindow.__init__(self, parent, -1)

        # Populate our color list
        self.clrList = wx.lib.colourdb.getColourList()

        # Just for style points, we'll use this as a background image.
        #self.clrList.sort()
        self.bg_bmp = images.getGridBGBitmap()

        # This could also be done by getting the window's default font;
        # either way, we need to have a font loaded for later on.
        #self.SetBackgroundColour("WHITE")
        self.font = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL)

        # Create drawing area and set its font
        dc = wx.ClientDC(self)
        dc.SetFont(self.font)

        # Using GetFullTextExtent(), we calculate a basic 'building block'
        # that will be used to draw a depiction of the color list. We're
        # using 'Wy' as the model becuase 'W' is a wide character and 'y' 
        # has a descender. This constitutes a 'worst case' scenario, which means
        # that no matter what we draw later, text-wise, we'll have room for it
        w,h,d,e = dc.GetFullTextExtent("Wy") 

        # Height plus descender
        self.textHeight = h + d

        # Pad a little bit
        self.lineHeight = self.textHeight + 5

        # ... and this is the basic width.
        self.cellWidth = w

        # jmg 11/8/03: why 24?
        numCells = 24
        
        # 'prep' our scroll bars.
        self.SetScrollbars(
            self.cellWidth, self.lineHeight, numCells, len(self.clrList) + 2
            )
            
        # Event handlers - moved here so events won't fire before init is 
        # finished.
        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
Exemplo n.º 3
0
    def __init__(self, parent):
        wx.ScrolledWindow.__init__(self, parent, -1)

        # Populate our color list
        self.clrList = wx.lib.colourdb.getColourList()

        # Just for style points, we'll use this as a background image.
        #self.clrList.sort()
        self.bg_bmp = images.getGridBGBitmap()

        # This could also be done by getting the window's default font;
        # either way, we need to have a font loaded for later on.
        #self.SetBackgroundColour("WHITE")
        self.font = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL)

        # Create drawing area and set its font
        dc = wx.ClientDC(self)
        dc.SetFont(self.font)

        # Using GetFullTextExtent(), we calculate a basic 'building block'
        # that will be used to draw a depiction of the color list. We're
        # using 'Wy' as the model becuase 'W' is a wide character and 'y'
        # has a descender. This constitutes a 'worst case' scenario, which means
        # that no matter what we draw later, text-wise, we'll have room for it
        w, h, d, e = dc.GetFullTextExtent("Wy")

        # Height plus descender
        self.textHeight = h + d

        # Pad a little bit
        self.lineHeight = self.textHeight + 5

        # ... and this is the basic width.
        self.cellWidth = w

        # jmg 11/8/03: why 24?
        numCells = 24

        # 'prep' our scroll bars.
        self.SetScrollbars(self.cellWidth, self.lineHeight, numCells,
                           len(self.clrList) + 2)

        # Event handlers - moved here so events won't fire before init is
        # finished.
        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
Exemplo n.º 4
0
    def __init__(self):
        wx.MDIParentFrame.__init__(self, None, -1, "MDI Parent", size=(600,400))

        self.winCount = 0
        menu = wx.Menu()
        menu.Append(ID_New, "&New Window")
        menu.AppendSeparator()
        menu.Append(ID_Exit, "E&xit")

        menubar = wx.MenuBar()
        menubar.Append(menu, "&File")
        self.SetMenuBar(menubar)

        self.CreateStatusBar()

        self.Bind(wx.EVT_MENU, self.OnNewWindow, id=ID_New)
        self.Bind(wx.EVT_MENU, self.OnExit, id=ID_Exit)

        if SHOW_BACKGROUND:
            self.bg_bmp = images.getGridBGBitmap()
            self.GetClientWindow().Bind(
                wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground
                )
Exemplo n.º 5
0
    def __init__(self, parent, frame, log):
        wxPanel.__init__(self, parent, -1)
        self.society = None
        self.hierarchy = None
        self.URL = None
        self.log = log
        self.frame = frame
        self.printData = wxPrintData()
        self.printData.SetPaperId(wxPAPER_LETTER)
        self.heatRange  = {50:"PURPLE", 100:"BLUE", 125:"SEA GREEN", 150:"ORANGE", 1000:"RED" }
#--------
        self.box = wxBoxSizer(wxVERTICAL)
        self.canvas = AgentCanvas(self, frame, log)
        self.box.Add(self.canvas, 1, wxGROW)
        subbox = wxBoxSizer(wxHORIZONTAL)


        # ------
        self.viewSocietyButton = wxButton(self, 11, "View Agents")
        EVT_BUTTON(self, 11, self.OnViewSociety)
        self.viewSocietyButton.SetBackgroundColour("BLUE")
        self.viewSocietyButton.SetForegroundColour("YELLOW")
        #~ self.viewSocietyButton.SetDefault()
        subbox.Add(self.viewSocietyButton, flag=wxALIGN_CENTER_VERTICAL | wxBOTTOM, border=20)


        # ------

        EVT_AGENT_TASK_COUNT(self, self.AgentTaskCountUpdate)

        # ------
        # ------
        self.ZoomPlusButton = wxButton(self, 12, "+")
        EVT_BUTTON(self, 12, self.OnZoomPlus)
        self.ZoomPlusButton.SetBackgroundColour(wxGREEN)
        self.ZoomPlusButton.SetForegroundColour(wxWHITE)

        subbox.Add(self.ZoomPlusButton, flag=wxALIGN_CENTER_VERTICAL | wxBOTTOM, border=20)

       # ------
        self.ZoomMinusButton = wxButton(self, 13, "-")
        EVT_BUTTON(self, 13, self.OnZoomMinus)
        self.ZoomMinusButton.SetBackgroundColour(wxRED)
        self.ZoomMinusButton.SetForegroundColour(wxWHITE)
        subbox.Add(self.ZoomMinusButton, flag=wxALIGN_CENTER_VERTICAL | wxBOTTOM, border=20)
       # ------
        #~ self.viewServletButton = wxButton(self, 15, "Servlet Options")
        #~ EVT_BUTTON(self, 15, self.viewServletOptions)
        #~ self.viewServletButton.SetBackgroundColour(wxBLACK)
        #~ self.viewServletButton.SetForegroundColour(wxWHITE)
        #~ self.viewSocietyButton.SetDefault()
        #~ subbox.Add(self.viewServletButton, flag=wxALIGN_CENTER_VERTICAL | wxBOTTOM, border=20)

        # ------
        self.testServletButton = wxButton(self, 16, "Agent Probes")
        EVT_BUTTON(self, 16, self.AgentTaskCountUpdate)
        self.testServletButton.SetBackgroundColour(wxCYAN)
        self.testServletButton.SetForegroundColour(wxBLACK)
        #~ self.viewSocietyButton.SetDefault()
        subbox.Add(self.testServletButton, flag=wxALIGN_CENTER_VERTICAL | wxBOTTOM, border=20)

        #~ EVT_SOCIETYCONTROLLER_TEST(self, self.EventUpdate)
        self.box.Add(subbox, 0, wxGROW)

        self.SetAutoLayout(True)
        self.SetSizer(self.box)
        self.bg_bmp = images.getGridBGBitmap()
        EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
Exemplo n.º 6
0
    def __init__(self, parent, frame, log):

        ### instance variables
        self.maxWidth = 1280
        self.maxHeight = 1000
        self.parent = parent
        self.frame = frame  # top-level frame containing this wxPanel
        self.transformServer = None  # for transforming societies with rules
        self.aRuleIsChecked = False
        self.filename = None
        self.ruleBooks = []
        self.ruleIndex = {}
        self.tempSociety = None

        ### static layout items
        wxPanel.__init__(self, parent, -1)
        self.log = log
        self.winCount = 0
        sizer = RowColSizer()

        # RuleBook button
        tID = wxNewId()
        self.ruleBookButton = wxButton(self, tID, "Open RuleBook")
        EVT_BUTTON(self, tID, self.OnOpenRuleBook)
        self.ruleBookButton.SetBackgroundColour(wxBLUE)
        self.ruleBookButton.SetForegroundColour(wxWHITE)
        self.ruleBookButton.SetDefault()
        sizer.Add(self.ruleBookButton, flag=wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, pos=(1, 1), colspan=2)

        # Rule CheckListBox
        tID = wxNewId()
        rules = []
        self.lb = wxCheckListBox(self, tID, size=(-1, 250), choices=rules, style=wxLB_NEEDED_SB | wxLB_HSCROLL)
        # ~ style=wxLB_NEEDED_SB|wxLB_HSCROLL|wxLB_SORT)
        sizer.Add(self.lb, flag=wxEXPAND, pos=(2, 1), colspan=2, rowspan=11)
        EVT_LISTBOX(self, tID, self.OnListBox)
        EVT_CHECKLISTBOX(self, tID, self.OnChecklistBox)
        ###
        EVT_UPDATE_SOCIETY(self, self.OnUpdate)

        # Rule Description label
        tID = wxNewId()
        self.descLabel = wxStaticText(self, tID, "Rule Description:")
        sizer.Add(self.descLabel, flag=wxALIGN_CENTER_VERTICAL, pos=(1, 4))

        # Rule Description text box
        tID = wxNewId()
        self.ruleDescription = wxTextCtrl(self, tID, "", size=(220, -1), style=wxTE_READONLY)
        self.ruleDescription.SetInsertionPoint(0)
        sizer.Add(self.ruleDescription, pos=(2, 4), colspan=2)

        # Society name label
        tID = wxNewId()
        self.societyNameLabel = wxStaticText(self, tID, "Current Society:")
        sizer.Add(self.societyNameLabel, flag=wxLEFT | wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, border=20, pos=(1, 6))

        # Society name text box
        tID = wxNewId()
        self.societyName = wxTextCtrl(self, tID, "", size=(180, -1), style=wxTE_READONLY)
        self.societyName.SetStyle(0, len(self.societyName.GetValue()), wxTextAttr(wxBLUE))
        sizer.Add(
            self.societyName, flag=wxLEFT | wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, border=20, pos=(2, 6), colspan=2
        )

        # Rule label
        tID = wxNewId()
        self.ruleLabel = wxStaticText(self, tID, "Rule:")
        sizer.Add(self.ruleLabel, flag=wxALIGN_CENTER_VERTICAL, pos=(3, 4))

        # Rule styled text box
        tID = wxNewId()
        self.rule = EditorControl(self, tID, self.log)
        sizer.Add(self.rule, flag=wxEXPAND, pos=(4, 4), colspan=6, rowspan=11)

        # Apply Rules button
        tID = wxNewId()
        self.applyRulesButton = wxButton(self, tID, "Apply Rules")
        EVT_BUTTON(self, tID, self.OnApplyRules)
        self.applyRulesButton.Enable(false)
        sizer.Add(
            self.applyRulesButton,
            flag=wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
            pos=(14, 1),
            colspan=2,
            rowspan=1,
        )

        # Create New Rule button
        tID = wxNewId()
        createRuleButton = wxButton(self, tID, "Create New Rule")
        EVT_BUTTON(self, tID, self.OnCreateRule)
        sizer.Add(
            createRuleButton,
            flag=wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
            pos=(16, 1),
            colspan=2,
            rowspan=1,
        )

        # Button sizer to hold buttons along bottom
        self.btnSizer = wxBoxSizer(wxHORIZONTAL)

        # Save Rule button
        tID = wxNewId()
        self.saveRuleButton = wxButton(self, tID, "Save Rule")
        EVT_BUTTON(self, tID, self.OnSaveRule)
        self.saveRuleButton.Enable(false)
        self.btnSizer.Add(self.saveRuleButton, flag=wxLEFT | wxRIGHT, border=20)

        # Open Society button
        tID = wxNewId()
        self.openSocietyButton = wxButton(self, tID, "Open Society")
        EVT_BUTTON(self, tID, self.OnOpenSociety)
        self.openSocietyButton.SetBackgroundColour(wxGREEN)
        self.btnSizer.Add(self.openSocietyButton, flag=wxLEFT | wxRIGHT, border=20)

        # Save Society button
        tID = wxNewId()
        self.saveSocietyButton = wxButton(self, tID, "Save Society")
        EVT_BUTTON(self, tID, self.OnSaveSociety)
        self.saveSocietyButton.Enable(false)
        self.btnSizer.Add(self.saveSocietyButton, flag=wxLEFT | wxRIGHT, border=20)

        # Undo Transform button
        tID = wxNewId()
        self.undoTransformButton = wxButton(self, tID, "Undo Transform")
        EVT_BUTTON(self, tID, self.OnUndoTransform)
        self.undoTransformButton.Enable(false)
        self.btnSizer.Add(self.undoTransformButton, flag=wxLEFT | wxRIGHT, border=20)

        sizer.Add(self.btnSizer, pos=(16, 4), colspan=6)

        # Progress gizmo image
        tID = wxNewId()
        lesImages = [gizmoImages.catalog[i].getBitmap() for i in gizmoImages.index]
        self.gizmo = Gizmo(self, -1, lesImages, size=(36, 36), frameDelay=0.1)
        sizer.Add(self.gizmo, pos=(2, 9), flag=wxALIGN_RIGHT, rowspan=2)

        if SHOW_BACKGROUND:
            self.bg_bmp = images.getGridBGBitmap()
            EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)

        # Add finishing touches to the layout
        sizer.AddGrowableCol(7)  # makes rule styled text box and Society Viewer expand to the right on window resize
        sizer.AddGrowableRow(4)  # makes Society Viewer expand downward on window resize
        sizer.AddSpacer(10, 10, pos=(1, 10))  # adds a constant size border along top and right side
        sizer.AddSpacer(10, 10, pos=(17, 1))  # adds a constant size border along bottom and left side

        self.SetSizer(sizer)
        self.SetAutoLayout(true)

        EVT_RIGHT_DOWN(self.lb, self.OnRightDown)  # emits a wxMouseEvent
        EVT_RIGHT_UP(self.lb, self.OnRightUp)  # emits a wxMouseEvent
Exemplo n.º 7
0
  def __init__( self, parent, frame, log ):
    wx.Panel.__init__( self, parent, -1 )
    self.log = log
    sizer = rcs.RowColSizer()
    self.frame = frame # top-level frame that contains this wx.Panel
    self.frame.societyOpen = 0
    self.infoFrameOpen = 0
    self.societyFile = None
    self.frame.societyFile = None
    self.itemGrabbed = False
### static controls:

    btnBox = wx.BoxSizer(wx.HORIZONTAL)

    self.openSocietyButton = wx.Button(self, 10, "Open Society")
#    EVT_BUTTON(self, 10, self.OnOpenSociety)
    self.Bind(wx.EVT_BUTTON, self.OnOpenSociety, self.openSocietyButton) 
    self.openSocietyButton.SetBackgroundColour(wx.BLUE)
    self.openSocietyButton.SetForegroundColour(wx.WHITE)
    self.openSocietyButton.SetDefault()
    btnBox.Add(self.openSocietyButton, flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM, border=20)

    self.saveSocietyButton = wx.Button(self, 20, "Save Society")
#    EVT_BUTTON(self, 20, self.OnSaveSociety)
    self.Bind(wx.EVT_BUTTON, self.OnSaveSociety, self.saveSocietyButton) 

    self.saveSocietyButton.Enable(False)
    btnBox.Add(self.saveSocietyButton, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.BOTTOM, border=20)

    self.closeSocietyButton = wx.Button(self, 15, "Close Society")
#    EVT_BUTTON(self, 15, self.OnCloseSociety)
    self.Bind(wx.EVT_BUTTON, self.OnCloseSociety, self.closeSocietyButton) 
    self.closeSocietyButton.Enable(False)
    btnBox.Add(self.closeSocietyButton, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.BOTTOM, border=20)

    nextHighlightBtnId = wx.NewId()
    self.nextHighlightButton = wx.Button(self, nextHighlightBtnId, "Next Highlight")
#    EVT_BUTTON(self, nextHighlightBtnId, self.OnShowNextHighlight)
    self.Bind(wx.EVT_BUTTON, self.OnShowNextHighlight, self.nextHighlightButton) 
    self.nextHighlightButton.Enable(False)
    btnBox.Add(self.nextHighlightButton, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.BOTTOM, border=20)

    self.getHnaMapButton = wx.Button(self, 25, "Get HNA Map")
#    EVT_BUTTON(self, 25, self.OnGetHnaMap)
    self.Bind(wx.EVT_BUTTON, self.OnGetHnaMap, self.getHnaMapButton) 
    self.getHnaMapButton.Enable(False)
    btnBox.Add(self.getHnaMapButton, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.BOTTOM, border=20)

    sizer.Add(btnBox, pos=(1,1),  flag=wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL)

    lesImages = [gizmoImages.catalog[i].getBitmap() for i in gizmoImages.index]
    self.gizmo = Gizmo(self, -1, lesImages, size=(36, 36), frameDelay = 0.1)
#    EVT_UPDATE_SOCIETY(self, self.OnUpdate)
    self.Bind(EVT_UPDATE_SOCIETY, self.OnUpdate)
    sizer.Add(self.gizmo, pos=(1,2), flag=wx.BOTTOM | wx.ALIGN_RIGHT, border=20)

    self.il = wx.ImageList(16,16)
    self.societyImage   = self.il.Add(images.getSocietyBitmap())
    self.hostImage      = self.il.Add(images.getHostBitmap())
    self.nodeImage      = self.il.Add(images.getNodeBitmap())
    self.agentImage     = self.il.Add(images.getAgentBitmap())
    self.componentImage = self.il.Add(images.getComponentBitmap())
    self.argumentImage  = self.il.Add(images.getArgumentBitmap())
    self.questionImage  = self.il.Add(images.getQuestionBitmap())

    tID = wx.NewId()
    self.frame.societyViewer = SocietyViewer(self, tID, 'societyViewer', size=(240, 100),
                               style=wx.TR_HAS_BUTTONS | wx.TR_EDIT_LABELS | wx.TR_MULTIPLE,
                               log=self.log)
    sizer.Add(self.frame.societyViewer, flag=wx.EXPAND, pos=(2,1), colspan=2)
    dropTarget = CougaarDropTarget(self.frame.societyViewer, self.log, self.frame, True)
    self.frame.societyViewer.SetDropTarget(dropTarget)

### Event handlers for various
#    EVT_TREE_END_LABEL_EDIT(self, tID, self.OnEndLabelEdit) #fired by call to wx.TreeCtrl.EditLabel()
    self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnEndLabelEdit, self.frame.societyViewer)
#    EVT_TREE_SEL_CHANGED    (self, tID, self.OnSelChanged)
    self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged,  self.frame.societyViewer)
#    EVT_TREE_SEL_CHANGING(self, tID, self.OnSelChanging)
    self.Bind(wx.EVT_TREE_SEL_CHANGING, self.OnSelChanging,  self.frame.societyViewer)
#    EVT_RIGHT_DOWN(self.frame.societyViewer, self.OnRightClick)  # emits a wx.MouseEvent
#    self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightClick,  self.frame.societyViewer)
    self.frame.societyViewer.Bind(wx.EVT_RIGHT_DOWN, self.OnRightClick)
#    EVT_RIGHT_UP(self.frame.societyViewer, self.OnRightUp)  # emits a wx.MouseEvent
#    self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp,  self.frame.societyViewer)
    self.frame.societyViewer.Bind(wx.EVT_RIGHT_UP, self.OnRightUp)
#    EVT_LEFT_DOWN(self.frame.societyViewer, self.OnLeftDown)  # emits a wx.MouseEvent
    self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown,  self.frame.societyViewer)
#    EVT_LEFT_UP(self.frame.societyViewer, self.OnLeftUp)  # emits a wx.MouseEvent
    self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp,  self.frame.societyViewer)
#    EVT_MOTION(self.frame.societyViewer, self.OnMotion)  # emits a wx.MouseEvent
    self.Bind(wx.EVT_MOTION, self.OnMotion,  self.frame.societyViewer)
###

    self.bg_bmp = images.getGridBGBitmap()
#    EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
    self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
    sizer.AddSpacer(10,10, pos=(1,3)) # adds a constant size space along the right edge
    sizer.AddSpacer(10,10, pos=(3,1)) # adds a constant size space along the bottom
    sizer.AddGrowableCol(1) # makes rule styled text box and Society Viewer expand to the right on window resize
    sizer.AddGrowableRow(2) # makes Society Viewer expand downward on window resize

    self.SetSizer(sizer)
    self.SetAutoLayout(True)
Exemplo n.º 8
0
    def __init__(self, parent, frame, log):
        wx.Panel.__init__(self, parent, -1)
        self.society = None
        self.hierarchy = None
        self.URL = None
        self.log = log
        self.frame = frame
        self.printData = wx.PrintData()
        self.printData.SetPaperId(wx.PAPER_LETTER)
        self.heatRange  = {50:"PURPLE", 100:"BLUE", 125:"SEA GREEN", 150:"ORANGE", 1000:"RED" }
        self.societyRunning = False
#--------
        self.box = wx.BoxSizer(wx.VERTICAL)
        self.canvas = AgentCanvas(self, frame, log)
        self.box.Add(self.canvas, 1, wx.GROW)
        subbox = wx.BoxSizer(wx.HORIZONTAL)

# ------
        self.ctrlSocietyButtonID =  GLOBAL_WIDGET_ID_BASE+1
        self.ctrlSocietyButton = wx.Button(self, self.ctrlSocietyButtonID , "Start")

        wx.EVT_BUTTON(self, self.ctrlSocietyButtonID, self.OnStartSociety)
        self.ctrlSocietyButton.SetBackgroundColour("BLACK")
        self.ctrlSocietyButton.SetForegroundColour("WHITE")
        #~ self.viewSocietyButton.SetDefault()
        subbox.Add(self.ctrlSocietyButton , flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM, border=20)
        # ------
        self.viewSocietyButton = wx.Button(self, GLOBAL_WIDGET_ID_BASE+2, "View Agents")
        wx.EVT_BUTTON(self, GLOBAL_WIDGET_ID_BASE+2, self.OnViewSociety)
        self.viewSocietyButton.SetBackgroundColour("BLUE")
        self.viewSocietyButton.SetForegroundColour("YELLOW")
        #~ self.viewSocietyButton.SetDefault()
        subbox.Add(self.viewSocietyButton, flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM, border=20)
        # ------
        self.Bind(EVT_AGENT_TASK_COUNT, self.AgentTaskCountUpdate)
        # ------
        self.ZoomPlusButton = wx.Button(self, GLOBAL_WIDGET_ID_BASE+3, "+")
        wx.EVT_BUTTON(self, GLOBAL_WIDGET_ID_BASE+3, self.OnZoomPlus)
        self.ZoomPlusButton.SetBackgroundColour(wx.GREEN)
        self.ZoomPlusButton.SetForegroundColour(wx.WHITE)

        subbox.Add(self.ZoomPlusButton, flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM, border=20)

       # ------
        self.ZoomMinusButton = wx.Button(self, GLOBAL_WIDGET_ID_BASE+4, "-")
        wx.EVT_BUTTON(self, GLOBAL_WIDGET_ID_BASE+4, self.OnZoomMinus)
        self.ZoomMinusButton.SetBackgroundColour(wx.RED)
        self.ZoomMinusButton.SetForegroundColour(wx.WHITE)
        subbox.Add(self.ZoomMinusButton, flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM, border=20)
       # ------
        #~ self.viewServletButton = wxButton(self, 15, "Servlet Options")
        #~ wx.EVT_BUTTON(self, 15, self.viewServletOptions)
        #~ self.viewServletButton.SetBackgroundColour(wxBLACK)
        #~ self.viewServletButton.SetForegroundColour(wxWHITE)
        #~ self.viewSocietyButton.SetDefault()
        #~ subbox.Add(self.viewServletButton, flag=wxALIGN_CENTER_VERTICAL | wxBOTTOM, border=20)

        # ------
        self.testServletButton = wx.Button(self, GLOBAL_WIDGET_ID_BASE+5, "Agent Probes")
        wx.EVT_BUTTON(self, GLOBAL_WIDGET_ID_BASE+5, self.AgentTaskCountUpdate)
        self.currTaskCount = None
        self.oldTaskCount = None
        self.testServletButton.SetBackgroundColour(wx.CYAN)
        self.testServletButton.SetForegroundColour(wx.BLACK)
        #~ self.viewSocietyButton.SetDefault()
        subbox.Add(self.testServletButton, flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM, border=20)

        #~ wx.EVT_SOCIETYCONTROLLER_TEST(self, self.EventUpdate)
        self.box.Add(subbox, 0, wx.GROW)

        self.SetAutoLayout(True)
        self.SetSizer(self.box)
        self.bg_bmp = images.getGridBGBitmap()
        wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
        wx.EVT_WINDOW_DESTROY(self, self.OnDestroy)
        ogl.OGLInitialize()