Example #1
0
 def send_command(self, command):
     try:
         self.conn.send_command(command)
     except socket.error as exception:
         return exception
     if not wx.GetApp().IsMainLoopRunning():
         delayedresult.AbortEvent()()
Example #2
0
    def __init__(self, parent,title,dir):
        wx.Frame.__init__(self, parent,title=title)
        self.dir=dir
        pnl = wx.Panel(self)
        self.checkboxUseDelayed = wx.CheckBox(pnl, -1, "Using delayedresult")
        self.buttonGet = wx.Button(pnl, -1, "Get")
        self.buttonAbort = wx.Button(pnl, -1, "Abort")
        self.slider = wx.Slider(pnl, -1, 0, 0, 10, size=(100,-1),
                                style=wx.SL_HORIZONTAL|wx.SL_AUTOTICKS)
        self.textCtrlResult = wx.TextCtrl(pnl, -1, "", style=wx.TE_READONLY)

        self.checkboxUseDelayed.SetValue(1)
        self.checkboxUseDelayed.Enable(False)
        self.buttonAbort.Enable(False)

        vsizer = wx.BoxSizer(wx.VERTICAL)
        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        vsizer.Add(self.checkboxUseDelayed, 0, wx.ALL, 10)
        hsizer.Add(self.buttonGet, 0, wx.ALL, 5)
        hsizer.Add(self.buttonAbort, 0, wx.ALL, 5)
        hsizer.Add(self.slider, 0, wx.ALL, 5)
        hsizer.Add(self.textCtrlResult, 0, wx.ALL, 5)
        vsizer.Add(hsizer, 0, wx.ALL, 5)
        pnl.SetSizer(vsizer)
        vsizer.SetSizeHints(self)
        
        self.Bind(wx.EVT_BUTTON, self.handleGet, self.buttonGet)
        self.Bind(wx.EVT_BUTTON, self.handleAbort, self.buttonAbort)
        self.jobID = 0
        self.abortEvent = DR.AbortEvent()
        self.Bind(wx.EVT_CLOSE, self.handleClose)
Example #3
0
    def __init__(self, arguments):
        wx.Frame.__init__(self, None, title=meta.APP_TITLE, size=(1000, 800))

        self._arguments = arguments
        self._launchedFromBlender = False

        # dirname = os.path.expanduser("~/.gimelstudio/blenderaddontemp/")
        # try:
        #     shutil.rmtree(dirname)
        # except OSError as e:
        #     print("Error: %s - %s." % (e.filename, e.strerror))

        # if not os.path.exists(dirname):
        #     os.makedirs(dirname, exist_ok=True)
        # else:
        #     pass

        # Threading
        self._jobID = 0
        self._abortEvent = delayedresult.AbortEvent()

        # Set the program icon
        self.SetIcon(ICON_GIMELSTUDIO_ICO.GetIcon())

        # Init everything
        self._InitApp()
Example #4
0
    def __init__(self, *args, **kwds):
        #spath = wx.StandardPaths.Get()
        config.documentsdir = os.path.expanduser('~')

        self.abortEvent = delayedresult.AbortEvent()
        self.jobID = 0
        self.rendering = False
        self.resume = False

        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)

        self.panel_1 = wx.Panel(self, -1)
        self.panel_2 = wx.Panel(self.panel_1, -1)

        # Events
        self.Bind(EVT_GENERIC_GUI, self.updateRenderText)
        self.Bind(wxgdal.EVT_UPDATE_PROGRESS, self.updateProgress)
        self.Bind(wx.EVT_CLOSE, self.OnQuit)

        # List of steps on left side
        self.bitmap_1 = wx.StaticBitmap(self, -1, icons.getIcon140Bitmap())
        self.steplabel = []
        self.steplabel.append(wx.StaticText(self, -1, _("Tile Profile")))
        self.steplabel.append(wx.StaticText(self, -1, _("Source Data Files")))
        self.steplabel.append(wx.StaticText(self, -1, _("Spatial Reference")))
        self.steplabel.append(
            wx.StaticText(self, -1, _("Tile Details"))
        )  # Zoom levels, PNG/JPEG, Tile addressing, Postprocessing?
        self.steplabel.append(wx.StaticText(
            self, -1, _("Destination")))  # Directory / database
        self.steplabel.append(wx.StaticText(self, -1, _("Viewers")))
        self.steplabel.append(wx.StaticText(self, -1, _("Viewer Details")))
        self.steplabel.append(wx.StaticText(self, -1, _("Rendering")))

        self.label_10 = wx.StaticText(
            self, -1, _("MapSlicer - Tile Generator for Map Mashups"))

        self.label_8 = wx.StaticText(self, -1,
                                     _("Version %s") % config.version)
        self.label_9 = wx.StaticText(
            self, -1, _("https://wiki.osgeo.org/wiki/MapSlicer"))

        self.button_back = wx.Button(self, -1, _("Go &Back"))
        self.Bind(wx.EVT_BUTTON, self.OnBack, self.button_back)
        self.button_continue = wx.Button(self, -1, _("&Continue"))
        self.Bind(wx.EVT_BUTTON, self.OnContinue, self.button_continue)

        self.html = wizard.WizardHtmlWindow(self.panel_2, -1)
        self.html.SetBorders(0)
        self.html.SetMinSize((500, 385))

        # Set the first step of the wizard
        self.SetStep(1)

        self.__set_properties()
        self.__do_layout()
Example #5
0
    def __init__(self, parent, endfunc, files, extract=False, overwrite=False):
        wx.Frame.__init__(self, None, title=_("Downloading..."))
        self.parent = parent
        self.files = files
        self.function = endfunc
        self.extract = extract
        self.overwrite = overwrite
        self.retries = 1

        #TODO: Add overwrite function

        self.SetIcon(wx.Icon(consts.fileIco, wx.BITMAP_TYPE_ICO))
        panel = wx.Panel(self)
        loading = wx.StaticText(panel, -1,
                                _("This may take a while. Please be patient."))
        self.gauge = wx.Gauge(panel)
        #cancelBtn  = wx.Button(panel, -1, "Cancel")

        self.cur = wx.StaticText(panel, -1, _("Current Transfer:"))
        self.cur.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.current = wx.StaticText(panel, -1, "\n")
        self.download_gauge = wx.Gauge(panel)
        self.status = wx.TextCtrl(panel,
                                  style=wx.TE_MULTILINE | wx.TE_READONLY)

        status = wx.BoxSizer()
        status.Add(self.cur, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
        status.Add(self.current, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        main = wx.BoxSizer(wx.VERTICAL)
        main.Add(loading, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5)
        main.Add(self.gauge, 0, wx.EXPAND | wx.ALL, 5)
        main.Add(status)
        main.Add(self.download_gauge, 0, wx.EXPAND | wx.ALL, 5)
        main.Add(self.status, 1, wx.EXPAND | wx.ALL, 5)
        #main.Add(cancelBtn, 0, wx.ALIGN_RIGHT|wx.ALL, 5)

        panel.SetSizer(main)
        self.Center()
        self.Show()

        self.jobID = 0
        self.abortEvent = delayedresult.AbortEvent()
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        #self.Bind(wx.EVT_BUTTON, self.handleAbort, cancelBtn)
        self.Bind(wx.EVT_TIMER, self.TimerHandler)

        self.timer = wx.Timer(self)
        self.timer.Start(100)

        self.parent.Enable(False)
        self.handleGet(None)
    def __init__(self, parent, log):
        # Layout
        wx.Frame.__init__(self, parent, -1, title=u"TestFrame")
        self.parent = parent
        self.p = wx.Panel(self, -1)
        sizer = wx.BoxSizer()
        self.button = wx.Button(self.p, -1, label="Press this button to Go")
        self.Bind(wx.EVT_BUTTON, self.OnButton, self.button)
        self.tc = wx.TextCtrl(self.p, -1, "Hello", style=wx.TE_RIGHT)
        sizer.Add(self.button, 1, wx.ALL | wx.EXPAND | wx.ALIGN_BOTTOM, 2)
        sizer.Add(self.tc, 1, wx.ALL | wx.EXPAND, 3)
        self.p.SetSizer(sizer)
        sizer.Fit(self.p)
        sizer.SetSizeHints(self.p)
        self.Layout()
        self.Centre()

        # Used by the threads
        #############################################
        self.jobID = 0
        self.abortEvent = delayedresult.AbortEvent()
Example #7
0
 def __init__(self, process_func, result_func, *args, **kwargs):
     self.process_func = process_func
     self.result_func = result_func
     self.args = args
     self.sessionID = 0
     self.abortEvent = delayedresult.AbortEvent()
Example #8
0
 def __init__(self, *args, **kwargs):
     FrameSimpleDelayedBase.__init__(self, *args, **kwargs)
     self.jobID = 0
     self.abortEvent = delayedresult.AbortEvent()
     self.Bind(wx.EVT_CLOSE, self.handleClose)
Example #9
0
    def __init__(self, *args, **kwds):

        #spath = wx.StandardPaths.Get()
        #config.documentsdir = spath.GetDocumentsDir()
        config.documentsdir = os.path.expanduser('~')

        self.abortEvent = delayedresult.AbortEvent()
        self.jobID = 0
        self.rendering = False
        self.resume = False

        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)

        self.panel_1 = wx.Panel(self, -1)
        self.panel_2 = wx.Panel(self.panel_1, -1)

        # Menu Bar
        self.main_frame_menubar = wx.MenuBar()

        menu = wx.Menu()
        item = menu.Append(wx.NewId(), _("Insert &raster map files"))
        self.Bind(wx.EVT_MENU, self.OnOpen, item)
        self.bug_report = menu.Append(wx.NewId(), _("Send a &bug report"))
        self.Bind(wx.EVT_MENU, self.OnBugReport, self.bug_report)
        #item = menu.Append(wx.ID_PREFERENCES, _("&Preferences"))
        #self.Bind(wx.EVT_MENU, self.OnPrefs, item)
        item = menu.Append(wx.ID_EXIT, _("&Exit"))
        self.Bind(wx.EVT_MENU, self.OnQuit, item)
        self.main_frame_menubar.Append(menu, _("&File"))

        menu = wx.Menu()
        item = menu.Append(wx.ID_HELP, _("Online &Help && FAQ"))
        self.Bind(wx.EVT_MENU, self.OnHelp, item)
        item = menu.Append(wx.NewId(), _("MapTiler User &Group"))
        self.Bind(wx.EVT_MENU, self.OnGroupWeb, item)
        item = menu.Append(wx.NewId(), _("Donation"))
        self.Bind(wx.EVT_MENU, self.OnDonate, item)
        item = menu.Append(wx.NewId(), _("Project &website"))
        self.Bind(wx.EVT_MENU, self.OnProjectWeb, item)
        item = menu.Append(wx.ID_ABOUT, _("&About"))
        self.Bind(wx.EVT_MENU, self.OnAbout, item)
        self.main_frame_menubar.Append(menu, _("&Help"))

        self.Bind(EVT_GENERIC_GUI, self.updateRenderText)
        self.Bind(wxgdal.EVT_UPDATE_PROGRESS, self.updateProgress)

        self.SetMenuBar(self.main_frame_menubar)

        # Events
        self.Bind(wx.EVT_CLOSE, self.OnQuit)
        #self.Bind(wx.EVT_RADIOBUTTON, self.OnRadio)

        # Menu Bar end
        self.bitmap_1 = wx.StaticBitmap(self, -1, icons.getIcon140Bitmap(
        ))  # wx.Bitmap("../resources/icon140.png", wx.BITMAP_TYPE_ANY))
        self.steplabel = []
        self.steplabel.append(wx.StaticText(self, -1, _("Tile Profile")))
        self.steplabel.append(wx.StaticText(self, -1, _("Source Data Files")))
        self.steplabel.append(wx.StaticText(self, -1, _("Spatial Reference")))
        self.steplabel.append(
            wx.StaticText(self, -1, _("Tile Details"))
        )  # Zoom levels, PNG/JPEG, Tile adressing, Postprocessing?
        self.steplabel.append(wx.StaticText(
            self, -1, _("Destination")))  # Directory / database
        self.steplabel.append(wx.StaticText(self, -1, _("Viewers")))
        self.steplabel.append(wx.StaticText(self, -1, _("Viewer Details")))
        self.steplabel.append(wx.StaticText(self, -1, _("Rendering")))

        self.label_10 = wx.StaticText(
            self, -1, _("MapTiler - Tile Generator for Map Mashups"))

        self.label_8 = wx.StaticText(self, -1, _("http://www.maptiler.org/"))
        self.label_9 = wx.StaticText(self, -1,
                                     _(u"(C) 2009 - Klokan Petr Přidal"))

        self.button_back = wx.Button(self, -1, _("Go &Back"))
        self.Bind(wx.EVT_BUTTON, self.OnBack, self.button_back)
        self.button_continue = wx.Button(self, -1, _("&Continue"))
        self.Bind(wx.EVT_BUTTON, self.OnContinue, self.button_continue)

        #self.html = widgets.SpatialReferencePanel(self.panel_2, -1)
        self.html = wizard.WizardHtmlWindow(self.panel_2, -1)
        self.html.SetBorders(0)
        self.html.SetMinSize((500, 385))

        # Set the first step of the wizard..
        self.SetStep(1)

        self.__set_properties()
        self.__do_layout()
Example #10
0
    def __init__(self, *args, **kwds):
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)

        #         self.Bind(wx.EVT_WINDOW_DESTROY, self.OnWindowDestroy)

        self.webSite = "http://ib.berkeley.edu/labs/slatkin/munch/StatisticalAssignmentPackage.html"
        # Frame title
        self.SetTitle("Statistical Assignment Package")

        self.logframe = LogFrame(self, -1, "Log", size=(700, 500))

        # Prepare the menu bar
        menuBar = wx.MenuBar()
        # 1st menu from left
        menu1 = wx.Menu()
        menu1.Append(102, "Open existing project\tCtrl+O")

        # Add a custum menu item for quit: - Maybe implement all of the menus this way instead of using the numbers and binding at the end....
        item = menu1.Append(wx.ID_EXIT, text="&Exit")
        self.Bind(wx.EVT_MENU, self.onQuit, item)

        # Add menu to the menu bar
        menuBar.Append(menu1, "File")
        # Shortcuts
        menu2 = wx.Menu()
        menu2.Append(201, "Results\tCtrl+R", "Open results in browser window")
        ## menu2.Append(202, "Options\tShift+O")
        menu2.Append(203, "Log\tShift+L")
        menuBar.Append(menu2, "&View")
        # Help
        menu3 = wx.Menu()
        menu3.Append(301, "Online Manual\tCtrl+H")
        menu3.AppendSeparator()
        menu3.Append(302, "About")
        menuBar.Append(menu3, "&Help")

        self.SetMenuBar(menuBar)

        self.Bind(wx.EVT_MENU, self.openProject, id=102)
        self.Bind(wx.EVT_MENU, self.showResults, id=201)
        self.Bind(wx.EVT_MENU, self.menu203, id=203)
        self.Bind(wx.EVT_MENU, self.menu301, id=301)
        self.Bind(wx.EVT_MENU, self.menu302, id=302)

        self.resultPath = None

        self.jobID = 0
        self.abortEvent = delayedresult.AbortEvent()

        self.panel = panel = scrolled.ScrolledPanel(self,
                                                    -1,
                                                    style=wx.TAB_TRAVERSAL,
                                                    name="panel1")

        # Sizer for the entire tab:
        tabSizer = wx.BoxSizer(wx.VERTICAL)

        topText = "Specify sequence file (Fasta format) and project directory for project files:"
        tabSizer.Add(wx.StaticText(panel, -1, topText), 0, wx.ALL, 10)

        # Make a sizer for the top input fields and add it to the top sizer with a bit of margin:
        topGridSizer = wx.FlexGridSizer(cols=3, hgap=14, vgap=14)
        tabSizer.Add(topGridSizer, 1, wx.EXPAND | wx.ALL, 10)

        self.l1 = l1 = wx.StaticText(panel, -1, "Sequence files:")
        self.t1 = t1 = wx.TextCtrl(panel,
                                   -1,
                                   "",
                                   size=(350, 50),
                                   style=wx.TE_MULTILINE)
        #self.t1 = t1 = wx.TextCtrl(panel, -1, "", size=(350, -1))
        dt1 = MyFileDropTarget(self, t1)
        self.t1.SetDropTarget(dt1)
        self.b1 = b1 = wx.Button(panel, -1, "Browse")
        self.Bind(wx.EVT_BUTTON, self.onFileBrowseButton, b1)
        wx.CallAfter(t1.SetInsertionPoint, 0)

        self.l2 = l2 = wx.StaticText(panel, -1, "Project folder:")
        self.t2 = t2 = wx.TextCtrl(panel, -1, "", size=(350, -1))
        dt2 = MyDirDropTarget(self, t2)
        self.t2.SetDropTarget(dt2)
        self.b2 = b2 = wx.Button(panel, -1, "Browse")
        self.Bind(wx.EVT_BUTTON, self.onDirBrowseButton, b2)
        wx.CallAfter(t2.SetInsertionPoint, 0)

        self.l3 = l3 = wx.StaticText(panel, -1, "Email:")
        self.t3 = t3 = wx.TextCtrl(panel, -1, "", size=(350, -1))

        self.runB = runB = wx.Button(panel, -1, "Run")
        runB.SetDefault()
        self.Bind(wx.EVT_BUTTON, self.onRunButton, runB)

        self.abortB = abortB = wx.Button(panel, -1, "Abort")
        abortB.Enable(False)
        self.Bind(wx.EVT_BUTTON, self.onAbortButton, abortB)

        self.optionsB = optionsB = wx.Button(panel, -1, "Options")
        self.Bind(wx.EVT_BUTTON, self.onOptionsButton, optionsB)

        topGridSizer.AddMany([
            l1, t1, b1, l2, t2, b2, l3, t3, (0, 0), (0, 0), (
                0,
                0,
            ), (
                0,
                0,
            ), optionsB, (
                0,
                0,
            ), runB, (
                0,
                0,
            ), (
                0,
                0,
            ), abortB
        ])

        #         topGridSizer.AddMany([ l1, t1, b1,
        #                                l2, t2, b2,
        #                                (0,0), (0,0,), (0,0,),
        #                                optionsB, (0,0,), runB,
        #                                (0,0,), (0,0,), abortB
        #                                ])

        panel.SetSizer(tabSizer)
        panel.SetAutoLayout(True)
        panel.SetupScrolling()

        # Frame sizer:
        frameSizer = wx.BoxSizer(wx.VERTICAL)
        frameSizer.SetMinSize((600, 290))
        #frameSizer.SetMinSize((595, 260))
        # Add the note book to the frame sizer:
        frameSizer.Add(panel, 1, wx.EXPAND | wx.ALL, 10)
        # Set the frame sizer:
        self.SetSizer(frameSizer)
        # Fit the frame sizer to the frame:
        frameSizer.Fit(self)

        self.Layout()
Example #11
0
    def __init__(self, parent, id, title):
        # Set config file
        self.cfg = wx.Config(APP_CONFIG)

        # Initialize frame/panel
        wx.Frame.__init__(self,
                          parent,
                          id,
                          title,
                          size=(self.cfg.ReadInt('appWidth',
                                                 APP_DEFAULT_WIDTH),
                                self.cfg.ReadInt('appHeight',
                                                 APP_DEFAULT_HEIGHT)))
        self.SetIcon(wx.Icon(APP_ICON, wx.BITMAP_TYPE_ANY))
        self.panel = wx.Panel(self)

        # Define file menu
        fileMenu = wx.Menu()
        fileExitMenuItem = fileMenu.Append(wx.ID_ANY, 'E&xit',
                                           'Terminate the program')

        # Define options menu
        optionsMenu = wx.Menu()
        self.saveSettingsMenuItem = optionsMenu.Append(
            wx.ID_ANY, 'S&ave Settings on Exit', 'Save Settings on Exit',
            wx.ITEM_CHECK)
        self.saveSettingsMenuItem.Check()

        # Define help menu
        helpMenu = wx.Menu()
        helpAboutMenuItem = helpMenu.Append(wx.ID_ANY, '&About',
                                            'Information about this program')

        # Assign menus to menu bar
        menuBar = wx.MenuBar()
        menuBar.Append(fileMenu, '&File')
        menuBar.Append(optionsMenu, '&Options')
        menuBar.Append(helpMenu, '&Help')
        self.SetMenuBar(menuBar)

        # Initialize thread variables
        self.jobID = 0
        self.abortEvent = delayedresult.AbortEvent()

        # Define controls
        self.mailFromTextCtrl = wx.TextCtrl(
            self.panel,
            value=self.cfg.Read('mailFrom', self.getMyEmailAddress()),
            validator=validators.EmailAddressValidator())
        self.mailToTextCtrl = wx.TextCtrl(
            self.panel,
            value=self.cfg.Read('mailTo'),
            validator=validators.EmailAddressValidator())
        self.mailToTextCtrl.SetFocus()
        self.mailMsgTextCtrl = wx.TextCtrl(
            self.panel,
            style=wx.TE_MULTILINE,
            value=
            "X-Mailer: %s %s\nFrom: %s\nTo: %s\nSubject: Test message\n\nThis is a test."
            % (__app_name__, __version__,
               self.cfg.Read('mailFrom', self.getMyEmailAddress()),
               self.cfg.Read('mailTo')))
        self.useNsCheckBox = wx.CheckBox(self.panel,
                                         label='Specify DNS server')
        self.useNsCheckBox.SetValue(self.cfg.ReadBool('useNs'))
        self.useNsHostTextCtrl = wx.TextCtrl(
            self.panel,
            value=self.cfg.Read('useNsHost'),
            validator=validators.HostAddressValidator())
        self.useNsPortSpinCtrl = wx.SpinCtrl(self.panel,
                                             value=self.cfg.Read(
                                                 'useNsPort',
                                                 str(DNS_DEFAULT_PORT)),
                                             min=1,
                                             max=65535,
                                             size=(50, -1))
        self.nsQueryTimeoutSpinCtrl = wx.SpinCtrl(
            self.panel,
            value=self.cfg.Read('nsQueryTimeout',
                                str(DNS_DEFAULT_QUERY_TIMEOUT)),
            min=1,
            max=65535,
            size=(50, -1))
        self.useNsTcpCheckBox = wx.CheckBox(self.panel, label='Use TCP')
        self.useNsTcpCheckBox.SetValue(self.cfg.ReadBool('useNsTcp'))
        self.useSmtpCheckBox = wx.CheckBox(self.panel,
                                           label='Specify SMTP server')
        self.useSmtpCheckBox.SetValue(self.cfg.ReadBool('useSmtp'))
        self.useSmtpHostTextCtrl = wx.TextCtrl(
            self.panel,
            value=self.cfg.Read('useSmtpHost'),
            validator=validators.HostAddressValidator())
        self.useSmtpPortSpinCtrl = wx.SpinCtrl(self.panel,
                                               value=self.cfg.Read(
                                                   'useSmtpPort',
                                                   str(SMTP_DEFAULT_PORT)),
                                               min=1,
                                               max=65535,
                                               size=(50, -1))
        self.smtpConnectTimeoutSpinCtrl = wx.SpinCtrl(
            self.panel,
            value=self.cfg.Read('smtpConnectTimeout',
                                str(SMTP_DEFAULT_CONNECT_TIMEOUT)),
            min=1,
            max=65535,
            size=(50, -1))
        self.useSmtpHeloTextCtrl = wx.TextCtrl(
            self.panel,
            value=self.cfg.Read('useSmtpHelo', socket.getfqdn()),
            validator=validators.HostAddressValidator())
        self.useAuthCheckBox = wx.CheckBox(self.panel,
                                           label='Use Authentication')
        self.useAuthCheckBox.SetValue(self.cfg.ReadBool('useAuth'))
        self.useAuthUserTextCtrl = wx.TextCtrl(
            self.panel,
            value=self.cfg.Read('useAuthUser'),
            validator=validators.GenericTextValidator(
                flag=validators.VALIDATE_NOT_NULL))
        self.useAuthPassTextCtrl = wx.TextCtrl(
            self.panel,
            value=self.cfg.Read('useAuthPass'),
            style=wx.TE_PASSWORD)
        self.useTlsCheckBox = wx.CheckBox(self.panel,
                                          label='Use TLS encryption')
        self.useTlsCheckBox.SetValue(self.cfg.ReadBool('useTls'))
        self.okButton = wx.Button(self.panel, wx.ID_OK)
        self.cancelButton = wx.Button(self.panel, wx.ID_CANCEL)
        self.resultsTextCtrl = wx.TextCtrl(self.panel,
                                           style=wx.TE_MULTILINE | wx.TE_RICH2
                                           | wx.TE_READONLY)

        # Put all controls into correct state
        if not self.useNsCheckBox.IsChecked():
            self.toggleNsOptions(False)
        if not self.useSmtpCheckBox.IsChecked():
            self.toggleSmtpOptions(False)
        if not self.useAuthCheckBox.IsChecked():
            self.toggleAuthOptions(False)
        self.toggleWorkingMode(False)

        # Outer sizer (entire window)
        mainSizer = wx.GridBagSizer(vgap=5, hgap=5)

        # Message fields
        messageSizer = wx.StaticBoxSizer(wx.StaticBox(self.panel,
                                                      label='Message'),
                                         orient=wx.VERTICAL)
        messageSizer.Add(wx.StaticText(self.panel, label='From:'))
        messageSizer.Add(self.mailFromTextCtrl, flag=wx.ALL | wx.EXPAND)
        messageSizer.Add(wx.StaticText(self.panel, label='To:'))
        messageSizer.Add(self.mailToTextCtrl, flag=wx.ALL | wx.EXPAND)
        messageSizer.Add(wx.StaticText(self.panel, label='Message:'))
        messageSizer.Add(self.mailMsgTextCtrl,
                         proportion=1,
                         flag=wx.ALL | wx.EXPAND)
        mainSizer.Add(messageSizer,
                      pos=(0, 0),
                      span=(4, 1),
                      flag=wx.ALL | wx.EXPAND)

        # DNS Options
        nsSizer = wx.StaticBoxSizer(wx.StaticBox(self.panel, label='DNS'),
                                    orient=wx.VERTICAL)
        innerSizer = wx.GridBagSizer()
        innerSizer.SetEmptyCellSize(
            (0, 0))  # FIXME http://trac.wxwidgets.org/ticket/3105
        innerSizer.Add(self.useNsCheckBox, pos=(3, 0), span=(1, 2))
        innerSizer.Add(wx.StaticText(self.panel, label='Host:'), pos=(4, 0))
        innerSizer.Add(self.useNsHostTextCtrl,
                       pos=(5, 0),
                       flag=wx.ALL | wx.EXPAND)
        innerSizer.Add(wx.StaticText(self.panel, label='Port:'), pos=(4, 1))
        innerSizer.Add(self.useNsPortSpinCtrl, pos=(5, 1))
        innerSizer.Add(wx.StaticText(self.panel, label='Timeout:'), pos=(4, 2))
        innerSizer.Add(self.nsQueryTimeoutSpinCtrl,
                       pos=(5, 2),
                       flag=wx.ALL | wx.EXPAND)
        innerSizer.Add(self.useNsTcpCheckBox, pos=(6, 0), span=(1, 2))
        nsSizer.Add(innerSizer, flag=wx.ALL | wx.EXPAND)
        mainSizer.Add(nsSizer, pos=(0, 1), flag=wx.ALL | wx.EXPAND)

        # SMTP Server Options
        smtpSizer = wx.StaticBoxSizer(wx.StaticBox(self.panel, label='SMTP'),
                                      orient=wx.VERTICAL)
        innerSizer = wx.GridBagSizer()
        innerSizer.SetEmptyCellSize(
            (0, 0))  # FIXME http://trac.wxwidgets.org/ticket/3105
        innerSizer.Add(self.useSmtpCheckBox, pos=(3, 0), span=(1, 2))
        innerSizer.Add(wx.StaticText(self.panel, label='Host:'), pos=(4, 0))
        innerSizer.Add(self.useSmtpHostTextCtrl,
                       pos=(5, 0),
                       flag=wx.ALL | wx.EXPAND)
        innerSizer.Add(wx.StaticText(self.panel, label='Port:'), pos=(4, 1))
        innerSizer.Add(self.useSmtpPortSpinCtrl, pos=(5, 1))

        innerSizer.Add(wx.StaticText(self.panel, label='Timeout:'), pos=(4, 2))
        innerSizer.Add(self.smtpConnectTimeoutSpinCtrl,
                       pos=(5, 2),
                       flag=wx.ALL | wx.EXPAND)

        innerSizer.Add(wx.StaticText(self.panel, label='HELO/EHLO:'),
                       pos=(6, 0))
        innerSizer.Add(self.useSmtpHeloTextCtrl,
                       pos=(7, 0),
                       span=(1, 3),
                       flag=wx.ALL | wx.EXPAND)
        smtpSizer.Add(innerSizer, flag=wx.ALL | wx.EXPAND)
        mainSizer.Add(smtpSizer, pos=(1, 1), flag=wx.ALL | wx.EXPAND)

        # Security Options
        secSizer = wx.StaticBoxSizer(wx.StaticBox(self.panel,
                                                  label='Security'),
                                     orient=wx.VERTICAL)
        secSizer.Add(self.useAuthCheckBox)
        secSizer.Add(wx.StaticText(self.panel, label='Username:'******'Password:'******'Results'),
                                         orient=wx.VERTICAL)
        resultsSizer.Add(self.resultsTextCtrl,
                         proportion=1,
                         flag=wx.ALL | wx.EXPAND)
        mainSizer.Add(resultsSizer,
                      pos=(4, 0),
                      span=(1, 2),
                      flag=wx.ALL | wx.EXPAND)

        # End outer sizer (entire window)
        mainSizer.AddGrowableCol(0)
        mainSizer.AddGrowableRow(4)
        self.panel.SetSizerAndFit(mainSizer)
        self.panel.SetClientSize(mainSizer.GetSize())
        self.Show()

        # Map events
        self.Bind(wx.EVT_MENU, self.onFileExit, fileExitMenuItem)
        self.Bind(wx.EVT_MENU, self.onHelpAbout, helpAboutMenuItem)
        self.Bind(wx.EVT_CLOSE, self.onCloseWindow)
        self.mailFromTextCtrl.Bind(wx.EVT_TEXT, self.onUpdateMailFromTextCtrl)
        self.mailToTextCtrl.Bind(wx.EVT_TEXT, self.onUpdateMailToTextCtrl)
        self.useNsCheckBox.Bind(wx.EVT_CHECKBOX, self.onUseNsCheckBox)
        self.useSmtpCheckBox.Bind(wx.EVT_CHECKBOX, self.onUseSmtpCheckBox)
        self.useAuthCheckBox.Bind(wx.EVT_CHECKBOX, self.onAuthCheckBox)
        self.cancelButton.Bind(wx.EVT_BUTTON, self.onCancel)
        self.okButton.Bind(wx.EVT_BUTTON, self.onOk)