Example #1
0
    def __init__(self, parent):

        wx.Panel.__init__(self, parent)
        self.SetBackgroundColour("3399FF")

        self.button = wx.Button(self,
                                label="Compilar",
                                pos=(35, 110),
                                size=(80, 50))
        self.Bind(wx.EVT_BUTTON, self.Compilar, self.button)

        self.button_2 = wx.Button(self,
                                  wx.ID_OK,
                                  label="Enviar",
                                  pos=(35, 170),
                                  size=(80, 50))
        self.Bind(wx.EVT_BUTTON, self.Enviar, self.button_2)

        self.grid_panel = wx.Panel(self, pos=(200, 20), size=(620, 300))

        self.shell = PyShell(self.grid_panel)
        self.shell.write("prueba")
        dimensionador = wx.BoxSizer(wx.VERTICAL)
        dimensionador.Add(self.shell, 1, wx.EXPAND | wx.ALL, border=10)
        self.grid_panel.SetSizer(dimensionador)
Example #2
0
    def __init__(self, parent, giface, id=wx.ID_ANY, simpleEditorHandler=None, **kwargs):
        self.parent = parent
        self.giface = giface

        wx.Panel.__init__(self, parent=parent, id=id, **kwargs)

        self.intro = _("Welcome to wxGUI Interactive Python Shell %s") % VERSION + "\n\n" + \
            _("Type %s for more GRASS scripting related information.") % "\"help(gs)\"" + "\n" + \
            _("Type %s to add raster or vector to the layer tree.") % "\"AddLayer()\"" + "\n\n"
        self.shell = PyShell(parent=self, id=wx.ID_ANY,
                             introText=self.intro,
                             locals={'gs': grass,
                                     'AddLayer': self.AddLayer})

        sys.displayhook = self._displayhook

        self.btnClear = Button(self, wx.ID_CLEAR)
        self.btnClear.Bind(wx.EVT_BUTTON, self.OnClear)
        self.btnClear.SetToolTip(_("Delete all text from the shell"))

        self.simpleEditorHandler = simpleEditorHandler
        if simpleEditorHandler:
            self.btnSimpleEditor = Button(
                self, id=wx.ID_ANY, label=_("Simple &editor"))
            self.btnSimpleEditor.Bind(wx.EVT_BUTTON, simpleEditorHandler)
            self.btnSimpleEditor.SetToolTip(
                _("Open a simple Python code editor"))

        self._layout()
Example #3
0
    def __init__(self,
                 parent,
                 giface,
                 id=wx.ID_ANY,
                 simpleEditorHandler=None,
                 **kwargs):
        self.parent = parent
        self.giface = giface

        wx.Panel.__init__(self, parent=parent, id=id, **kwargs)

        self.intro = (
            _("Welcome to wxGUI Interactive Python Shell %s") % VERSION +
            "\n\n" +
            _("Type %s for more GRASS scripting related information.") %
            '"help(gs)"' + "\n" +
            _("Type %s to add raster or vector to the layer tree.") %
            "\"AddLayer('map_name')\"" + "\n\n")

        shellargs = dict(
            parent=self,
            id=wx.ID_ANY,
            introText=self.intro,
            locals={
                "gs": grass,
                "AddLayer": self.AddLayer,
                "help": self.Help
            },
        )
        # useStockId (available since wxPython 4.0.2) should be False on macOS
        if sys.platform == "darwin" and CheckWxVersion([4, 0, 2]):
            shellargs["useStockId"] = False
        self.shell = PyShell(**shellargs)
        if IsDark():
            SetDarkMode(self.shell)

        sys.displayhook = self._displayhook

        self.btnClear = ClearButton(self)
        self.btnClear.Bind(wx.EVT_BUTTON, self.OnClear)
        self.btnClear.SetToolTip(_("Delete all text from the shell"))

        self.simpleEditorHandler = simpleEditorHandler
        if simpleEditorHandler:
            self.btnSimpleEditor = Button(self,
                                          id=wx.ID_ANY,
                                          label=_("Simple &editor"))
            self.btnSimpleEditor.Bind(wx.EVT_BUTTON, simpleEditorHandler)
            self.btnSimpleEditor.SetToolTip(
                _("Open a simple Python code editor"))

        self._layout()