예제 #1
0
    def __init__(self, *args, **kwds):

        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)

        self.ack = ExpandoTextCtrl(self,
                                   style=wx.TE_LEFT | wx.TE_MULTILINE
                                   | wx.TE_BESTWRAP | wx.TE_READONLY
                                   | wx.TE_NO_VSCROLL)
        self.ack.SetValue(config._acknowledgement_publications)
        #self.ack.SetMinSize((-1, 55))
        self.citation = ExpandoTextCtrl(self,
                                        style=wx.TE_LEFT | wx.TE_MULTILINE
                                        | wx.TE_BESTWRAP | wx.TE_READONLY
                                        | wx.TE_NO_VSCROLL)
        self.citation.SetValue(config._acknowledgement_citation)
        self.preamble = wx.StaticText(self, -1,
                                      config._acknowledgement_preamble)
        items = [
            config._acknowledgement_preamble_bullet1,
            config._acknowledgement_preamble_bullet2,
            config._acknowledgement_preamble_bullet3,
            config._acknowledgement_preamble_bullet4
        ]
        self.list1 = wx.StaticText(self, -1, "(1) " + items[0])
        self.list2 = wx.StaticText(self, -1, "(2) " + items[1])
        self.list3 = wx.StaticText(self, -1, "(3) " + items[2])
        self.list4 = wx.StaticText(self, -1, "(4) " + items[3])
        self.static_line = wx.StaticLine(self, 0)
        self.__set_properties()
        self.__do_layout()
예제 #2
0
    def __init__(self, parent, log):

        wx.Panel.__init__(self, parent)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        sizer = wx.FlexGridSizer(3, 2, 10, 10)

        btn1 = wx.Button(self, -1, "Example 1")
        text1 = ExpandoTextCtrl(self,
                                -1,
                                _sampleText1,
                                size=(300, -1),
                                style=wx.TE_READONLY)

        btn2 = wx.Button(self, -1, "Example 2")
        text2 = ExpandoTextCtrl(self,
                                -1,
                                _sampleText2,
                                size=(300, -1),
                                style=wx.TE_READONLY)

        sizer.Add(btn1, 0, wx.ALIGN_CENTER)
        sizer.Add(text1, 1, wx.EXPAND)

        sizer.Add(btn2, 0, wx.ALIGN_CENTER)
        sizer.Add(text2, 1, wx.EXPAND)

        sizer.AddGrowableCol(1)
        mainSizer.Add(sizer, 1, wx.EXPAND | wx.ALL, 20)
        self.SetSizer(mainSizer)
        mainSizer.Layout()

        btn1.Bind(wx.EVT_BUTTON, self.OnExample1)
        btn2.Bind(wx.EVT_BUTTON, self.OnExample2)
예제 #3
0
    def makeSettings(self, settingsSizer):
        settingsSizerHelper = guiHelper.BoxSizerHelper(self,
                                                       sizer=settingsSizer)
        # Translators: A label for the engines on the engine panel.
        engineLabel = self.title + _("&Engines")
        engineBox = wx.StaticBox(self, label=engineLabel)
        engineGroup = guiHelper.BoxSizerHelper(self,
                                               sizer=wx.StaticBoxSizer(
                                                   engineBox, wx.HORIZONTAL))
        settingsSizerHelper.addItem(engineGroup)

        # Use a ExpandoTextCtrl because even when readonly it accepts focus from keyboard, which
        # standard readonly TextCtrl does not. ExpandoTextCtrl is a TE_MULTILINE control, however
        # by default it renders as a single line. Standard TextCtrl with TE_MULTILINE has two lines,
        # and a vertical scroll bar. This is not necessary for the single line of text we wish to
        # display here.
        engineDesc = self.handler.getCurrentEngine().description
        self.descEngineNameCtrl = ExpandoTextCtrl(self,
                                                  size=(self.scaleSize(250),
                                                        -1),
                                                  value=engineDesc,
                                                  style=wx.TE_READONLY)
        self.descEngineNameCtrl.Bind(wx.EVT_CHAR_HOOK,
                                     self._enterTriggersOnChangeEngine)

        # Translators: This is the label for the button used to change engines,
        # it appears in the context of a engine group on the Online OCR settings panel.
        changeEngineBtn = wx.Button(self, label=_("C&hange..."))
        engineGroup.addItem(
            guiHelper.associateElements(self.descEngineNameCtrl,
                                        changeEngineBtn))
        changeEngineBtn.Bind(wx.EVT_BUTTON, self.onChangeEngine)
        self.engineSettingPanel = SpecificEnginePanel(self, self.handler)
        settingsSizerHelper.addItem(self.engineSettingPanel)
        self.makeGeneralSettings(settingsSizerHelper)
예제 #4
0
 def GetMyControls(self):
     vbs = wx.StaticBoxSizer(wx.StaticBox(self, -1, 'Selection Summary:'),
                             wx.VERTICAL)
     self.summary = ExpandoTextCtrl(self, -1, '')
     self.summary.SetBackgroundColour(self.GetBackgroundColour())
     vbs.Add(self.summary, 0, wx.EXPAND | wx.ALL, 5)
     self._box = vbs
     return vbs
예제 #5
0
    def createFontPanel(self):
        fcp = wx.Panel(self.book)

        font = wx.Font(prefs.get('font'))

        fgcolour = prefs.get('fgcolour')
        bgcolour = prefs.get('bgcolour')

        # output sample/controls
        fcp.sample = ExpandoTextCtrl(fcp,
                                     style=wx.TE_READONLY | wx.TE_RICH
                                     | wx.TE_MULTILINE,
                                     size=wx.Size(400, -1))
        fcp.font_ctrl = wx.FontPickerCtrl(fcp,
                                          style=wx.FNTP_FONTDESC_AS_LABEL
                                          | wx.FNTP_USEFONT_FOR_LABEL,
                                          font=font)

        fcp.theme_picker = wx.Choice(fcp, choices=Theme.all_theme_names())

        fcp.ansi_checkbox = wx.CheckBox(fcp, -1, 'Use ANSI colors')
        # TODO - get and set these two at display time not create time
        fcp.theme = prefs.get('theme')
        fcp.theme_picker.SetSelection(fcp.theme_picker.FindString(fcp.theme))

        if prefs.get('use_ansi'):
            fcp.ansi_checkbox.SetValue(True)
            fcp.theme_picker.Enable()
        else:
            fcp.ansi_checkbox.SetValue(False)
            fcp.theme_picker.Disable()

        ansi_sizer = wx.BoxSizer(wx.HORIZONTAL)
        ansi_sizer.Add(fcp.ansi_checkbox, 0,
                       wx.ALL | wx.EXPAND | wx.ALIGN_CENTER)
        ansi_sizer.Add(fcp.theme_picker, 0,
                       wx.ALL | wx.EXPAND | wx.ALIGN_CENTER)

        panel_sizer = wx.BoxSizer(wx.VERTICAL)
        panel_sizer.Add(fcp.sample, 0, wx.RIGHT | wx.LEFT | wx.EXPAND | wx.TOP,
                        10)
        panel_sizer.AddSpacer(10)
        panel_sizer.Add(fcp.font_ctrl, 0, wx.EXPAND, 0)
        panel_sizer.AddSpacer(10)
        panel_sizer.Add(ansi_sizer, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 10)

        self.Bind(wx.EVT_FONTPICKER_CHANGED, self.update_sample_text,
                  fcp.font_ctrl)
        self.Bind(wx.EVT_CHOICE, self.update_sample_text, fcp.theme_picker)
        self.Bind(wx.EVT_CHECKBOX, self.update_sample_text, fcp.ansi_checkbox)

        self.Bind(EVT_ETC_LAYOUT_NEEDED, self.resize_everything, fcp.sample)

        fcp.SetSizer(panel_sizer)

        fcp.Layout()

        return fcp
예제 #6
0
파일: dialogs.py 프로젝트: jomason/omnivore
 def create_expando(self, key, label, choices=None):
     sizer = self.GetSizer()
     status = ExpandoTextCtrl(self,
                              style=wx.ALIGN_LEFT | wx.TE_READONLY
                              | wx.NO_BORDER)
     attr = self.GetDefaultAttributes()
     status.SetBackgroundColour(attr.colBg)
     sizer.Add(status, 1, wx.ALL | wx.EXPAND, self.border)
     return status
예제 #7
0
 def GetMyControls(self):
     vbs = wx.BoxSizer(wx.VERTICAL)
     vbs.Add(wx.StaticText(self, -1, 'Storage Dir:'), 0, wx.EXPAND | wx.ALL,
             5)
     self.path = ExpandoTextCtrl(self, -1, '', style=wx.TE_READONLY)
     self.path.SetBackgroundColour(self.GetBackgroundColour())
     vbs.Add(self.path, 0, wx.EXPAND | wx.ALL, 5)
     btn = wx.Button(self, -1, 'Browse')
     wx.EVT_BUTTON(self, btn.GetId(), self.OnBrowse)
     vbs.Add(btn, 0, wx.ALL, 5)
     return vbs
예제 #8
0
    def _OnPopupItemSelected(self, event):
        ID = event.Int

        if ID == 0:
            self._Draw_Cursor(0, -1)
            self._Draw_Cursor(1, -1)

        elif ID == 1:
            if not (self.Memo_Extra):
                self.Memo_Extra = ExpandoTextCtrl(self,
                                                  size=(100, -1),
                                                  pos=self.Hit_Pos,
                                                  value=self.Memo_Extra_Text)
            else:
                #print 'YTRFGJKOP',self.Hit_Pos,event.GetId(),self.Memo_Extra.GetId()
                self.Memo_Extra_Text = self.Memo_Extra.GetValue()
                self.Memo_Extra.Destroy()
                self.Memo_Extra = None

        elif ID == 2:
            if not (self.Memo_Extra):
                self.Memo_Extra = ExpandoTextCtrl(self,
                                                  size=(100, -1),
                                                  pos=self.Hit_Pos,
                                                  value=self.Memo_Extra_Text)
            else:
                self.Memo_Extra.SetPosition(self.Hit_Pos)

        elif ID == 3:
            import SendKeys
            SendKeys.SendKeys('%{PRTSC}')

        elif ID == 4:
            self.Linear_Interpolation = not (self.Linear_Interpolation)
            self.Set_Data(self.Data)  # _Redraw_Data ()
            #self._Redraw()

        elif ID in range(5, 10):
            self.Transparancy = ID - 5
            val = 5 + 50 * (5 - self.Transparancy)
            self.TopFrame.SetTransparent(val)
예제 #9
0
    def GetMyControls(self):
        vbs = wx.BoxSizer(wx.VERTICAL)
        vbs.Add(wx.StaticText(self, -1, 'Source of data:'), 0,
                wx.ALL | wx.EXPAND, 5)
        self._source_lbl = ExpandoTextCtrl(self, -1, '', style=wx.TE_READONLY)
        self._source_lbl.SetBackgroundColour(self.GetBackgroundColour())
        vbs.Add(self._source_lbl, 0, wx.ALL | wx.EXPAND, 5)

        _btn = wx.Button(self, -1, 'Browse')
        wx.EVT_BUTTON(self, _btn.GetId(), self._OnBrowse)
        vbs.Add(_btn, 0, wx.ALL, 5)
        return vbs
예제 #10
0
    def __init__(self, parent=None, *args, **kw):
        wx.Panel.__init__(self, parent, id=-1)
        self.parent = parent

        vBox = wx.BoxSizer(wx.VERTICAL)
        bookNameLabel = wx.StaticText(self, -1, "Title:")
        bookName = wx.TextCtrl(self, -1, "", size=(150, -1))

        booShortkNameLabel = wx.StaticText(self, -1, "Short Title:")
        bookShortName = ExpandoTextCtrl(self, -1, "", size=(150, -1))

        authorsLabel = wx.StaticText(self, -1, "Authors:")
        authorName = wx.TextCtrl(self, -1, "", size=(50, -1))

        numberOfPagesLabel = wx.StaticText(self, -1, "Number of pages:")
        numberOfPages = wx.TextCtrl(self, -1, "", size=(70, -1))

        hBox1 = wx.BoxSizer(wx.HORIZONTAL)
        hBox1.Add(bookNameLabel, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        hBox1.Add(bookName, 0, wx.EXPAND | wx.ALL)

        hBox2 = wx.BoxSizer(wx.HORIZONTAL)
        hBox2.Add(authorsLabel, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        hBox2.Add(authorName, 0, wx.EXPAND | wx.ALL)

        hBox3 = wx.BoxSizer(wx.HORIZONTAL)
        hBox3.Add(booShortkNameLabel, 0,
                  wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        hBox3.Add(bookShortName, 0, wx.EXPAND | wx.ALL)

        hBox4 = wx.BoxSizer(wx.HORIZONTAL)
        hBox4.Add(numberOfPagesLabel, 0,
                  wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        hBox4.Add(numberOfPages, 0, wx.EXPAND | wx.ALL)

        vBox.Add(hBox1, 1, wx.EXPAND | wx.ALL, 1)
        vBox.Add(hBox2, 1, wx.EXPAND | wx.ALL, 1)
        vBox.Add(hBox3, 1, wx.EXPAND | wx.ALL, 1)
        vBox.Add(hBox4, 1, wx.EXPAND | wx.ALL, 1)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(vBox)
        self.SetSizer(sizer)
예제 #11
0
    def __init__(self, cls, panel, bg_colour, show_id):
        self._Label = ""
        window = panel.GetWindow()
        sizer = panel.GetSizer()

        line = self._StaticLine = wx.StaticLine(window)
        sizer.Add(line, flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, border = G_Const.Sizer_StdBorder)

        checkbox = self._ShowColumnCheckBox = wx.CheckBox(window, id = show_id)
        combo = self._ColumnColourCombo = G_ColourCombo(window, show_id)
        self._RowSizer = cls.BuildRow(panel, checkbox, combo, "enabled-colour-row-{}".format(show_id))

        description = self._DescriptionCtrl = ExpandoTextCtrl(window, style = wx.TE_MULTILINE
            | wx.TE_NO_VSCROLL
            | wx.TE_READONLY
            | wx.TE_RICH2
            | wx.BORDER_NONE)
    
        description.SetBackgroundColour(bg_colour)
        sizer.Add(description, flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, border = G_Const.Sizer_StdBorder, userData = "enabled-colour-description-{}".format(show_id))
예제 #12
0
	def __init__(self, parent, id, title):
		wx.Frame.__init__(self,parent,id,title,size=(800,800), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)

		self.number_of_buttons = 2

		self.vbox = wx.BoxSizer(wx.VERTICAL)
		self.display = wx.TextCtrl(self, style=wx.TE_LEFT)
		# self.display.SetValue("http://yasirzaki.net")
		self.display.SetValue("http://www.irs.gov")
		self.vbox.Add(self.display, flag=wx.EXPAND|wx.TOP|wx.BOTTOM, border=4)

		my_btn = wx.Button(self, label='Analyze page')
		my_btn.Bind(wx.EVT_BUTTON, self.on_press)
		self.vbox.Add(my_btn, 0, wx.ALL | wx.CENTER, 5)

		self.textBox = ExpandoTextCtrl (self)
		self.vbox.Add(self.textBox, 0, wx.EXPAND, 5)
		self.Bind(EVT_ETC_LAYOUT_NEEDED, self.OnRefit, self.textBox)
		self.number_of_buttons += 1

		self.SetSizer(self.vbox)
		self.url = ""
예제 #13
0
    def __init__(self, parent):
        super(RuleEditor, self).__init__(
            parent,
            style=wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER,
        )
        self.hasMoved = False

        # Dialog main sizer
        mainSizer = wx.BoxSizer(wx.VERTICAL)

        # Form part
        columnsSizer = wx.GridBagSizer(8, 8)
        mainSizer.Add(columnsSizer,
                      proportion=1,
                      flag=wx.EXPAND | wx.ALL,
                      border=8)
        leftSizer = wx.FlexGridSizer(cols=1, vgap=8, hgap=8)
        rightSizer = wx.GridBagSizer(8, 8)
        columnsSizer.Add(leftSizer, pos=(0, 0), flag=wx.EXPAND)
        columnsSizer.Add(wx.StaticLine(self, style=wx.LI_VERTICAL),
                         pos=(0, 1),
                         flag=wx.EXPAND)
        columnsSizer.Add(rightSizer, pos=(0, 2), flag=wx.EXPAND)
        columnsSizer.AddGrowableCol(0)
        columnsSizer.AddGrowableCol(2)
        columnsSizer.AddGrowableRow(0)

        # Header section
        headerSizer = wx.FlexGridSizer(cols=2, vgap=8, hgap=8)
        leftSizer.Add(headerSizer, flag=wx.EXPAND)

        item = wx.StaticText(self, label=_(u"Rule &type:"))
        headerSizer.Add(item)
        item = self.ruleTypeCombo = wx.ComboBox(self, style=wx.CB_READONLY)
        item.Bind(wx.EVT_COMBOBOX, self.onRuleTypeChoice)
        for key, label in ruleTypes.ruleTypeLabels.items():
            self.ruleTypeCombo.Append(label, key)
        headerSizer.Add(item, flag=wx.EXPAND)

        item = wx.StaticText(self, label=_(u"Rule &name:"))
        headerSizer.Add(item)
        item = self.ruleNameText = wx.ComboBox(self)
        headerSizer.Add(item, flag=wx.EXPAND)

        headerSizer.AddGrowableCol(1)

        # Context Box
        contextBox = self.contextBox = wx.StaticBox(self, label=_("Context"))
        contextSizer = self.contextSizer = wx.GridBagSizer(8, 8)
        item = wx.StaticBoxSizer(contextBox, orient=wx.VERTICAL)
        item.Add(contextSizer, flag=wx.EXPAND | wx.ALL, border=4)
        leftSizer.Add(item, flag=wx.EXPAND)

        item = self.contextText = ExpandoTextCtrl(
            contextBox,
            size=(250, -1),
            style=wx.TE_PROCESS_ENTER | wx.TE_MULTILINE | wx.TE_READONLY,
        )
        item.Bind(wx.EVT_TEXT_ENTER, self.onOk)
        contextSizer.Add(item, pos=(0, 0), span=(2, 1), flag=wx.EXPAND)
        item = wx.Button(contextBox, label=_("Edit conte&xt"))
        item.Bind(wx.EVT_BUTTON, self.onContextBtn)
        contextSizer.Add(item, pos=(0, 1))
        contextSizer.AddGrowableCol(0)
        contextSizer.AddGrowableRow(1)

        # Criteria Box
        criteriaBox = wx.StaticBox(self, label=_("Criteria"))
        criteriaSizer = wx.GridBagSizer(8, 8)
        item = wx.StaticBoxSizer(criteriaBox, orient=wx.VERTICAL)
        item.Add(criteriaSizer, flag=wx.EXPAND | wx.ALL, border=4)
        leftSizer.Add(item, flag=wx.EXPAND)
        item = self.criteriaText = ExpandoTextCtrl(
            criteriaBox,
            size=(250, -1),
            style=wx.TE_PROCESS_ENTER | wx.TE_MULTILINE | wx.TE_READONLY,
        )
        item.Bind(wx.EVT_TEXT_ENTER, self.onOk)
        criteriaSizer.Add(item, pos=(0, 0), span=(2, 1), flag=wx.EXPAND)
        item = wx.Button(criteriaBox, label=_("Edit c&riteria"))
        item.Bind(wx.EVT_BUTTON, self.onCriteriaBtn)
        criteriaSizer.Add(item, pos=(0, 1))
        criteriaSizer.AddGrowableCol(0)
        criteriaSizer.AddGrowableRow(1)

        # Actions Box
        actionsBox = self.actionsBox = wx.StaticBox(self,
                                                    label=_("Actions"),
                                                    style=wx.SB_RAISED)
        actionsBox.Hide()  # Visibility depends on rule type
        actionsSizer = wx.GridBagSizer(8, 8)
        item = wx.StaticBoxSizer(actionsBox, orient=wx.VERTICAL)
        item.Add(actionsSizer, flag=wx.EXPAND | wx.ALL, border=4)
        leftSizer.Add(item, flag=wx.EXPAND)

        item = wx.StaticText(actionsBox, label=_("&Keyboard shortcut"))
        actionsSizer.Add(item, pos=(0, 0))
        item = self.gesturesList = wx.ListBox(actionsBox)
        item.Bind(wx.EVT_LISTBOX, self.onGesturesListChoice)
        actionsSizer.Add(item, pos=(0, 1), span=(3, 1), flag=wx.EXPAND)

        item = wx.Button(actionsBox, label=_("Add a keyboard shortcut"))
        item.Bind(wx.EVT_BUTTON, self.onAddGesture)
        actionsSizer.Add(item, pos=(0, 2), flag=wx.EXPAND)

        item = self.deleteGestureButton = wx.Button(
            actionsBox, label=_("Delete this shortcut"))
        item.Bind(wx.EVT_BUTTON, self.onDeleteGesture)
        actionsSizer.Add(item, pos=(1, 2), flag=wx.EXPAND)

        item = wx.StaticText(actionsBox,
                             label=_("&Automatic action at rule detection"))
        actionsSizer.Add(item, pos=(3, 0))
        item = self.autoActionList = wx.ComboBox(actionsBox,
                                                 style=wx.CB_READONLY)
        actionsSizer.Add(item, pos=(3, 1), flag=wx.EXPAND)

        actionsSizer.AddGrowableCol(1)
        actionsSizer.AddGrowableCol(2)
        actionsSizer.AddGrowableRow(2)

        # Properties Box
        propertiesBox = self.propertiesBox = wx.StaticBox(
            self, label=_("Properties"))
        propertiesBox.Hide()  # Visibility depends on rule type
        propertiesSizer = wx.GridBagSizer(8, 8)
        item = wx.StaticBoxSizer(propertiesBox, orient=wx.VERTICAL)
        item.Add(propertiesSizer, flag=wx.EXPAND | wx.ALL, border=4)
        leftSizer.Add(item, flag=wx.EXPAND)
        item = self.propertiesText = ExpandoTextCtrl(
            propertiesBox,
            size=(250, -1),
            style=wx.TE_PROCESS_ENTER | wx.TE_MULTILINE | wx.TE_READONLY,
        )
        item.Bind(wx.EVT_TEXT_ENTER, self.onOk)
        propertiesSizer.Add(item, pos=(0, 0), span=(2, 1), flag=wx.EXPAND)
        item = wx.Button(propertiesBox, label=_("Edit &properties"))
        item.Bind(wx.EVT_BUTTON, self.onPropertiesBtn)
        propertiesSizer.Add(item, pos=(0, 1))
        propertiesSizer.AddGrowableCol(0)
        propertiesSizer.AddGrowableRow(1)

        leftSizer.AddGrowableCol(0)

        # Comment section
        row = 0
        rightSizer.Add(wx.StaticText(self, label=_("&Comment")), pos=(row, 0))

        row += 1
        item = self.comment = wx.TextCtrl(self,
                                          size=(500, 300),
                                          style=wx.TE_MULTILINE)
        rightSizer.Add(item, pos=(row, 0), flag=wx.EXPAND)

        rightSizer.AddGrowableCol(0)
        rightSizer.AddGrowableRow(1)

        mainSizer.Add(self.CreateSeparatedButtonSizer(wx.OK | wx.CANCEL),
                      flag=wx.EXPAND | wx.BOTTOM,
                      border=8)
        self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL)
        self.Bind(wx.EVT_SIZE, self.onSize)
        self.Bind(wx.EVT_MOVE_END, self.onMoveEnd)
        self.SetSizerAndFit(mainSizer)
예제 #14
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)

        self.number_of_buttons = 0
        self.colors = {
            "": wx.Colour(255, 255, 255, 100),
            "critical": wx.Colour(255, 0, 0, 100),
            "non-critical": wx.Colour(0, 255, 0, 100),
            "translatable": wx.Colour(0, 0, 255, 100)
        }
        self.frame = parent
        self.fileName = ""

        self.mainSizer = wx.BoxSizer(wx.VERTICAL)

        self.url_input = wx.TextCtrl(self, style=wx.TE_LEFT)
        self.url_input.SetValue("http://www.yasirzaki.net")
        self.url_input.Bind(wx.EVT_KEY_DOWN, self.on_key_press)
        self.mainSizer.Add(self.url_input,
                           flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT,
                           border=25)

        # StaticText field for error messages
        self.err_msg = wx.StaticText(self, label="")
        self.err_msg.SetForegroundColour((255, 0, 0))  # make text red
        self.mainSizer.Add(self.err_msg, 0, flag=wx.LEFT, border=25)

        analyze_btn = wx.Button(self, label='Analyze page')
        analyze_btn.Bind(wx.EVT_BUTTON, self.on_analyze_press)
        self.mainSizer.Add(analyze_btn, 0, wx.ALL | wx.CENTER, 25)

        self.scripts_panel = wx.lib.scrolledpanel.ScrolledPanel(self,
                                                                -1,
                                                                size=(750,
                                                                      400))
        self.scripts_panel.SetupScrolling()
        # self.scripts_panel.Hide()
        # self.scripts_panel.SetBackgroundColour('#FFFFFF')
        self.mainSizer.Add(self.scripts_panel, 0, wx.CENTER | wx.BOTTOM, 25)

        self.select_all_btn = wx.ToggleButton(self, label='Select All')
        self.select_all_btn.Bind(wx.EVT_TOGGLEBUTTON, self.on_all_press)
        self.select_all_btn.Hide()
        self.mainSizer.Add(self.select_all_btn, 0, wx.BOTTOM | wx.CENTER, 25)

        self.diff_btn = wx.Button(self, label='Get diff')
        self.diff_btn.Bind(wx.EVT_BUTTON, self.on_diff_press)
        self.diff_btn.Hide()
        self.mainSizer.Add(self.diff_btn, 0, wx.BOTTOM | wx.CENTER, 25)

        vbox = wx.BoxSizer(wx.HORIZONTAL)
        self.features_panel = wx.lib.scrolledpanel.ScrolledPanel(
            self, -1, size=(375, 300), style=wx.SIMPLE_BORDER)
        self.features_panel.SetupScrolling()
        self.features_panel.SetBackgroundColour('#FFFFFF')
        vbox.Add(self.features_panel, 0, wx.CENTER, 5)

        self.content_panel = wx.lib.scrolledpanel.ScrolledPanel(
            self, -1, size=(375, 300), style=wx.SIMPLE_BORDER)
        self.content_panel.SetupScrolling()
        self.content_panel.SetBackgroundColour('#FFFFFF')
        vbox.Add(self.content_panel, 0, wx.CENTER, 5)
        self.mainSizer.Add(vbox, 0, wx.CENTER, 5)

        self.SetSizer(self.mainSizer)
        self.gs = None

        self.features_panel.Hide()
        self.content_panel.Hide()

        self.features_text = ExpandoTextCtrl(self.features_panel,
                                             size=(360, 290),
                                             style=wx.TE_READONLY)
        self.features_text.SetValue("Features listing")
        self.Bind(EVT_ETC_LAYOUT_NEEDED, None, self.features_text)

        self.features_sizer = wx.BoxSizer(wx.VERTICAL)
        self.features_sizer.Add(self.features_text, 0, wx.CENTER, 5)
        self.features_panel.SetSizer(self.features_sizer)

        self.content_text = ExpandoTextCtrl(self.content_panel,
                                            size=(360, 290),
                                            style=wx.TE_READONLY)
        self.content_text.SetValue("Script code")
        self.Bind(EVT_ETC_LAYOUT_NEEDED, None, self.content_text)

        self.content_sizer = wx.BoxSizer(wx.VERTICAL)
        self.content_sizer.Add(self.content_text, 0, wx.CENTER, 5)
        self.content_panel.SetSizer(self.content_sizer)
예제 #15
0
    def __init__(self, parent, log):
        wx.Frame.__init__(self, parent, title="Test ExpandoTextCtrl")
        self.log = log
        self.pnl = p = wx.Panel(self)
        self.eom = ExpandoTextCtrl(
            p, size=(250, -1), value="This control will expand as you type")
        self.Bind(EVT_ETC_LAYOUT_NEEDED, self.OnRefit, self.eom)

        # create some buttons and sizers to use in testing some
        # features and also the layout
        vBtnSizer = wx.BoxSizer(wx.VERTICAL)

        btn = wx.Button(p, -1, "Set MaxHeight")
        self.Bind(wx.EVT_BUTTON, self.OnSetMaxHeight, btn)
        vBtnSizer.Add(btn, 0, wx.ALL | wx.EXPAND, 5)

        btn = wx.Button(p, -1, "Set Font")
        self.Bind(wx.EVT_BUTTON, self.OnSetFont, btn)
        vBtnSizer.Add(btn, 0, wx.ALL | wx.EXPAND, 5)

        btn = wx.Button(p, -1, "Write Text")
        self.Bind(wx.EVT_BUTTON, self.OnWriteText, btn)
        vBtnSizer.Add(btn, 0, wx.ALL | wx.EXPAND, 5)

        btn = wx.Button(p, -1, "Append Text")
        self.Bind(wx.EVT_BUTTON, self.OnAppendText, btn)
        vBtnSizer.Add(btn, 0, wx.ALL | wx.EXPAND, 5)

        btn = wx.Button(p, -1, "Set Value")
        self.Bind(wx.EVT_BUTTON, self.OnSetValue, btn)
        vBtnSizer.Add(btn, 0, wx.ALL | wx.EXPAND, 5)

        btn = wx.Button(p, -1, "Get Value")
        self.Bind(wx.EVT_BUTTON, self.OnGetValue, btn)
        vBtnSizer.Add(btn, 0, wx.ALL | wx.EXPAND, 5)

        for x in range(3):
            btn = wx.Button(p, -1, " ")
            vBtnSizer.Add(btn, 0, wx.ALL | wx.EXPAND, 5)
            self.Bind(wx.EVT_BUTTON, self.OnOtherBtn, btn)

        hBtnSizer = wx.BoxSizer(wx.HORIZONTAL)
        for x in range(3):
            btn = wx.Button(p, -1, " ")
            hBtnSizer.Add(btn, 0, wx.ALL, 5)
            self.Bind(wx.EVT_BUTTON, self.OnOtherBtn, btn)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        col1 = wx.BoxSizer(wx.VERTICAL)
        col1.Add(self.eom, 0, wx.ALL, 10)
        col1.Add(hBtnSizer)
        sizer.Add(col1)
        sizer.Add(vBtnSizer)
        p.SetSizer(sizer)

        # Put the panel in a sizer for the frame so we can use self.Fit()
        frameSizer = wx.BoxSizer()
        frameSizer.Add(p, 1, wx.EXPAND)
        self.SetSizer(frameSizer)

        self.Fit()
예제 #16
0
 def create_control(self):
     c = ExpandoTextCtrl(self.parent,
                         style=wx.ALIGN_LEFT | wx.TE_READONLY
                         | wx.NO_BORDER)
     return c
예제 #17
0
    def __init__(self,
                 parent,
                 ovlId,
                 title,
                 name='text',
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.DEFAULT_DIALOG_STYLE):

        wx.Dialog.__init__(self, parent, wx.ID_ANY, title, pos, size, style)
        from wx.lib.expando import ExpandoTextCtrl, EVT_ETC_LAYOUT_NEEDED

        self.ovlId = ovlId
        self.parent = parent

        if self.ovlId in self.parent.MapWindow.textdict.keys():
            self.currText = self.parent.MapWindow.textdict[self.ovlId]['text']
            self.currFont = self.parent.MapWindow.textdict[self.ovlId]['font']
            self.currClr = self.parent.MapWindow.textdict[self.ovlId]['color']
            self.currRot = self.parent.MapWindow.textdict[
                self.ovlId]['rotation']
            self.currCoords = self.parent.MapWindow.textdict[
                self.ovlId]['coords']
            self.currBB = self.parent.MapWindow.textdict[self.ovlId]['bbox']
        else:
            self.currClr = wx.BLACK
            self.currText = ''
            self.currFont = self.GetFont()
            self.currRot = 0.0
            self.currCoords = [10, 10]
            self.currBB = wx.Rect()

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        box = wx.GridBagSizer(vgap=5, hgap=5)

        # show/hide
        self.chkbox = wx.CheckBox(parent=self,
                                  id=wx.ID_ANY,
                                  label=_('Show text object'))
        if self.parent.Map.GetOverlay(self.ovlId) is None:
            self.chkbox.SetValue(True)
        else:
            self.chkbox.SetValue(
                self.parent.MapWindow.overlays[self.ovlId]['layer'].IsActive())
        box.Add(item=self.chkbox,
                span=(1, 2),
                flag=wx.ALIGN_LEFT | wx.ALL,
                border=5,
                pos=(0, 0))

        # text entry
        label = wx.StaticText(parent=self,
                              id=wx.ID_ANY,
                              label=_("Enter text:"))
        box.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0))

        self.textentry = ExpandoTextCtrl(parent=self,
                                         id=wx.ID_ANY,
                                         value="",
                                         size=(300, -1))
        self.textentry.SetFont(self.currFont)
        self.textentry.SetForegroundColour(self.currClr)
        self.textentry.SetValue(self.currText)
        # get rid of unneeded scrollbar when text box first opened
        self.textentry.SetClientSize((300, -1))

        box.Add(item=self.textentry, pos=(1, 1))

        # rotation
        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Rotation:"))
        box.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(2, 0))
        self.rotation = wx.SpinCtrl(parent=self,
                                    id=wx.ID_ANY,
                                    value="",
                                    pos=(30, 50),
                                    size=(75, -1),
                                    style=wx.SP_ARROW_KEYS)
        self.rotation.SetRange(-360, 360)
        self.rotation.SetValue(int(self.currRot))
        box.Add(item=self.rotation, flag=wx.ALIGN_RIGHT, pos=(2, 1))

        # font
        fontbtn = wx.Button(parent=self, id=wx.ID_ANY, label=_("Set font"))
        box.Add(item=fontbtn, flag=wx.ALIGN_RIGHT, pos=(3, 1))

        self.sizer.Add(item=box, proportion=1, flag=wx.ALL, border=10)

        # note
        box = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(
            parent=self,
            id=wx.ID_ANY,
            label=_("Drag text with mouse in pointer mode "
                    "to position.\nDouble-click to change options"))
        box.Add(item=label,
                proportion=0,
                flag=wx.ALIGN_CENTRE | wx.ALL,
                border=5)
        self.sizer.Add(item=box,
                       proportion=0,
                       flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL
                       | wx.ALIGN_CENTER | wx.ALL,
                       border=5)

        line = wx.StaticLine(parent=self,
                             id=wx.ID_ANY,
                             size=(20, -1),
                             style=wx.LI_HORIZONTAL)
        self.sizer.Add(item=line,
                       proportion=0,
                       flag=wx.EXPAND | wx.ALIGN_CENTRE | wx.ALL,
                       border=5)

        btnsizer = wx.StdDialogButtonSizer()

        btn = wx.Button(parent=self, id=wx.ID_OK)
        btn.SetDefault()
        btnsizer.AddButton(btn)

        btn = wx.Button(parent=self, id=wx.ID_CANCEL)
        btnsizer.AddButton(btn)
        btnsizer.Realize()

        self.sizer.Add(item=btnsizer,
                       proportion=0,
                       flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER,
                       border=5)

        self.SetSizer(self.sizer)
        self.sizer.Fit(self)

        # bindings
        self.Bind(EVT_ETC_LAYOUT_NEEDED, self.OnRefit, self.textentry)
        self.Bind(wx.EVT_BUTTON, self.OnSelectFont, fontbtn)
        self.Bind(wx.EVT_TEXT, self.OnText, self.textentry)
        self.Bind(wx.EVT_SPINCTRL, self.OnRotation, self.rotation)
예제 #18
0
	def makeSettings(self):
		mainSizer = wx.BoxSizer(wx.VERTICAL)
		tasksSizer = wx.BoxSizer(wx.VERTICAL)
		# Translators: A label for the the Not in dictionary field
		NotInDictionLabel = _("&Not in dictionary")
		notDictBox = wx.StaticBox(self, label = NotInDictionLabel)
		self.misspelledCtrl = ExpandoTextCtrl(self, size = (250, -1), value = misspelled, style=wx.TE_READONLY)

		# Translators: A label for the paragraph field
		NotInDiction1Label = _("in the following paragraph:")
		notDict1Box = wx.StaticBox(self, label = NotInDiction1Label)
		self.msParagraphCtrl = ExpandoTextCtrl(self, size = (250, -1), value = msParagraph, style=wx.TE_READONLY)
		# Translators: The label for the list of suggestions.
		sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL)
		entriesLabelText=_("&Suggestions")
		self.dictList = sHelper.addLabeledControl(entriesLabelText, wx.ListBox, id = wx.ID_ANY, choices = candidates, style = wx.LB_SINGLE, size = (700,580))
		#self.editingIndex=-1

		# Create buttons.
		# Buttons are in a horizontal row
		buttonsSizer = wx.BoxSizer(wx.HORIZONTAL)

		addButtonID = wx.Window.NewControlId()
		# Translators: Label of button to add the misspelled word to the personal dictionary.
		self.addButton = wx.Button(self, addButtonID, _('&Add'))
		buttonsSizer.Add (self.addButton)

		ignoreButtonID = wx.Window.NewControlId()
		# Translators: Label of button to ignore the misspelled word once.
		self.ignoreButton = wx.Button (self, ignoreButtonID, _('Ignore &once'))
		buttonsSizer.Add(self.ignoreButton)

		ignoreAllButtonID = wx.Window.NewControlId()
		# Translators: Label of button to ignore all cases of the misspelled word.
		self.ignoreAllButton = wx.Button(self, ignoreAllButtonID, _('&Ignore all'))
		buttonsSizer.Add (self.ignoreAllButton)

		substituteButtonID = wx.Window.NewControlId()
		# Translators: Label of button to replace the misspelled word by the suggestion.
		self.substituteButton = wx.Button(self, substituteButtonID, _('&Substitute'))
		buttonsSizer.Add (self.substituteButton)

		substituteAllButtonID = wx.Window.NewControlId()
		# Translators: Label of button to replace all occurrences of the misspelled word by the suggestion.
		self.substituteAllButton = wx.Button(self, substituteAllButtonID, _('Su&bstitute all'))
		buttonsSizer.Add (self.substituteAllButton)

		editButtonID = wx.Window.NewControlId()
		# Translators: Label of button to allow edition of the text.
		self.editButton = wx.Button (self, editButtonID, _('&Edit'))
		buttonsSizer.Add (self.editButton)

		cancelButtonID = wx.Window.NewControlId()
		# Translators: Button Label that closes the add-on.
		self.cancelButton = wx.Button(self, cancelButtonID, _('&Close'))
		buttonsSizer.Add(self.cancelButton)

		tasksSizer.Add(buttonsSizer)
		mainSizer.Add(tasksSizer)

		# Bind the buttons.
		self.Bind(wx.EVT_BUTTON, self.onAdd, id = addButtonID)
		self.Bind (wx.EVT_BUTTON, self.onIgnoreOnce, id = ignoreButtonID )
		self.Bind(wx.EVT_BUTTON, self.onIgnoreAll, id = ignoreAllButtonID)
		self.Bind(wx.EVT_BUTTON, self.onSubstitute, id = substituteButtonID)
		self.Bind(wx.EVT_BUTTON, self.onSubstituteAll, id = substituteAllButtonID)
		self.Bind(wx.EVT_BUTTON, self.onEdit, id = editButtonID)
		self.cancelButton.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy())
		self.SetEscapeId(wx.ID_CLOSE)
		self.dictList.Bind(wx.EVT_KEY_DOWN, self.onKeyPress)
		self.misspelledCtrl.Bind(wx.EVT_KEY_DOWN, self.onKeyPress)
		self.msParagraphCtrl.Bind(wx.EVT_KEY_DOWN, self.onKeyPress)

		mainSizer.Fit(self)
		self.SetSizer(mainSizer)
		# Show the window if it is hidden
		if not self.IsShown():
			gui.mainFrame.prePopup()
			self.Show()
			gui.mainFrame.postPopup()
예제 #19
0
    def __init__(self, parent, messageData, nickname=u'王小明'):

        #计算合适的宽度
        border_width = 18
        parent_width, parent_height = parent.GetSize()
        max_width = parent_width * 0.5
        min_width = wxtl.GetTextDisplayLen(nickname) + border_width
        '''
        panel = wx.Panel(parent)
        panel_sizer = wx.BoxSizer()
        panel.SetSizer(panel_sizer)
        text = wx.StaticText(panel, wx.ID_ANY, label = messageData)
        panel_sizer.Add(text, 1, wx.EXPAND)
        text_width, text_height =  panel.GetBestSize()
        panel.Destroy()
        '''

        text_width = wxtl.GetTextDisplayLen(messageData)

        if text_width > max_width:
            width = max_width
        elif text_width < min_width:
            width = min_width
        else:
            width = text_width + border_width

        print text_width
        print min_width
        print width

        #开始初始化用于显示消息的panel
        wx.Panel.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          pos=wx.DefaultPosition,
                          size=(width, -1),
                          style=wx.TAB_TRAVERSAL)

        self.SetForegroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
        self.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND))

        message_sizer = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, nickname), wx.VERTICAL)

        self.m_textCtrl7 = ExpandoTextCtrl(self,
                                           wx.ID_ANY,
                                           value=messageData,
                                           style=wx.TE_MULTILINE | wx.NO_BORDER
                                           | wx.TE_READONLY)
        self.m_textCtrl7.SetForegroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
        self.m_textCtrl7.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND))
        #self.m_textCtrl7.Enable(False)

        message_sizer.Add(self.m_textCtrl7, 1, wx.ALL | wx.EXPAND, 7)

        self.SetSizer(message_sizer)
        self.Sizer.Fit(self)

        self.Layout()
예제 #20
0
    def addRow(self, row, rowLabel=None):
        """Add one row of info, either header (col names) or normal data

        Adds items sequentially; FlexGridSizer moves to next row automatically
        """
        labelBox = wx.BoxSizer(wx.HORIZONTAL)
        if not rowLabel:
            if sys.platform == 'darwin':
                self.SetWindowVariant(variant=wx.WINDOW_VARIANT_SMALL)
            label = _translate('cond %s:') % str(row + 1 -
                                                 int(self.hasHeader)).zfill(2)
            rowLabel = wx.StaticText(self, -1, label=label)
            rowLabel.SetForegroundColour(darkgrey)
            if sys.platform == 'darwin':
                self.SetWindowVariant(variant=wx.WINDOW_VARIANT_NORMAL)
        labelBox.Add(rowLabel, 1, flag=wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM)
        self.sizer.Add(labelBox, 1, flag=wx.ALIGN_CENTER)
        lastRow = []
        for col in range(self.cols):
            # get the item, as unicode for display purposes:
            if len(str(self.grid[row][col])):  # want 0, for example
                item = str(self.grid[row][col])
            else:
                item = u''
            # make a textbox:
            field = ExpandoTextCtrl(self,
                                    -1,
                                    item,
                                    size=(self.colSizes[col], 20))
            field.Bind(EVT_ETC_LAYOUT_NEEDED, self.onNeedsResize)
            field.SetMaxHeight(100)  # ~ 5 lines
            if self.hasHeader and row == 0:
                # add a default column name (header) if none provided
                header = self.grid[0]
                if item.strip() == '':
                    c = col
                    while self.colName(c) in header:
                        c += 1
                    field.SetValue(self.colName(c))
                field.SetForegroundColour(darkblue)  # dark blue
                # or (self.parent and
                if not valid_var_re.match(field.GetValue()):
                    # self.parent.exp.namespace.exists(field.GetValue()) ):
                    # was always red when preview .xlsx file -- in
                    # namespace already is fine
                    if self.fixed:
                        field.SetForegroundColour("Red")
                field.SetToolTip(
                    wx.ToolTip(
                        _translate(
                            'Should be legal as a variable name (alphanumeric)'
                        )))
                field.Bind(wx.EVT_TEXT, self.checkName)
            elif self.fixed:
                field.SetForegroundColour(darkgrey)
                field.SetBackgroundColour(white)

            # warn about whitespace unless will be auto-removed. invisible,
            # probably spurious:
            if (self.fixed or not self.clean) and item != item.strip():
                field.SetForegroundColour('Red')
                # also used in show():
                self.warning = _translate('extra white-space')
                field.SetToolTip(wx.ToolTip(self.warning))
            if self.fixed:
                field.Disable()
            lastRow.append(field)
            self.sizer.Add(field, 1)
        self.inputFields.append(lastRow)
        if self.hasHeader and row == 0:
            self.header = lastRow
예제 #21
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.frame = parent

        # start Chrome webdriver
        chrome_options = webdriver.ChromeOptions()
        chrome_options.add_argument('--proxy-server=%s' % PROXY)
        # chrome_options.add_argument('--auto-open-devtools-for-tabs')
        caps = DesiredCapabilities.CHROME
        caps['goog:loggingPrefs'] = {'performance': 'INFO'}
        chrome_options.add_experimental_option('perfLoggingPrefs',
                                               {'enablePage': True})
        self.driver = webdriver.Chrome(options=chrome_options,
                                       desired_capabilities=caps)
        self.driver.execute_cdp_cmd('Network.enable', {})
        self.driver.execute_cdp_cmd('Network.setCacheDisabled',
                                    {'cacheDisabled': True})
        self.driver.set_window_size(650, 750)
        self.driver.set_window_position(0, 0)
        self.main_sizer = wx.BoxSizer(wx.VERTICAL)
        original_options = webdriver.ChromeOptions()
        original_options.add_argument('--proxy-server=' + REMOTE_PROXY_IP +
                                      ':8082')
        self.original = webdriver.Chrome(options=original_options)
        self.original.set_window_size(650, 750)
        self.original.set_window_position(650, 0)

        # TextCtrl for user to input URL of site to analyze
        self.url_input = wx.TextCtrl(self, style=wx.TE_LEFT)
        self.url_input.SetValue("http://yasirzaki.net/")
        self.url_input.Bind(wx.EVT_KEY_DOWN, self.on_key_press)
        self.main_sizer.Add(self.url_input,
                            flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT,
                            border=25)

        # StaticText field for error messages
        self.err_msg = wx.StaticText(self, label="")
        self.main_sizer.Add(self.err_msg, flag=wx.LEFT, border=25)

        analyze_btn = wx.Button(self, label='Analyze page')
        analyze_btn.Bind(wx.EVT_BUTTON, self.on_button_press)
        self.main_sizer.Add(analyze_btn, flag=wx.ALL | wx.CENTER, border=5)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.scripts_panel = ScrolledPanel(self, size=(375, 550))
        self.scripts_panel.SetupScrolling()
        hbox.Add(self.scripts_panel)

        self.content_panel = ScrolledPanel(self, size=(375, 550))
        self.content_panel.SetupScrolling()
        hbox.Add(self.content_panel, flag=wx.CENTER, border=5)
        self.main_sizer.Add(hbox, flag=wx.CENTER | wx.BOTTOM, border=25)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.apply_btn = wx.Button(self, label='Apply Selection')
        self.apply_btn.Bind(wx.EVT_BUTTON, self.on_button_press)
        self.apply_btn.SetToolTip('Preview changes in the browser window.')
        self.apply_btn.Hide()
        hbox.Add(self.apply_btn, border=5)

        self.save_btn = wx.Button(self, label='Save and load simplified page')
        self.save_btn.Bind(wx.EVT_BUTTON, self.on_button_press)
        self.save_btn.SetToolTip(
            'Save changes in new folder and push to the remote proxy.')
        self.save_btn.Hide()
        hbox.Add(self.save_btn, border=5)

        self.diff_btn = wx.Button(self, label='Get diff')
        self.diff_btn.Bind(wx.EVT_BUTTON, self.on_button_press)
        self.diff_btn.SetToolTip(
            'Print diff before and after changes to terminal window.')
        self.diff_btn.Hide()
        hbox.Add(self.diff_btn, border=5)
        self.main_sizer.Add(hbox, flag=wx.BOTTOM | wx.CENTER, border=25)

        self.SetSizer(self.main_sizer)
        self.url = self.url_input.GetValue()
        self.suffix = "?JSTool=none"
        self.script_sizer = wx.BoxSizer(wx.VERTICAL)
        self.script_buttons = []
        self.choice_boxes = []
        self.number_of_buttons = 0
        self.blocked_urls = []

        self.content_panel.Hide()

        self.content_text = ExpandoTextCtrl(self.content_panel,
                                            size=(375, 275),
                                            style=wx.TE_READONLY)
        self.content_text.SetValue("Script code")
        self.Bind(EVT_ETC_LAYOUT_NEEDED, None, self.content_text)

        self.content_sizer = wx.BoxSizer(wx.VERTICAL)
        self.content_sizer.Add(self.content_text, flag=wx.CENTER)
        self.content_panel.SetSizer(self.content_sizer)

        self.script_tree = AnyNode(id='root')
        self.images = {}
        self.yasir = {}