File: runTerminalDialog.py

package info (click to toggle)
spe 0.8.4.h-3.2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 6,992 kB
  • ctags: 10,060
  • sloc: python: 61,437; makefile: 72; sh: 3
file content (75 lines) | stat: -rw-r--r-- 2,904 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# -*- coding: ISO-8859-1 -*-
# generated by wxGlade 0.4 on Sat Jan 21 01:25:28 2006

import wx

def _(x): return x

class RunTerminalDialog(wx.Dialog):
    def __init__(self, fileName, runPreviousArguments, runPreviousInspect, runPreviousExit, *args, **kwds):
        #todo: replace choices = [] with choices = runPreviousArguments
        # begin wxGlade: RunTerminalDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.fileName = wx.StaticText(self, -1, _("File"))
        self.argumentsLabel = wx.StaticText(self, -1, _("Arguments"))
        self.arguments = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN)
        self.inspect = wx.CheckBox(self, -1, _("Inspect interactively after running script"))
        self.exit = wx.CheckBox(self, -1, _("Exit terminal after running script"))
        self.label = wx.StaticText(self, -1, _("Use Edit>Execute to run code snippets in shell"))
        self.cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
        self.ok = wx.Button(self, wx.ID_OK, _("Run"))

        self.__set_properties()
        self.__do_layout()
        # end wxGlade
        self.fileName.SetLabel("File name: "+fileName)
        self.inspect.SetValue(runPreviousInspect)
        self.exit.SetValue(runPreviousExit)

    def __set_properties(self):
        #todo: comment out self.arguments.SetSelection(-1)
        # begin wxGlade: RunTerminalDialog.__set_properties
        self.SetTitle(_("Stani's Python Editor - Run"))
        self.label.Enable(False)
        self.ok.SetDefault()
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: RunTerminalDialog.__do_layout
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_1.Add(self.fileName, 1, wx.ALL, 4)
        sizer_2.Add(self.argumentsLabel, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
        sizer_2.Add(self.arguments, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
        sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
        sizer_1.Add(self.inspect, 0, wx.ALL, 4)
        sizer_1.Add(self.exit, 1, wx.ALL, 4)
        sizer_3.Add(self.label, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
        sizer_3.Add(self.cancel, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
        sizer_3.Add(self.ok, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
        sizer_1.Add(sizer_3, 1, wx.EXPAND, 0)
        self.SetSizer(sizer_1)
        sizer_1.Fit(self)
        self.Layout()
        # end wxGlade

# end of class RunTerminalDialog


class MyApp(wx.App):
    def OnInit(self):
        dialog = RunTerminalDialog(None, -1, "")
        self.SetTopWindow(dialog)
        dialog.Show()
        return 1

# end of class MyApp

if __name__ == "__main__":
    import gettext
    gettext.install("app") # replace with the appropriate catalog name

    app = MyApp(0)
    app.MainLoop()