Example #1
0
    def __init__(self, parent, definition):
        PluginPanel.__init__(self, parent, definition)
        self.sequent = None
        self.initializeCommandList()
        self.history = []

        splitter  = wx.SplitterWindow(self, style = wx.SP_NOBORDER)
        splitter.SetMinimumPaneSize(70)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        toolbar = wx.ToolBar(self, wx.ID_ANY, style=wx.TB_HORIZONTAL) # | wx.NO_BORDER)
        lb = wx.ComboBox(toolbar, wx.ID_ANY, pos=(50, 170), size=(150, -1), choices=self.commandList, style=wx.CB_READONLY)
        lb.SetToolTipString("My List of Commands")
        toolbar.AddControl(lb)
        
        undoButton = toolbar.AddTool(wx.ID_ANY, ui.images.getBitmap('undo.gif'), shortHelpString="Undo the last command")
        postponeButton = toolbar.AddTool(wx.ID_ANY, ui.images.getBitmap('rightarrow.png'), shortHelpString="Postpone the current subgoal")
        commentaryButton = toolbar.AddTool(wx.ID_ANY, ui.images.getBitmap('commentary.png'), shortHelpString="Display the commentary box")
        toolbar.AddSeparator()
        quitButton = toolbar.AddTool(wx.ID_ANY, ui.images.getBitmap('quit.png'), shortHelpString="Quit the prover")
        mainSizer.Add(toolbar)

        self.outputTextCtrl = wx.TextCtrl(splitter, wx.ID_ANY, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH | wx.TE_RICH2)

        bottomPanel = wx.Panel(splitter)
        bottomSizer = wx.BoxSizer(wx.VERTICAL)
        horizontalSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.historyBox = wx.ComboBox(bottomPanel, wx.ID_ANY, choices=["history"], style=wx.CB_READONLY)
        self.commandTextControl = wx.TextCtrl(bottomPanel, wx.ID_ANY, "", style=wx.TE_MULTILINE)
        horizontalSizer.Add(wx.StaticText(bottomPanel, wx.ID_ANY, "Enter Rule:"), 1, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 0)
        horizontalSizer.Add(self.historyBox, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 0)
        bottomSizer.Add(horizontalSizer, 0, wx.ALL | wx.EXPAND, 5)
        bottomSizer.Add(self.commandTextControl, 1, wx.ALL | wx.EXPAND, 5)
        self.historyBox.SetSelection(0)
        bottomPanel.SetSizer(bottomSizer)
        
        splitter.SplitHorizontally(self.outputTextCtrl, bottomPanel)
        splitter.SetSashPosition(300)
        mainSizer.Add(splitter, 1, wx.ALL | wx.EXPAND, 0)        
        self.SetSizer(mainSizer)
        
        toolbar.Realize()
        self.commentaryDialog = ui.logdlg.PVSCommunicationLogDialog(util.getMainFrame(), "Proof Commentary", constants.COMMENTARYLOG)

        #self.Bind(wx.EVT_TEXT_ENTER, self.onCommandEntered, self.commandTextControl)
        self.Bind(wx.EVT_TEXT, self.onCommand, self.commandTextControl)
        lb.Bind(wx.EVT_COMBOBOX, self.OnSelectCommand)
        self.historyBox.Bind(wx.EVT_COMBOBOX, self.OnSelectHistory)
        self.Bind(wx.EVT_TOOL, self.OnUndoLastCommand, undoButton)
        self.Bind(wx.EVT_TOOL, self.OnPostponeCommand, postponeButton)
        self.Bind(wx.EVT_TOOL, self.OnCommentaryButtonClicked, commentaryButton)
        self.Bind(wx.EVT_TOOL, self.OnQuitProver, quitButton)
        pub.subscribe(self.proofInformationReceived, constants.PUB_PROOFINFORMATIONRECEIVED)
        self.Layout()
Example #2
0
    def __init__(self, parent, definition):
        PluginPanel.__init__(self, parent, definition)
        self.tree = wx.TreeCtrl(self,
                                wx.ID_ANY,
                                style=wx.TR_HIDE_ROOT | wx.TR_HAS_BUTTONS
                                | wx.TR_LINES_AT_ROOT | wx.TR_DEFAULT_STYLE
                                | wx.SUNKEN_BORDER)
        self.history = []

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        toolbar = wx.ToolBar(self,
                             wx.ID_ANY,
                             style=wx.TB_HORIZONTAL | wx.NO_BORDER)

        toolbarInfo = [ \
                       ["new.gif", "Create a new PVS file", evhdlr.onCreateNewFile], \
                       ["open.gif", "Open an existing PVS file", evhdlr.onOpenFile], \
                       ["save.gif", "Save file", evhdlr.onSaveFile], \
                       ["saveall.gif", "Save all files", evhdlr.onSaveAllFiles], \
                       ["context.png", "Change PVS context", evhdlr.onChangeContext], \
        ]
        self.toolbarButton = {}
        for imageName, tooltipText, command in toolbarInfo:
            buttonID = wx.NewId()
            toolbar.AddTool(buttonID, ui.images.getBitmap(imageName))
            wx.EVT_TOOL(self, buttonID, self.onToolboxButtonClicked)
            self.toolbarButton[buttonID] = command

        toolbar.Realize()
        mainSizer.Add(toolbar, 0)
        mainSizer.Add(self.tree, 1, wx.EXPAND, 0)
        self.SetSizer(mainSizer)

        imageList = wx.ImageList(16, 16)
        images = {LCONTEXT: ui.images.getFolderImage(), LFILE: ui.images.getPVSLogo(), LTHEORY: ui.images.getTheoryImage(), \
                  GREENFORMULA: ui.images.getGreenFormulaImage(), GRAYFORMULA: ui.images.getGrayFormulaImage(), LINACTIVECONTEXT: ui.images.getGrayFolderImage()}
        index = 0
        self.imageIndices = {LROOT: -1}
        for name, im in images.iteritems():
            imageList.Add(im)
            self.imageIndices[name] = index
            index = index + 1
        self.tree.AssignImageList(imageList)

        self.tree.Bind(wx.EVT_TREE_ITEM_MENU, self.showContextMenu)
        self.clearAll()
        pub.subscribe(self.addFile, PUB_ADDFILE)
        pub.subscribe(self.removeFile, PUB_CLOSEFILE)
        pub.subscribe(self.onFileSaved, PUB_FILESAVED)
        pub.subscribe(self.onFileIsTypechecked, PUB_FILETYPECHECKED)
        pub.subscribe(self.clearFileNodeChildren, PUB_FILEPARSING)
        pub.subscribe(self.pvsContextUpdated, PUB_UPDATEPVSCONTEXT)
        pub.subscribe(self.onFormulaUpdated, PUB_FORMULAUPDATE)
        self.tree.SetDropTarget(PVSFileDropTarget())
Example #3
0
    def __init__(self, parent, definition):
        PluginPanel.__init__(self, parent, definition)
        commandManager = pvscomm.PVSCommandManager()

        toolbarInfo = [
            ["module.png", "Parse the active file", commandManager.parse],
            ["typecheck16.png", "Typecheck the active file", commandManager.typecheck],
        ]

        toolbar = wx.ToolBar(self, wx.ID_ANY, style=wx.TB_VERTICAL | wx.NO_BORDER)
        self.toolbarButton = {}
        for imageName, tooltipText, command in toolbarInfo:
            buttonID = wx.NewId()
            toolbar.AddTool(buttonID, ui.images.getBitmap(imageName))
            wx.EVT_TOOL(self, buttonID, self.onToolboxButtonClicked)
            self.toolbarButton[buttonID] = command
        toolbar.Realize()

        splitter = wx.SplitterWindow(self, style=wx.SP_NOBORDER)
        splitter.SetMinimumPaneSize(35)
        self.pvsout = wx.richtext.RichTextCtrl(
            splitter, wx.ID_ANY, EMPTY_STRING, style=wx.TE_MULTILINE | wx.TE_READONLY
        )

        belowPanel = wx.Panel(splitter)
        self.pvsin = wx.TextCtrl(belowPanel, wx.ID_ANY, EMPTY_STRING, style=wx.TE_MULTILINE)
        self.historyBox = wx.ComboBox(belowPanel, wx.ID_ANY, choices=[], style=wx.CB_READONLY)

        belowSizer = wx.BoxSizer(wx.HORIZONTAL)
        belowSizer.Add(self.pvsin, 5, wx.EXPAND | wx.UP | wx.DOWN | wx.ALIGN_CENTRE_VERTICAL, 5)
        belowSizer.Add(self.historyBox, 1, wx.EXPAND | wx.LEFT | wx.UP | wx.DOWN | wx.ALIGN_CENTRE_VERTICAL, 5)
        belowPanel.SetSizer(belowSizer)
        splitter.SplitHorizontally(self.pvsout, belowPanel)
        splitter.SetSashPosition(120)

        consoleSizer = wx.BoxSizer(wx.HORIZONTAL)
        consoleSizer.Add(splitter, 1, wx.EXPAND | wx.ALL, 5)
        consoleSizer.Add(toolbar, 0, wx.EXPAND | wx.ALL, 5)

        self.SetSizer(consoleSizer)

        self.Bind(wx.EVT_TEXT, self.onPVSInText, self.pvsin)
        self.historyBox.Bind(wx.EVT_COMBOBOX, self.OnSelectHistory)
        pub.subscribe(self.clearIn, PUB_CONSOLECLEARIN)
        pub.subscribe(self.initializeConsole, PUB_CONSOLEINITIALIZE)
        pub.subscribe(self.writeLine, PUB_CONSOLEWRITELINE)
        pub.subscribe(self.writePrompt, PUB_CONSOLEWRITEPROMPT)
        pub.subscribe(self.pvsModeUpdated, PUB_UPDATEPVSMODE)
        self.initializeConsole()
Example #4
0
File: ft.py Project: Lanozavr/pvs
    def __init__(self, parent, definition):
        PluginPanel.__init__(self, parent, definition)
        self.tree = wx.TreeCtrl(self, wx.ID_ANY, style=wx.TR_HIDE_ROOT | wx.TR_HAS_BUTTONS | wx.TR_LINES_AT_ROOT | wx.TR_DEFAULT_STYLE | wx.SUNKEN_BORDER)
        self.history = []

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        toolbar = wx.ToolBar(self, wx.ID_ANY, style = wx.TB_HORIZONTAL | wx.NO_BORDER)
        
        toolbarInfo = [ \
                       ["new.gif", "Create a new PVS file", evhdlr.onCreateNewFile], \
                       ["open.gif", "Open an existing PVS file", evhdlr.onOpenFile], \
                       ["save.gif", "Save file", evhdlr.onSaveFile], \
                       ["saveall.gif", "Save all files", evhdlr.onSaveAllFiles], \
                       ["context.png", "Change PVS context", evhdlr.onChangeContext], \
        ]
        self.toolbarButton = {}
        for imageName, tooltipText, command in toolbarInfo:
            buttonID = wx.NewId()
            toolbar.AddTool(buttonID, ui.images.getBitmap(imageName))
            wx.EVT_TOOL(self, buttonID, self.onToolboxButtonClicked)
            self.toolbarButton[buttonID] = command
            
        toolbar.Realize()
        mainSizer.Add(toolbar, 0)
        mainSizer.Add(self.tree, 1, wx.EXPAND, 0)
        self.SetSizer(mainSizer)
        
        imageList = wx.ImageList(16, 16)
        images = {LCONTEXT: ui.images.getFolderImage(), LFILE: ui.images.getPVSLogo(), LTHEORY: ui.images.getTheoryImage(), \
                  GREENFORMULA: ui.images.getGreenFormulaImage(), GRAYFORMULA: ui.images.getGrayFormulaImage(), LINACTIVECONTEXT: ui.images.getGrayFolderImage()}
        index = 0
        self.imageIndices = {LROOT: -1}
        for name, im in images.iteritems():
            imageList.Add(im)
            self.imageIndices[name] = index
            index = index + 1
        self.tree.AssignImageList(imageList)
        
        self.tree.Bind(wx.EVT_TREE_ITEM_MENU, self.showContextMenu)
        self.clearAll()
        pub.subscribe(self.addFile, PUB_ADDFILE)
        pub.subscribe(self.removeFile, PUB_CLOSEFILE)
        pub.subscribe(self.onFileSaved, PUB_FILESAVED)
        pub.subscribe(self.onFileIsTypechecked, PUB_FILETYPECHECKED)
        pub.subscribe(self.clearFileNodeChildren, PUB_FILEPARSING)
        pub.subscribe(self.pvsContextUpdated, PUB_UPDATEPVSCONTEXT)
        pub.subscribe(self.onFormulaUpdated, PUB_FORMULAUPDATE)
        self.tree.SetDropTarget(PVSFileDropTarget())
Example #5
0
    def __init__(self, parent, definition):
        PluginPanel.__init__(self, parent, definition)
        commandManager = pvscomm.PVSCommandManager()

        toolbarInfo = [ \
                          ["module.png", "Parse the active file", commandManager.parse], \
                          ["typecheck16.png", "Typecheck the active file", commandManager.typecheck], \
        ]

        toolbar = wx.ToolBar(self,
                             wx.ID_ANY,
                             style=wx.TB_VERTICAL | wx.NO_BORDER)
        self.toolbarButton = {}
        for imageName, tooltipText, command in toolbarInfo:
            buttonID = wx.NewId()
            toolbar.AddTool(buttonID, ui.images.getBitmap(imageName))
            wx.EVT_TOOL(self, buttonID, self.onToolboxButtonClicked)
            self.toolbarButton[buttonID] = command
        toolbar.Realize()

        splitter = wx.SplitterWindow(self, style=wx.SP_NOBORDER)
        splitter.SetMinimumPaneSize(35)
        self.pvsout = wx.richtext.RichTextCtrl(splitter,
                                               wx.ID_ANY,
                                               EMPTY_STRING,
                                               style=wx.TE_MULTILINE
                                               | wx.TE_READONLY)

        belowPanel = wx.Panel(splitter)
        self.pvsin = wx.TextCtrl(belowPanel,
                                 wx.ID_ANY,
                                 EMPTY_STRING,
                                 style=wx.TE_MULTILINE)
        self.historyBox = wx.ComboBox(belowPanel,
                                      wx.ID_ANY,
                                      choices=[],
                                      style=wx.CB_READONLY)

        belowSizer = wx.BoxSizer(wx.HORIZONTAL)
        belowSizer.Add(self.pvsin, 5,
                       wx.EXPAND | wx.UP | wx.DOWN | wx.ALIGN_CENTRE_VERTICAL,
                       5)
        belowSizer.Add(
            self.historyBox, 1,
            wx.EXPAND | wx.LEFT | wx.UP | wx.DOWN | wx.ALIGN_CENTRE_VERTICAL,
            5)
        belowPanel.SetSizer(belowSizer)
        splitter.SplitHorizontally(self.pvsout, belowPanel)
        splitter.SetSashPosition(120)

        consoleSizer = wx.BoxSizer(wx.HORIZONTAL)
        consoleSizer.Add(splitter, 1, wx.EXPAND | wx.ALL, 5)
        consoleSizer.Add(toolbar, 0, wx.EXPAND | wx.ALL, 5)

        self.SetSizer(consoleSizer)

        self.Bind(wx.EVT_TEXT, self.onPVSInText, self.pvsin)
        self.historyBox.Bind(wx.EVT_COMBOBOX, self.OnSelectHistory)
        pub.subscribe(self.clearIn, PUB_CONSOLECLEARIN)
        pub.subscribe(self.initializeConsole, PUB_CONSOLEINITIALIZE)
        pub.subscribe(self.writeLine, PUB_CONSOLEWRITELINE)
        pub.subscribe(self.writePrompt, PUB_CONSOLEWRITEPROMPT)
        pub.subscribe(self.pvsModeUpdated, PUB_UPDATEPVSMODE)
        self.initializeConsole()