예제 #1
0
    def __init__(self, d, a, pl):
        self.d = d
        self.a = a
        self.pl = pl
        self.flag = threading.Event()
        frame = wx.wxFrame(None, -1, 'BitTorrent make directory',
                           size=wx.wxSize(550, 250))
        self.frame = frame

        panel = wx.wxPanel(frame, -1)

        gridSizer = wx.wxFlexGridSizer(cols=1, vgap=15, hgap=8)

        self.currentLabel = wx.wxStaticText(panel, -1, 'checking file sizes')
        gridSizer.Add(self.currentLabel, 0, wx.wxEXPAND)
        self.gauge = wx.wxGauge(panel, -1, range=1000, style=wx.wxGA_SMOOTH)
        gridSizer.Add(self.gauge, 0, wx.wxEXPAND)
        gridSizer.Add(10, 10, 1, wx.wxEXPAND)
        self.button = wx.wxButton(panel, -1, 'cancel')
        gridSizer.Add(self.button, 0, wx.wxALIGN_CENTER)
        gridSizer.AddGrowableRow(2)
        gridSizer.AddGrowableCol(0)

        g2 = wx.wxFlexGridSizer(cols=1, vgap=15, hgap=8)
        g2.Add(gridSizer, 1, wx.wxEXPAND | wx.wxALL, 25)
        g2.AddGrowableRow(0)
        g2.AddGrowableCol(0)
        panel.SetSizer(g2)
        panel.SetAutoLayout(True)
        wx.EVT_BUTTON(frame, self.button.GetId(), self.done)
        wx.EVT_CLOSE(frame, self.done)
        EVT_INVOKE(frame, self.onInvoke)
        frame.Show(True)
        threading.Thread(target=self.complete).start()
예제 #2
0
    def __init__(self, d, a, params):
        self.d = d
        self.a = a
        self.params = params
        self.flag = threading.Event()
        self.separatetorrents = False

        if os.path.isdir(d):
            self.choicemade = threading.Event()
            frame = wx.wxFrame(None, -1, 'BitTorrent make torrent',
                               size=(1, 1))
            self.frame = frame
            panel = wx.wxPanel(frame, -1)
            gridSizer = wx.wxFlexGridSizer(cols=1, vgap=8, hgap=8)
            gridSizer.AddGrowableRow(1)
            gridSizer.Add(wx.wxStaticText(
                panel, -1, 'Do you want to make a separate .torrent'), 0,
                wx.wxALIGN_CENTER)
            gridSizer.Add(wx.wxStaticText(
                panel, -1, 'for every item in this directory?'), 0,
                wx.wxALIGN_CENTER)
            gridSizer.Add(wx.wxStaticText(panel, -1, ''))

            b = wx.wxFlexGridSizer(cols=3, hgap=10)
            yesbut = wx.wxButton(panel, -1, 'Yes')

            def saidyes(e, self=self):
                self.frame.Destroy()
                self.separatetorrents = True
                self.begin()
            wx.EVT_BUTTON(frame, yesbut.GetId(), saidyes)
            b.Add(yesbut, 0)

            nobut = wx.wxButton(panel, -1, 'No')

            def saidno(e, self=self):
                self.frame.Destroy()
                self.begin()
            wx.EVT_BUTTON(frame, nobut.GetId(), saidno)
            b.Add(nobut, 0)

            cancelbut = wx.wxButton(panel, -1, 'Cancel')

            def canceled(e, self=self):
                self.frame.Destroy()
            wx.EVT_BUTTON(frame, cancelbut.GetId(), canceled)
            b.Add(cancelbut, 0)
            gridSizer.Add(b, 0, wx.wxALIGN_CENTER)
            border = wx.wxBoxSizer(wx.wxHORIZONTAL)
            border.Add(gridSizer, 1, wx.wxEXPAND | wx.wxALL, 4)

            panel.SetSizer(border)
            panel.SetAutoLayout(True)
            frame.Show()
            border.Fit(panel)
            frame.Fit()

        else:
            self.begin()
예제 #3
0
    def begin(self):
        if self.separatetorrents:
            frame = wx.wxFrame(None, -1, 'BitTorrent make directory',
                               size=wx.wxSize(550, 250))
        else:
            frame = wx.wxFrame(None, -1, 'BitTorrent make torrent',
                               size=wx.wxSize(550, 250))
        self.frame = frame

        panel = wx.wxPanel(frame, -1)
        gridSizer = wx.wxFlexGridSizer(cols=1, vgap=15, hgap=8)

        if self.separatetorrents:
            self.currentLabel = wx.wxStaticText(panel, -1,
                                                'checking file sizes')
        else:
            self.currentLabel = wx.wxStaticText(
                panel, -1, 'building ' + self.d + '.torrent')
        gridSizer.Add(self.currentLabel, 0, wx.wxEXPAND)
        self.gauge = wx.wxGauge(panel, -1, range=1000, style=wx.wxGA_SMOOTH)
        gridSizer.Add(self.gauge, 0, wx.wxEXPAND)
        gridSizer.Add((10, 10), 1, wx.wxEXPAND)
        self.button = wx.wxButton(panel, -1, 'cancel')
        gridSizer.Add(self.button, 0, wx.wxALIGN_CENTER)
        gridSizer.AddGrowableRow(2)
        gridSizer.AddGrowableCol(0)

        g2 = wx.wxFlexGridSizer(cols=1, vgap=15, hgap=8)
        g2.Add(gridSizer, 1, wx.wxEXPAND | wx.wxALL, 25)
        g2.AddGrowableRow(0)
        g2.AddGrowableCol(0)
        panel.SetSizer(g2)
        panel.SetAutoLayout(True)
        wx.EVT_BUTTON(frame, self.button.GetId(), self.done)
        wx.EVT_CLOSE(frame, self.done)
        EVT_INVOKE(frame, self.onInvoke)
        frame.Show(True)
        threading.Thread(target=self.complete).start()
예제 #4
0
    def __init__(self):
        frame = wx.wxFrame(None, -1, 'BitTorrent complete dir 1.0.1',
                           size=wx.wxSize(550, 250))
        self.frame = frame

        panel = wx.wxPanel(frame, -1)

        gridSizer = wx.wxFlexGridSizer(cols=2, rows=2, vgap=15, hgap=8)

        gridSizer.Add(wx.wxStaticText(panel, -1, 'directory to build:'))
        self.dirCtl = wx.wxTextCtrl(panel, -1, '')

        b = wx.wxBoxSizer(wx.wxHORIZONTAL)
        b.Add(self.dirCtl, 1, wx.wxEXPAND)
#        b.Add(10, 10, 0, wxEXPAND)
        button = wx.wxButton(panel, -1, 'select')
        b.Add(button, 0, wx.wxEXPAND)
        wx.EVT_BUTTON(frame, button.GetId(), self.select)

        gridSizer.Add(b, 0, wx.wxEXPAND)

        gridSizer.Add(wx.wxStaticText(panel, -1, 'announce url:'))
        self.annCtl = wx.wxTextCtrl(panel, -1,
                                    'http://my.tracker:6969/announce')
        gridSizer.Add(self.annCtl, 0, wx.wxEXPAND)

        gridSizer.Add(wx.wxStaticText(panel, -1, 'piece size:'))
        self.piece_length = wx.wxChoice(
            panel, -1, choices=['2 ** 21', '2 ** 20', '2 ** 19', '2 ** 18',
                                '2 ** 17', '2 ** 16', '2 ** 15'])
        self.piece_length.SetSelection(3)
        gridSizer.Add(self.piece_length)

        gridSizer.AddGrowableCol(1)

        border = wx.wxBoxSizer(wx.wxVERTICAL)
        border.Add(gridSizer, 0,
                   wx.wxEXPAND | wx.wxNORTH | wx.wxEAST | wx.wxWEST, 25)
        b2 = wx.wxButton(panel, -1, 'make')
#        border.Add(10, 10, 1, wxEXPAND)
        border.Add(b2, 0, wx.wxALIGN_CENTER | wx.wxSOUTH, 20)
        wx.EVT_BUTTON(frame, b2.GetId(), self.complete)
        panel.SetSizer(border)
        panel.SetAutoLayout(True)
예제 #5
0
    def __init__(self):
        frame = wx.wxFrame(None, -1, 'BitTorrent Torrent File Maker',
                           size=wx.wxSize(550, 410))
        self.frame = frame

        panel = wx.wxPanel(frame, -1)

        gridSizer = wx.wxFlexGridSizer(cols=2, rows=2, vgap=0, hgap=8)

        gridSizer.Add(wx.wxStaticText(panel, -1, 'make torrent of:'))

        b = wx.wxBoxSizer(wx.wxHORIZONTAL)
        self.dirCtl = wx.wxTextCtrl(panel, -1, '')
        b.Add(self.dirCtl, 1, wx.wxEXPAND)
#        b.Add(10, 10, 0, wxEXPAND)

        button = wx.wxButton(panel, -1, 'dir', size=(30, 20))
        wx.EVT_BUTTON(frame, button.GetId(), self.selectdir)
        b.Add(button, 0)

        button2 = wx.wxButton(panel, -1, 'file', size=(30, 20))
        wx.EVT_BUTTON(frame, button2.GetId(), self.selectfile)
        b.Add(button2, 0)

        gridSizer.Add(b, 0, wx.wxEXPAND)
        gridSizer.Add(wx.wxStaticText(panel, -1, ''))
        gridSizer.Add(wx.wxStaticText(panel, -1, ''))

        gridSizer.Add(wx.wxStaticText(panel, -1, 'announce url:'))
        self.annCtl = wx.wxTextCtrl(panel, -1,
                                    'http://my.tracker:6969/announce')
        gridSizer.Add(self.annCtl, 0, wx.wxEXPAND)
        gridSizer.Add(wx.wxStaticText(panel, -1, ''))
        gridSizer.Add(wx.wxStaticText(panel, -1, ''))

        a = wx.wxFlexGridSizer(cols=1)
        a.Add(wx.wxStaticText(panel, -1, 'announce list:'))
        a.Add(wx.wxStaticText(panel, -1, ''))
        abutton = wx.wxButton(panel, -1, 'copy\nannounces\nfrom\ntorrent',
                              size=(50, 70))
        wx.EVT_BUTTON(frame, abutton.GetId(), self.announcecopy)
        a.Add(abutton, 0, wx.wxEXPAND)
        gridSizer.Add(a, 0, wx.wxEXPAND)

        self.annListCtl = wx.wxTextCtrl(
            panel, -1, '\n\n\n\n\n', wx.wxPoint(-1, -1), (400, 120),
            wx.wxTE_MULTILINE | wx.wxHSCROLL | wx.wxTE_DONTWRAP)
        gridSizer.Add(self.annListCtl, -1, wx.wxEXPAND)

        gridSizer.Add(wx.wxStaticText(panel, -1, ''))
        exptext = wx.wxStaticText(
            panel, -1, 'a list of announces separated by commas or whitespace '
            'and on several lines -\ntrackers on the same line will be tried '
            'randomly, and all the trackers on one line\nwill be tried before '
            'the trackers on the next line.')
        exptext.SetFont(wx.wxFont(6, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL,
                                  False))
        gridSizer.Add(exptext)

        gridSizer.Add(wx.wxStaticText(panel, -1, ''))
        gridSizer.Add(wx.wxStaticText(panel, -1, ''))

        gridSizer.Add(wx.wxStaticText(panel, -1, 'piece size:'))
        self.piece_length = wx.wxChoice(
            panel, -1, choices=['automatic', '2MiB', '1MiB', '512KiB',
                                '256KiB', '128KiB', '64KiB', '32KiB'])
        self.piece_length_list = [0, 21, 20, 19, 18, 17, 16, 15]
        self.piece_length.SetSelection(0)
        gridSizer.Add(self.piece_length)

        gridSizer.Add(wx.wxStaticText(panel, -1, ''))
        gridSizer.Add(wx.wxStaticText(panel, -1, ''))

        gridSizer.Add(wx.wxStaticText(panel, -1, 'comment:'))
        self.commentCtl = wx.wxTextCtrl(panel, -1, '')
        gridSizer.Add(self.commentCtl, 0, wx.wxEXPAND)

        gridSizer.AddGrowableCol(1)

        border = wx.wxBoxSizer(wx.wxVERTICAL)
        border.Add(gridSizer, 0,
                   wx.wxEXPAND | wx.wxNORTH | wx.wxEAST | wx.wxWEST, 25)
        b2 = wx.wxButton(panel, -1, 'make')
#        border.Add(10, 10, 1, wxEXPAND)
        border.Add(b2, 0, wx.wxALIGN_CENTER | wx.wxSOUTH, 20)
        wx.EVT_BUTTON(frame, b2.GetId(), self.complete)
        panel.SetSizer(border)
        panel.SetAutoLayout(True)
예제 #6
0
        def __init__(self, parent, id, file, data, isValidCallback = None,
                     pos = wx.wxDefaultPosition, size = wx.wxDefaultSize,
                     style = wx.wxTAB_TRAVERSAL, name = "ImportWizardPanel"):
            wx.wxPanel.__init__(self, parent, id, pos, size, style, name)
            self.SetAutoLayout(wx.true)
            mainSizer = wx.wxFlexGridSizer(3, 1)
            self.SetSizer(mainSizer)
            mainSizer.AddGrowableCol(0)

            self.initialized = wx.false
            self.data = data
            self.isValidCallback = isValidCallback
            self.Validate = (isValidCallback and self.Validate) or self.BuildPreview

            dlg = wx.wxProgressDialog("Import Wizard",
                                   "Analyzing %s... Please wait." % file,
                                   3,
                                   parent,
                                   wx.wxPD_APP_MODAL | wx.wxPD_AUTO_HIDE)
            textQualifier = guessTextQualifier(data)
            dlg.Update(1)
            newdata = organizeIntoLines(data, textQualifier = textQualifier, limit = 100)
            dlg.Update(2)
            delimiter = guessDelimiter(newdata, textQualifier = textQualifier)
            dlg.Update(3)
            dlg.Destroy()

            # -------------
            msg = ("This screen lets you set the delimiters your data contains.\n"
                   "You can see how your data is affected in the preview below.")
            message1 = wx.wxStaticText(self, -1, msg)

            # -------------
            delimiterBox = wx.wxBoxSizer(wx.wxHORIZONTAL)
            delimStaticBox = wx.wxStaticBox(self, -1, "Delimiters")
            delimStaticSizer = wx.wxStaticBoxSizer(delimStaticBox, wx.wxVERTICAL)
            delimGridSizer = wx.wxFlexGridSizer(2, 3)

            delims = {
                'Tab':       '\t',
                'Semicolon': ';',
                'Comma':     ',',
                'Space':     ' ',
                }

            self.delimChecks = {}

            for label, value in delims.items():
                self.delimChecks[value] = wx.wxCheckBox(self, -1, label)
                delimGridSizer.Add(self.delimChecks[value], 0, wx.wxALL, 3)
                wx.EVT_CHECKBOX(self, self.delimChecks[value].GetId(), self.Validate)

            otherSizer = wx.wxBoxSizer(wx.wxHORIZONTAL)

            self.delimChecks['Other'] = wx.wxCheckBox(self, -1, 'Other:')
            wx.EVT_CHECKBOX(self, self.delimChecks['Other'].GetId(), self.Validate)

            self.otherDelim = wx.wxTextCtrl(self, -1, size = (20, -1))
            wx.EVT_TEXT(self, self.otherDelim.GetId(), self.OnCustomDelim)

            if self.delimChecks.has_key(delimiter):
                self.delimChecks[delimiter].SetValue(wx.true)
            elif delimiter is not None:
                self.delimChecks['Other'].SetValue(wx.true)
                self.otherDelim.SetValue(delimiter)

            otherSizer.AddMany([
                (self.delimChecks['Other'], 0, wx.wxALL, 3),
                (self.otherDelim, 0, wx.wxALIGN_CENTER),
                ])
            
            delimGridSizer.Add(otherSizer)
            delimStaticSizer.Add(delimGridSizer, 1, wx.wxEXPAND)
            delimOtherSizer = wx.wxBoxSizer(wx.wxVERTICAL)
            self.consecutiveDelimsAs1 = wx.wxCheckBox(self, -1, "Treat consecutive delimiters as one")
            self.consecutiveDelimsAs1.Enable(wx.false)
            tqSizer = wx.wxBoxSizer(wx.wxHORIZONTAL)
            self.textQualifierChoice = wx.wxChoice(self, -1, choices = ['"', "'", "{None}"])
            wx.EVT_CHOICE(self, self.textQualifierChoice.GetId(), self.BuildPreview)
            if textQualifier is not None:
                self.textQualifierChoice.SetStringSelection(textQualifier)
            else:
                self.textQualifierChoice.SetStringSelection('{None}')
                
            tqSizer.AddMany([
                (wx.wxStaticText(self, -1, "Text qualifier:"), 0, wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL),
                (self.textQualifierChoice, 0, wx.wxALL | wx.wxALIGN_LEFT | wx.wxALIGN_CENTER_VERTICAL, 5),
                ])
            
            delimOtherSizer.AddMany([
                (self.consecutiveDelimsAs1, 1, wx.wxEXPAND | wx.wxALL, 5),
                (tqSizer, 1, wx.wxALL | wx.wxALIGN_CENTER, 5),
                ])

            delimiterBox.AddMany([
                (delimStaticSizer, 0, wx.wxALIGN_CENTER),
                (delimOtherSizer,  0, wx.wxALIGN_CENTER),
                ])
            
            delimStaticBox.Fit()

            # -------------
            self.displayRows = 6
            previewSettingsBox = wx.wxBoxSizer(wx.wxHORIZONTAL)
            self.hasHeaderRow = wx.wxCheckBox(self, -1, "First row is header")
            wx.EVT_CHECKBOX(self, self.hasHeaderRow.GetId(), self.BuildPreview)

            if wx.wxPlatform in ('__WX.WXGTK__', '__WX.WXMSW__'):
                # wx.wxSpinCtrl causes seg fault under GTK when <enter> is hit in text - use wx.wxSpinButton instead
                self.previewRowsText = wx.wxTextCtrl(self, -1, str(self.displayRows),
                                                  size = (30, -1), style = wx.wxTE_PROCESS_ENTER)
                h = self.previewRowsText.GetSize().height
                self.previewRows = wx.wxSpinButton(self, -1, size = (-1, h), style = wx.wxSP_VERTICAL)
                self.previewRows.SetRange(self.displayRows, 100)
                self.previewRows.SetValue(self.displayRows)
                wx.EVT_SPIN(self, self.previewRows.GetId(), self.OnSpinPreviewRows)
                wx.EVT_TEXT_ENTER(self, self.previewRowsText.GetId(), self.OnTextPreviewRows)
            else:
                self.previewRows = wx.wxSpinCtrl(self, -1, str(self.displayRows),
                                              min = self.displayRows, max = 100, size = (50, -1))
                wx.EVT_SPINCTRL(self, self.previewRows.GetId(), self.BuildPreview)

            previewSettingsBox.AddMany([
                (self.hasHeaderRow, 1, wx.wxALL | wx.wxEXPAND, 5),
                (wx.wxStaticText(self, -1, "Preview"), 0, wx.wxWEST | wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL, 10),
                ])
            if wx.wxPlatform in ('__WX.WXGTK__', '__WX.WXMSW__'):
                previewSettingsBox.Add(self.previewRowsText, 0, wx.wxALIGN_CENTER | wx.wxALL, 3)
            previewSettingsBox.AddMany([
                (self.previewRows, 0, wx.wxALIGN_CENTER | wx.wxALL, 3),
                (wx.wxStaticText(self, -1, "rows"), 0, wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL),
                ])

            # -------------
            if delimiter is not None:
                previewData = importDSV(newdata[:self.displayRows],
                                        textQualifier = textQualifier,
                                        delimiter = delimiter,
                                        errorHandler = padRow)
                hasHeaders = guessHeaders(previewData)
                self.hasHeaderRow.SetValue(hasHeaders)

                cols = len(previewData[0])
            else:
                previewData = []
                hasHeaders = 0
                cols = 1

            previewStaticBox = wx.wxStaticBox(self, -1, "Data Preview")
            previewStaticSizer = wx.wxStaticBoxSizer(previewStaticBox, wx.wxVERTICAL)
            self.preview = grid.wxGrid(self, -1)
            self.preview.CreateGrid(self.displayRows, cols)
            self.preview.SetDefaultRowSize(self.preview.GetCharHeight() + 4, wx.true)
            self.preview.EnableEditing(wx.false)
            self.preview.SetColLabelSize(0)
            self.preview.SetRowLabelSize(0)
            self.preview.SetMargins(1, 0)
            self.initialized = wx.true
            self.BuildPreview()

            rowheight = self.preview.GetRowSize(0) + 2
            self.preview.SetSize((-1, rowheight * self.displayRows))
            previewStaticSizer.Add(self.preview, 0, wx.wxALL | wx.wxEXPAND, 5)

            # -------------
            mainSizer.AddMany([
                (message1,     0, wx.wxALL, 5),
                (delimiterBox, 0, wx.wxALL, 5),
                (previewSettingsBox, 0, wx.wxALL, 5),
                (previewStaticSizer, 0, wx.wxALL | wx.wxEXPAND, 5),
                ])

            self.Layout()
            self.Fit()
예제 #7
0
    def __init__(self, config, calls):
        self.config = config
        self.calls = calls

        self.uiflag = threading.Event()
        self.cancelflag = threading.Event()
        self.switchlock = threading.Lock()
        self.working = False
        self.queue = []
        wx.wxInitAllImageHandlers()
        self.thostselection = self.calls['getCurrentTHost']()
        self.thostselectnum = 0
        self.choices = None
        self.choices1 = None
        self.announce = ''
        self.announce_list = None

        self.windowStyle = wx.wxSYSTEM_MENU | wx.wxCAPTION | wx.wxMINIMIZE_BOX
        if self.config['stayontop']:
            self.windowStyle |= wx.wxSTAY_ON_TOP
        frame = wx.wxFrame(None,
                           -1,
                           'T-Make',
                           size=wx.wxSize(-1, -1),
                           style=self.windowStyle)
        self.frame = frame
        panel = wx.wxPanel(frame, -1)
        mainSizer = wx.wxBoxSizer(wx.wxVERTICAL)
        groupSizer = wx.wxFlexGridSizer(cols=1, vgap=0, hgap=0)
        #        self.dropTarget = self.calls['newDropTarget']((200, 200))
        self.dropTarget = self.calls['newDropTarget']()
        self.dropTargetPtr = wx.wxStaticBitmap(panel, -1, self.dropTarget)
        self.calls['setDropTargetRefresh'](self.dropTargetPtr.Refresh)
        self.dropTargetWidth = self.dropTarget.GetWidth()
        wx.EVT_LEFT_DOWN(self.dropTargetPtr, self.dropTargetClick)
        wx.EVT_ENTER_WINDOW(self.dropTargetPtr,
                            self.calls['dropTargetHovered'])
        wx.EVT_LEAVE_WINDOW(self.dropTargetPtr,
                            self.calls['dropTargetUnhovered'])
        groupSizer.Add(self.dropTargetPtr, 0, wx.wxALIGN_CENTER)
        lowerSizer1 = wx.wxGridSizer(cols=6)
        dirlink = wx.wxStaticText(panel, -1, 'dir')
        dirlink.SetFont(
            wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        dirlink.SetForegroundColour('blue')
        wx.EVT_LEFT_UP(dirlink, self.selectdir)
        lowerSizer1.Add(dirlink, -1, wx.wxALIGN_LEFT)
        lowerSizer1.Add(wx.wxStaticText(panel, -1, ''), -1, wx.wxALIGN_CENTER)
        lowerSizer1.Add(wx.wxStaticText(panel, -1, ''), -1, wx.wxALIGN_CENTER)
        lowerSizer1.Add(wx.wxStaticText(panel, -1, ''), -1, wx.wxALIGN_CENTER)
        lowerSizer1.Add(wx.wxStaticText(panel, -1, ''), -1, wx.wxALIGN_CENTER)
        filelink = wx.wxStaticText(panel, -1, 'file')
        filelink.SetFont(
            wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        filelink.SetForegroundColour('blue')
        wx.EVT_LEFT_UP(filelink, self.selectfile)
        lowerSizer1.Add(filelink, -1, wx.wxALIGN_RIGHT)

        groupSizer.Add(lowerSizer1, -1, wx.wxALIGN_CENTER)

        self.gauge = wx.wxGauge(panel,
                                -1,
                                range=1000,
                                style=wx.wxGA_HORIZONTAL,
                                size=(-1, 15))
        groupSizer.Add(self.gauge, 0, wx.wxEXPAND)
        self.statustext = wx.wxStaticText(panel,
                                          -1,
                                          'ready',
                                          style=wx.wxALIGN_CENTER
                                          | wx.wxST_NO_AUTORESIZE)
        self.statustext.SetFont(
            wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxBOLD, False))
        groupSizer.Add(self.statustext, -1, wx.wxEXPAND)
        self.choices = wx.wxChoice(panel,
                                   -1, (-1, -1), (self.dropTargetWidth, -1),
                                   choices=[])
        self.choices.SetFont(
            wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, False))
        wx.EVT_CHOICE(self.choices, -1, self.set_thost)
        groupSizer.Add(self.choices, 0, wx.wxEXPAND)
        cancellink = wx.wxStaticText(panel, -1, 'cancel')
        cancellink.SetFont(
            wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        cancellink.SetForegroundColour('red')
        wx.EVT_LEFT_UP(cancellink, self.cancel)
        groupSizer.Add(cancellink, -1, wx.wxALIGN_CENTER)
        advlink = wx.wxStaticText(panel, -1, 'advanced')
        advlink.SetFont(
            wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        advlink.SetForegroundColour('blue')
        wx.EVT_LEFT_UP(advlink, self.calls['switchToAdvanced'])
        groupSizer.Add(advlink, -1, wx.wxALIGN_CENTER)
        mainSizer.Add(groupSizer, 0, wx.wxALIGN_CENTER)

        self.refresh_thostlist()
        self._set_thost()

        if sys.platform == 'win32':
            self.dropTargetPtr.DragAcceptFiles(True)
            wx.EVT_DROP_FILES(self.dropTargetPtr, self.selectdrop)


#        border = wxBoxSizer(wxHORIZONTAL)
#        border.Add(mainSizer, 1, wxEXPAND | wxALL, 0)
        panel.SetSizer(mainSizer)
        panel.SetAutoLayout(True)
        #        border.Fit(panel)
        mainSizer.Fit(panel)
        frame.Fit()
        frame.Show(True)

        EVT_INVOKE(frame, self.onInvoke)
        wx.EVT_CLOSE(frame, self._close)
예제 #8
0
    def __init__(self, config, calls):
        self.config = config
        self.calls = calls

        self.uiflag = threading.Event()
        self.cancelflag = threading.Event()
        self.switchlock = threading.Lock()
        self.working = False
        self.queue = []
        wx.wxInitAllImageHandlers()
        self.thostselection = self.calls['getCurrentTHost']()
        self.thostselectnum = 0
        self.choices = None
        self.choices1 = None

        self.windowStyle = wx.wxSYSTEM_MENU | wx.wxCAPTION | wx.wxMINIMIZE_BOX
        if self.config['stayontop']:
            self.windowStyle |= wx.wxSTAY_ON_TOP
        frame = wx.wxFrame(None,
                           -1,
                           'T-Make',
                           size=wx.wxSize(-1, -1),
                           style=self.windowStyle)
        self.frame = frame
        panel = wx.wxPanel(frame, -1)

        fullSizer = wx.wxFlexGridSizer(cols=1, vgap=0, hgap=8)

        colSizer = wx.wxFlexGridSizer(cols=2, vgap=0, hgap=8)
        leftSizer = wx.wxFlexGridSizer(cols=1, vgap=3)

        self.stayontop_checkbox = wx.wxCheckBox(panel, -1, "stay on top")
        self.stayontop_checkbox.SetValue(self.config['stayontop'])
        wx.EVT_CHECKBOX(frame, self.stayontop_checkbox.GetId(),
                        self.setstayontop)
        leftSizer.Add(self.stayontop_checkbox, -1, wx.wxALIGN_CENTER)
        leftSizer.Add(wx.wxStaticText(panel, -1, ''))

        button = wx.wxButton(panel, -1, 'use image...')
        wx.EVT_BUTTON(frame, button.GetId(), self.selectDropTarget)
        leftSizer.Add(button, -1, wx.wxALIGN_CENTER)

        self.groupSizer1Box = wx.wxStaticBox(panel, -1, '')
        groupSizer1 = wx.wxStaticBoxSizer(self.groupSizer1Box, wx.wxHORIZONTAL)
        groupSizer = wx.wxFlexGridSizer(cols=1, vgap=0)
        self.dropTarget = self.calls['newDropTarget']((200, 200))
        #        self.dropTarget = self.calls['newDropTarget']()
        self.dropTargetPtr = wx.wxStaticBitmap(panel, -1, self.dropTarget)
        self.calls['setDropTargetRefresh'](self.dropTargetPtr.Refresh)
        self.dropTargetWidth = self.dropTarget.GetWidth()
        wx.EVT_LEFT_DOWN(self.dropTargetPtr, self.dropTargetClick)
        wx.EVT_ENTER_WINDOW(self.dropTargetPtr,
                            self.calls['dropTargetHovered'])
        wx.EVT_LEAVE_WINDOW(self.dropTargetPtr,
                            self.calls['dropTargetUnhovered'])
        groupSizer.Add(self.dropTargetPtr, 0, wx.wxALIGN_CENTER)
        lowerSizer1 = wx.wxGridSizer(cols=3)
        dirlink = wx.wxStaticText(panel, -1, 'dir')
        dirlink.SetFont(
            wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        dirlink.SetForegroundColour('blue')
        wx.EVT_LEFT_UP(dirlink, self.selectdir)
        lowerSizer1.Add(dirlink, -1, wx.wxALIGN_LEFT)
        lowerSizer1.Add(wx.wxStaticText(panel, -1, ''), -1, wx.wxALIGN_CENTER)
        filelink = wx.wxStaticText(panel, -1, 'file')
        filelink.SetFont(
            wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        filelink.SetForegroundColour('blue')
        wx.EVT_LEFT_UP(filelink, self.selectfile)
        lowerSizer1.Add(filelink, -1, wx.wxALIGN_RIGHT)

        groupSizer.Add(lowerSizer1, -1, wx.wxALIGN_CENTER)

        self.gauge = wx.wxGauge(panel,
                                -1,
                                range=1000,
                                style=wx.wxGA_HORIZONTAL,
                                size=(-1, 15))
        groupSizer.Add(self.gauge, 0, wx.wxEXPAND)
        self.statustext = wx.wxStaticText(panel,
                                          -1,
                                          'ready',
                                          style=wx.wxALIGN_CENTER
                                          | wx.wxST_NO_AUTORESIZE)
        self.statustext.SetFont(
            wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxBOLD, False))
        groupSizer.Add(self.statustext, -1, wx.wxEXPAND)
        self.choices = wx.wxChoice(panel,
                                   -1, (-1, -1), (self.dropTargetWidth, -1),
                                   choices=[])
        self.choices.SetFont(
            wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, False))
        wx.EVT_CHOICE(self.choices, -1, self.set_thost)
        groupSizer.Add(self.choices, 0, wx.wxEXPAND)
        cancellink = wx.wxStaticText(panel, -1, 'cancel')
        cancellink.SetFont(
            wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        cancellink.SetForegroundColour('red')
        wx.EVT_LEFT_UP(cancellink, self.cancel)
        groupSizer.Add(cancellink, -1, wx.wxALIGN_CENTER)
        dummyadvlink = wx.wxStaticText(panel, -1, 'advanced')
        dummyadvlink.SetFont(
            wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, False))
        dummyadvlink.SetForegroundColour('blue')
        wx.EVT_LEFT_UP(dirlink, self.selectdir)
        groupSizer.Add(dummyadvlink, -1, wx.wxALIGN_CENTER)
        groupSizer1.Add(groupSizer)
        leftSizer.Add(groupSizer1, -1, wx.wxALIGN_CENTER)

        leftSizer.Add(wx.wxStaticText(panel, -1, 'make torrent of:'), 0,
                      wx.wxALIGN_CENTER)

        self.dirCtl = wx.wxTextCtrl(panel, -1, '', size=(250, -1))
        leftSizer.Add(self.dirCtl, 1, wx.wxEXPAND)

        b = wx.wxBoxSizer(wx.wxHORIZONTAL)
        button = wx.wxButton(panel, -1, 'dir')
        wx.EVT_BUTTON(frame, button.GetId(), self.selectdir)
        b.Add(button, 0)

        button2 = wx.wxButton(panel, -1, 'file')
        wx.EVT_BUTTON(frame, button2.GetId(), self.selectfile)
        b.Add(button2, 0)

        leftSizer.Add(b, 0, wx.wxALIGN_CENTER)

        leftSizer.Add(wx.wxStaticText(panel, -1, ''))

        simple_link = wx.wxStaticText(panel, -1, 'back to basic mode')
        simple_link.SetFont(
            wx.wxFont(-1, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        simple_link.SetForegroundColour('blue')
        wx.EVT_LEFT_UP(simple_link, self.calls['switchToBasic'])
        leftSizer.Add(simple_link, -1, wx.wxALIGN_CENTER)

        colSizer.Add(leftSizer, -1, wx.wxALIGN_CENTER_VERTICAL)

        gridSizer = wx.wxFlexGridSizer(cols=2, vgap=6, hgap=8)

        gridSizer.Add(wx.wxStaticText(panel, -1, 'Torrent host:'), -1,
                      wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL)

        self.choices1 = wx.wxChoice(panel, -1, (-1, -1), (-1, -1), choices=[])
        wx.EVT_CHOICE(self.choices1, -1, self.set_thost1)
        gridSizer.Add(self.choices1, 0, wx.wxEXPAND)

        b = wx.wxBoxSizer(wx.wxHORIZONTAL)
        button1 = wx.wxButton(panel, -1, 'set default')
        wx.EVT_BUTTON(frame, button1.GetId(), self.set_default_thost)
        b.Add(button1, 0)
        b.Add(wx.wxStaticText(panel, -1, '       '))
        button2 = wx.wxButton(panel, -1, 'delete')
        wx.EVT_BUTTON(frame, button2.GetId(), self.delete_thost)
        b.Add(button2, 0)
        b.Add(wx.wxStaticText(panel, -1, '       '))
        button3 = wx.wxButton(panel, -1, 'save as...')
        wx.EVT_BUTTON(frame, button3.GetId(), self.save_thost)
        b.Add(button3, 0)

        gridSizer.Add(wx.wxStaticText(panel, -1, ''))
        gridSizer.Add(b, 0, wx.wxALIGN_CENTER)

        gridSizer.Add(wx.wxStaticText(panel, -1, ''))
        gridSizer.Add(wx.wxStaticText(panel, -1, ''))

        gridSizer.Add(wx.wxStaticText(panel, -1, 'single tracker url:'), 0,
                      wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL)
        self.annCtl = wx.wxTextCtrl(panel, -1,
                                    'http://my.tracker:6969/announce')
        gridSizer.Add(self.annCtl, 0, wx.wxEXPAND)

        a = wx.wxFlexGridSizer(cols=1, vgap=3)
        a.Add(wx.wxStaticText(panel, -1, 'tracker list:'), 0, wx.wxALIGN_RIGHT)
        a.Add(wx.wxStaticText(panel, -1, ''))
        abutton = wx.wxButton(panel,
                              -1,
                              'copy\nannounces\nfrom\ntorrent',
                              size=(70, 70))
        wx.EVT_BUTTON(frame, abutton.GetId(), self.announcecopy)
        a.Add(abutton, -1, wx.wxALIGN_CENTER)
        a.Add(wx.wxStaticText(panel, -1, DROP_HERE), -1, wx.wxALIGN_CENTER)
        gridSizer.Add(a, -1, wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL)

        self.annListCtl = wx.wxTextCtrl(
            panel, -1, '\n\n\n\n\n', wx.wxPoint(-1, -1), (300, 120),
            wx.wxTE_MULTILINE | wx.wxHSCROLL | wx.wxTE_DONTWRAP)
        gridSizer.Add(self.annListCtl, -1, wx.wxEXPAND)

        gridSizer.Add(wx.wxStaticText(panel, -1, ''))
        exptext = wx.wxStaticText(
            panel, -1, 'a list of tracker urls separated by commas or '
            'whitespace\nand on several lines -trackers on the same line will '
            'be\ntried randomly, and all the trackers on one line\nwill be '
            'tried before the trackers on the next line.')
        exptext.SetFont(
            wx.wxFont(6, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, False))
        gridSizer.Add(exptext, -1, wx.wxALIGN_CENTER)

        self.refresh_thostlist()
        self._set_thost()

        if sys.platform == 'win32':
            self.dropTargetPtr.DragAcceptFiles(True)
            wx.EVT_DROP_FILES(self.dropTargetPtr, self.selectdrop)
            self.groupSizer1Box.DragAcceptFiles(True)
            wx.EVT_DROP_FILES(self.groupSizer1Box, self.selectdrop)
            abutton.DragAcceptFiles(True)
            wx.EVT_DROP_FILES(abutton, self.announcedrop)
            self.annCtl.DragAcceptFiles(True)
            wx.EVT_DROP_FILES(self.annCtl, self.announcedrop)
            self.annListCtl.DragAcceptFiles(True)
            wx.EVT_DROP_FILES(self.annListCtl, self.announcedrop)

        gridSizer.Add(wx.wxStaticText(panel, -1, ''))
        gridSizer.Add(wx.wxStaticText(panel, -1, ''))

        gridSizer.Add(wx.wxStaticText(panel, -1, 'piece size:'), 0,
                      wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL)
        self.piece_length = wx.wxChoice(panel,
                                        -1,
                                        choices=[
                                            'automatic', '2MiB', '1MiB',
                                            '512KiB', '256KiB', '128KiB',
                                            '64KiB', '32KiB'
                                        ])
        self.piece_length_list = [0, 21, 20, 19, 18, 17, 16, 15]
        self.piece_length.SetSelection(0)
        gridSizer.Add(self.piece_length)

        gridSizer.Add(wx.wxStaticText(panel, -1, 'comment:'), 0,
                      wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL)
        self.commentCtl = wx.wxTextCtrl(panel, -1, '')
        gridSizer.Add(self.commentCtl, 0, wx.wxEXPAND)

        gridSizer.Add(wx.wxStaticText(panel, -1, ''))
        gridSizer.Add(wx.wxStaticText(panel, -1, ''))

        b1 = wx.wxButton(panel, -1, 'Cancel', size=(-1, 30))
        wx.EVT_BUTTON(frame, b1.GetId(), self.cancel)
        gridSizer.Add(b1, 0, wx.wxEXPAND)
        b2 = wx.wxButton(panel, -1, 'MAKE TORRENT', size=(-1, 30))
        wx.EVT_BUTTON(frame, b2.GetId(), self.complete)
        gridSizer.Add(b2, 0, wx.wxEXPAND)

        gridSizer.AddGrowableCol(1)
        colSizer.Add(gridSizer, -1, wx.wxALIGN_CENTER_VERTICAL)
        fullSizer.Add(colSizer)

        border = wx.wxBoxSizer(wx.wxHORIZONTAL)
        border.Add(fullSizer, 1, wx.wxEXPAND | wx.wxALL, 15)
        panel.SetSizer(border)
        panel.SetAutoLayout(True)
        border.Fit(panel)
        frame.Fit()
        frame.Show(True)

        EVT_INVOKE(frame, self.onInvoke)
        wx.EVT_CLOSE(frame, self._close)
예제 #9
0
    def __init__(self, config, calls):
        self.config = config
        self.calls = calls

        self.uiflag = threading.Event()
        self.cancelflag = threading.Event()
        self.switchlock = threading.Lock()
        self.working = False
        self.queue = []
        wx.wxInitAllImageHandlers()
        self.thostselection = self.calls["getCurrentTHost"]()
        self.thostselectnum = 0
        self.choices = None
        self.choices1 = None
        self.announce = ""
        self.announce_list = None

        self.windowStyle = wx.wxSYSTEM_MENU | wx.wxCAPTION | wx.wxMINIMIZE_BOX
        if self.config["stayontop"]:
            self.windowStyle |= wx.wxSTAY_ON_TOP
        frame = wx.wxFrame(None, -1, "T-Make", size=wx.wxSize(-1, -1), style=self.windowStyle)
        self.frame = frame
        panel = wx.wxPanel(frame, -1)
        mainSizer = wx.wxBoxSizer(wx.wxVERTICAL)
        groupSizer = wx.wxFlexGridSizer(cols=1, vgap=0, hgap=0)
        #        self.dropTarget = self.calls['newDropTarget']((200, 200))
        self.dropTarget = self.calls["newDropTarget"]()
        self.dropTargetPtr = wx.wxStaticBitmap(panel, -1, self.dropTarget)
        self.calls["setDropTargetRefresh"](self.dropTargetPtr.Refresh)
        self.dropTargetWidth = self.dropTarget.GetWidth()
        wx.EVT_LEFT_DOWN(self.dropTargetPtr, self.dropTargetClick)
        wx.EVT_ENTER_WINDOW(self.dropTargetPtr, self.calls["dropTargetHovered"])
        wx.EVT_LEAVE_WINDOW(self.dropTargetPtr, self.calls["dropTargetUnhovered"])
        groupSizer.Add(self.dropTargetPtr, 0, wx.wxALIGN_CENTER)
        lowerSizer1 = wx.wxGridSizer(cols=6)
        dirlink = wx.wxStaticText(panel, -1, "dir")
        dirlink.SetFont(wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        dirlink.SetForegroundColour("blue")
        wx.EVT_LEFT_UP(dirlink, self.selectdir)
        lowerSizer1.Add(dirlink, -1, wx.wxALIGN_LEFT)
        lowerSizer1.Add(wx.wxStaticText(panel, -1, ""), -1, wx.wxALIGN_CENTER)
        lowerSizer1.Add(wx.wxStaticText(panel, -1, ""), -1, wx.wxALIGN_CENTER)
        lowerSizer1.Add(wx.wxStaticText(panel, -1, ""), -1, wx.wxALIGN_CENTER)
        lowerSizer1.Add(wx.wxStaticText(panel, -1, ""), -1, wx.wxALIGN_CENTER)
        filelink = wx.wxStaticText(panel, -1, "file")
        filelink.SetFont(wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        filelink.SetForegroundColour("blue")
        wx.EVT_LEFT_UP(filelink, self.selectfile)
        lowerSizer1.Add(filelink, -1, wx.wxALIGN_RIGHT)

        groupSizer.Add(lowerSizer1, -1, wx.wxALIGN_CENTER)

        self.gauge = wx.wxGauge(panel, -1, range=1000, style=wx.wxGA_HORIZONTAL, size=(-1, 15))
        groupSizer.Add(self.gauge, 0, wx.wxEXPAND)
        self.statustext = wx.wxStaticText(panel, -1, "ready", style=wx.wxALIGN_CENTER | wx.wxST_NO_AUTORESIZE)
        self.statustext.SetFont(wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxBOLD, False))
        groupSizer.Add(self.statustext, -1, wx.wxEXPAND)
        self.choices = wx.wxChoice(panel, -1, (-1, -1), (self.dropTargetWidth, -1), choices=[])
        self.choices.SetFont(wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, False))
        wx.EVT_CHOICE(self.choices, -1, self.set_thost)
        groupSizer.Add(self.choices, 0, wx.wxEXPAND)
        cancellink = wx.wxStaticText(panel, -1, "cancel")
        cancellink.SetFont(wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        cancellink.SetForegroundColour("red")
        wx.EVT_LEFT_UP(cancellink, self.cancel)
        groupSizer.Add(cancellink, -1, wx.wxALIGN_CENTER)
        advlink = wx.wxStaticText(panel, -1, "advanced")
        advlink.SetFont(wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        advlink.SetForegroundColour("blue")
        wx.EVT_LEFT_UP(advlink, self.calls["switchToAdvanced"])
        groupSizer.Add(advlink, -1, wx.wxALIGN_CENTER)
        mainSizer.Add(groupSizer, 0, wx.wxALIGN_CENTER)

        self.refresh_thostlist()
        self._set_thost()

        if sys.platform == "win32":
            self.dropTargetPtr.DragAcceptFiles(True)
            wx.EVT_DROP_FILES(self.dropTargetPtr, self.selectdrop)

        #        border = wxBoxSizer(wxHORIZONTAL)
        #        border.Add(mainSizer, 1, wxEXPAND | wxALL, 0)
        panel.SetSizer(mainSizer)
        panel.SetAutoLayout(True)
        #        border.Fit(panel)
        mainSizer.Fit(panel)
        frame.Fit()
        frame.Show(True)

        EVT_INVOKE(frame, self.onInvoke)
        wx.EVT_CLOSE(frame, self._close)
예제 #10
0
    def __init__(self, config, calls):
        self.config = config
        self.calls = calls

        self.uiflag = threading.Event()
        self.cancelflag = threading.Event()
        self.switchlock = threading.Lock()
        self.working = False
        self.queue = []
        wx.wxInitAllImageHandlers()
        self.thostselection = self.calls["getCurrentTHost"]()
        self.thostselectnum = 0
        self.choices = None
        self.choices1 = None

        self.windowStyle = wx.wxSYSTEM_MENU | wx.wxCAPTION | wx.wxMINIMIZE_BOX
        if self.config["stayontop"]:
            self.windowStyle |= wx.wxSTAY_ON_TOP
        frame = wx.wxFrame(None, -1, "T-Make", size=wx.wxSize(-1, -1), style=self.windowStyle)
        self.frame = frame
        panel = wx.wxPanel(frame, -1)

        fullSizer = wx.wxFlexGridSizer(cols=1, vgap=0, hgap=8)

        colSizer = wx.wxFlexGridSizer(cols=2, vgap=0, hgap=8)
        leftSizer = wx.wxFlexGridSizer(cols=1, vgap=3)

        self.stayontop_checkbox = wx.wxCheckBox(panel, -1, "stay on top")
        self.stayontop_checkbox.SetValue(self.config["stayontop"])
        wx.EVT_CHECKBOX(frame, self.stayontop_checkbox.GetId(), self.setstayontop)
        leftSizer.Add(self.stayontop_checkbox, -1, wx.wxALIGN_CENTER)
        leftSizer.Add(wx.wxStaticText(panel, -1, ""))

        button = wx.wxButton(panel, -1, "use image...")
        wx.EVT_BUTTON(frame, button.GetId(), self.selectDropTarget)
        leftSizer.Add(button, -1, wx.wxALIGN_CENTER)

        self.groupSizer1Box = wx.wxStaticBox(panel, -1, "")
        groupSizer1 = wx.wxStaticBoxSizer(self.groupSizer1Box, wx.wxHORIZONTAL)
        groupSizer = wx.wxFlexGridSizer(cols=1, vgap=0)
        self.dropTarget = self.calls["newDropTarget"]((200, 200))
        #        self.dropTarget = self.calls['newDropTarget']()
        self.dropTargetPtr = wx.wxStaticBitmap(panel, -1, self.dropTarget)
        self.calls["setDropTargetRefresh"](self.dropTargetPtr.Refresh)
        self.dropTargetWidth = self.dropTarget.GetWidth()
        wx.EVT_LEFT_DOWN(self.dropTargetPtr, self.dropTargetClick)
        wx.EVT_ENTER_WINDOW(self.dropTargetPtr, self.calls["dropTargetHovered"])
        wx.EVT_LEAVE_WINDOW(self.dropTargetPtr, self.calls["dropTargetUnhovered"])
        groupSizer.Add(self.dropTargetPtr, 0, wx.wxALIGN_CENTER)
        lowerSizer1 = wx.wxGridSizer(cols=3)
        dirlink = wx.wxStaticText(panel, -1, "dir")
        dirlink.SetFont(wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        dirlink.SetForegroundColour("blue")
        wx.EVT_LEFT_UP(dirlink, self.selectdir)
        lowerSizer1.Add(dirlink, -1, wx.wxALIGN_LEFT)
        lowerSizer1.Add(wx.wxStaticText(panel, -1, ""), -1, wx.wxALIGN_CENTER)
        filelink = wx.wxStaticText(panel, -1, "file")
        filelink.SetFont(wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        filelink.SetForegroundColour("blue")
        wx.EVT_LEFT_UP(filelink, self.selectfile)
        lowerSizer1.Add(filelink, -1, wx.wxALIGN_RIGHT)

        groupSizer.Add(lowerSizer1, -1, wx.wxALIGN_CENTER)

        self.gauge = wx.wxGauge(panel, -1, range=1000, style=wx.wxGA_HORIZONTAL, size=(-1, 15))
        groupSizer.Add(self.gauge, 0, wx.wxEXPAND)
        self.statustext = wx.wxStaticText(panel, -1, "ready", style=wx.wxALIGN_CENTER | wx.wxST_NO_AUTORESIZE)
        self.statustext.SetFont(wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxBOLD, False))
        groupSizer.Add(self.statustext, -1, wx.wxEXPAND)
        self.choices = wx.wxChoice(panel, -1, (-1, -1), (self.dropTargetWidth, -1), choices=[])
        self.choices.SetFont(wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, False))
        wx.EVT_CHOICE(self.choices, -1, self.set_thost)
        groupSizer.Add(self.choices, 0, wx.wxEXPAND)
        cancellink = wx.wxStaticText(panel, -1, "cancel")
        cancellink.SetFont(wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        cancellink.SetForegroundColour("red")
        wx.EVT_LEFT_UP(cancellink, self.cancel)
        groupSizer.Add(cancellink, -1, wx.wxALIGN_CENTER)
        dummyadvlink = wx.wxStaticText(panel, -1, "advanced")
        dummyadvlink.SetFont(wx.wxFont(7, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, False))
        dummyadvlink.SetForegroundColour("blue")
        wx.EVT_LEFT_UP(dirlink, self.selectdir)
        groupSizer.Add(dummyadvlink, -1, wx.wxALIGN_CENTER)
        groupSizer1.Add(groupSizer)
        leftSizer.Add(groupSizer1, -1, wx.wxALIGN_CENTER)

        leftSizer.Add(wx.wxStaticText(panel, -1, "make torrent of:"), 0, wx.wxALIGN_CENTER)

        self.dirCtl = wx.wxTextCtrl(panel, -1, "", size=(250, -1))
        leftSizer.Add(self.dirCtl, 1, wx.wxEXPAND)

        b = wx.wxBoxSizer(wx.wxHORIZONTAL)
        button = wx.wxButton(panel, -1, "dir")
        wx.EVT_BUTTON(frame, button.GetId(), self.selectdir)
        b.Add(button, 0)

        button2 = wx.wxButton(panel, -1, "file")
        wx.EVT_BUTTON(frame, button2.GetId(), self.selectfile)
        b.Add(button2, 0)

        leftSizer.Add(b, 0, wx.wxALIGN_CENTER)

        leftSizer.Add(wx.wxStaticText(panel, -1, ""))

        simple_link = wx.wxStaticText(panel, -1, "back to basic mode")
        simple_link.SetFont(wx.wxFont(-1, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, True))
        simple_link.SetForegroundColour("blue")
        wx.EVT_LEFT_UP(simple_link, self.calls["switchToBasic"])
        leftSizer.Add(simple_link, -1, wx.wxALIGN_CENTER)

        colSizer.Add(leftSizer, -1, wx.wxALIGN_CENTER_VERTICAL)

        gridSizer = wx.wxFlexGridSizer(cols=2, vgap=6, hgap=8)

        gridSizer.Add(wx.wxStaticText(panel, -1, "Torrent host:"), -1, wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL)

        self.choices1 = wx.wxChoice(panel, -1, (-1, -1), (-1, -1), choices=[])
        wx.EVT_CHOICE(self.choices1, -1, self.set_thost1)
        gridSizer.Add(self.choices1, 0, wx.wxEXPAND)

        b = wx.wxBoxSizer(wx.wxHORIZONTAL)
        button1 = wx.wxButton(panel, -1, "set default")
        wx.EVT_BUTTON(frame, button1.GetId(), self.set_default_thost)
        b.Add(button1, 0)
        b.Add(wx.wxStaticText(panel, -1, "       "))
        button2 = wx.wxButton(panel, -1, "delete")
        wx.EVT_BUTTON(frame, button2.GetId(), self.delete_thost)
        b.Add(button2, 0)
        b.Add(wx.wxStaticText(panel, -1, "       "))
        button3 = wx.wxButton(panel, -1, "save as...")
        wx.EVT_BUTTON(frame, button3.GetId(), self.save_thost)
        b.Add(button3, 0)

        gridSizer.Add(wx.wxStaticText(panel, -1, ""))
        gridSizer.Add(b, 0, wx.wxALIGN_CENTER)

        gridSizer.Add(wx.wxStaticText(panel, -1, ""))
        gridSizer.Add(wx.wxStaticText(panel, -1, ""))

        gridSizer.Add(
            wx.wxStaticText(panel, -1, "single tracker url:"), 0, wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL
        )
        self.annCtl = wx.wxTextCtrl(panel, -1, "http://my.tracker:6969/announce")
        gridSizer.Add(self.annCtl, 0, wx.wxEXPAND)

        a = wx.wxFlexGridSizer(cols=1, vgap=3)
        a.Add(wx.wxStaticText(panel, -1, "tracker list:"), 0, wx.wxALIGN_RIGHT)
        a.Add(wx.wxStaticText(panel, -1, ""))
        abutton = wx.wxButton(panel, -1, "copy\nannounces\nfrom\ntorrent", size=(70, 70))
        wx.EVT_BUTTON(frame, abutton.GetId(), self.announcecopy)
        a.Add(abutton, -1, wx.wxALIGN_CENTER)
        a.Add(wx.wxStaticText(panel, -1, DROP_HERE), -1, wx.wxALIGN_CENTER)
        gridSizer.Add(a, -1, wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL)

        self.annListCtl = wx.wxTextCtrl(
            panel, -1, "\n\n\n\n\n", wx.wxPoint(-1, -1), (300, 120), wx.wxTE_MULTILINE | wx.wxHSCROLL | wx.wxTE_DONTWRAP
        )
        gridSizer.Add(self.annListCtl, -1, wx.wxEXPAND)

        gridSizer.Add(wx.wxStaticText(panel, -1, ""))
        exptext = wx.wxStaticText(
            panel,
            -1,
            "a list of tracker urls separated by commas or "
            "whitespace\nand on several lines -trackers on the same line will "
            "be\ntried randomly, and all the trackers on one line\nwill be "
            "tried before the trackers on the next line.",
        )
        exptext.SetFont(wx.wxFont(6, wx.wxDEFAULT, wx.wxNORMAL, wx.wxNORMAL, False))
        gridSizer.Add(exptext, -1, wx.wxALIGN_CENTER)

        self.refresh_thostlist()
        self._set_thost()

        if sys.platform == "win32":
            self.dropTargetPtr.DragAcceptFiles(True)
            wx.EVT_DROP_FILES(self.dropTargetPtr, self.selectdrop)
            self.groupSizer1Box.DragAcceptFiles(True)
            wx.EVT_DROP_FILES(self.groupSizer1Box, self.selectdrop)
            abutton.DragAcceptFiles(True)
            wx.EVT_DROP_FILES(abutton, self.announcedrop)
            self.annCtl.DragAcceptFiles(True)
            wx.EVT_DROP_FILES(self.annCtl, self.announcedrop)
            self.annListCtl.DragAcceptFiles(True)
            wx.EVT_DROP_FILES(self.annListCtl, self.announcedrop)

        gridSizer.Add(wx.wxStaticText(panel, -1, ""))
        gridSizer.Add(wx.wxStaticText(panel, -1, ""))

        gridSizer.Add(wx.wxStaticText(panel, -1, "piece size:"), 0, wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL)
        self.piece_length = wx.wxChoice(
            panel, -1, choices=["automatic", "2MiB", "1MiB", "512KiB", "256KiB", "128KiB", "64KiB", "32KiB"]
        )
        self.piece_length_list = [0, 21, 20, 19, 18, 17, 16, 15]
        self.piece_length.SetSelection(0)
        gridSizer.Add(self.piece_length)

        gridSizer.Add(wx.wxStaticText(panel, -1, "comment:"), 0, wx.wxALIGN_RIGHT | wx.wxALIGN_CENTER_VERTICAL)
        self.commentCtl = wx.wxTextCtrl(panel, -1, "")
        gridSizer.Add(self.commentCtl, 0, wx.wxEXPAND)

        gridSizer.Add(wx.wxStaticText(panel, -1, ""))
        gridSizer.Add(wx.wxStaticText(panel, -1, ""))

        b1 = wx.wxButton(panel, -1, "Cancel", size=(-1, 30))
        wx.EVT_BUTTON(frame, b1.GetId(), self.cancel)
        gridSizer.Add(b1, 0, wx.wxEXPAND)
        b2 = wx.wxButton(panel, -1, "MAKE TORRENT", size=(-1, 30))
        wx.EVT_BUTTON(frame, b2.GetId(), self.complete)
        gridSizer.Add(b2, 0, wx.wxEXPAND)

        gridSizer.AddGrowableCol(1)
        colSizer.Add(gridSizer, -1, wx.wxALIGN_CENTER_VERTICAL)
        fullSizer.Add(colSizer)

        border = wx.wxBoxSizer(wx.wxHORIZONTAL)
        border.Add(fullSizer, 1, wx.wxEXPAND | wx.wxALL, 15)
        panel.SetSizer(border)
        panel.SetAutoLayout(True)
        border.Fit(panel)
        frame.Fit()
        frame.Show(True)

        EVT_INVOKE(frame, self.onInvoke)
        wx.EVT_CLOSE(frame, self._close)