示例#1
0
    def save_thost(self, x):
        if not self.annCtl.GetValue():
            dlg = wx.wxMessageDialog(
                self.frame,
                message='You must specify a\nsingle tracker url',
                caption='Error',
                style=wx.wxOK | wx.wxICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            return
        try:
            metainfo = {}
            metainfo['announce'] = self.annCtl.GetValue()
            annlist = self.getannouncelist()
            if len(annlist) > 0:
                warnings = ''
                for tier in annlist:
                    if len(tier) > 1:
                        warnings += 'WARNING: You should not specify ' \
                            'multiple trackers\n     on the same line of ' \
                            'the tracker list unless\n     you are certain ' \
                            'they share peer data.\n'
                        break
                if not self.annCtl.GetValue() in annlist[0]:
                    warnings += 'WARNING: The single tracker url is not ' \
                        'present in\n     the first line of the tracker ' \
                        'list.  This\n     may produce a dysfunctional ' \
                        'torrent.\n'
                if warnings:
                    warnings += 'Are you sure you wish to save a torrent ' \
                        'host\nwith these parameters?'
                    dlg = wx.wxMessageDialog(self.frame,
                                             message=warnings,
                                             caption='Warning',
                                             style=wx.wxYES_NO
                                             | wx.wxICON_QUESTION)
                    if dlg.ShowModal() != wx.wxID_YES:
                        dlg.Destroy()
                        return
                metainfo['announce-list'] = annlist
        except:
            return

        if self.thostselectnum:
            d = self.thostselection
        else:
            d = '.thost'
        dl = wx.wxFileDialog(self.frame, 'Save tracker data as',
                             os.path.join(basepath, 'thosts'), d, '*.thost',
                             wx.wxSAVE | wx.wxOVERWRITE_PROMPT)
        if dl.ShowModal() != wx.wxID_OK:
            return
        d = dl.GetPath()

        try:
            metainfo.write(d)
            garbage, self.thostselection = os.path.split(d)
        except:
            pass
        self.refresh_thostlist()
示例#2
0
 def complete(self, x):
     if not self.dirCtl.GetValue():
         dlg = wx.wxMessageDialog(
             self.frame,
             message='You must select a\nfile or directory',
             caption='Error',
             style=wx.wxOK | wx.wxICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
     if not self.annCtl.GetValue():
         dlg = wx.wxMessageDialog(
             self.frame,
             message='You must specify a\nsingle tracker url',
             caption='Error',
             style=wx.wxOK | wx.wxICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
     params = {
         'piece_size_pow2':
         self.piece_length_list[self.piece_length.GetSelection()]
     }
     annlist = self.getannouncelist()
     if len(annlist) > 0:
         warnings = ''
         for tier in annlist:
             if len(tier) > 1:
                 warnings += (
                     'WARNING: You should not specify multiple trackers\n' +
                     '     on the same line of the tracker list unless\n' +
                     '     you are certain they share peer data.\n')
                 break
         if not self.annCtl.GetValue() in annlist[0]:
             warnings += (
                 'WARNING: The single tracker url is not present in\n' +
                 '     the first line of the tracker list.  This\n' +
                 '     may produce a dysfunctional torrent.\n')
         if warnings:
             warnings += ('Are you sure you wish to produce a .torrent\n' +
                          'with these parameters?')
             dlg = wx.wxMessageDialog(self.frame,
                                      message=warnings,
                                      caption='Warning',
                                      style=wx.wxYES_NO
                                      | wx.wxICON_QUESTION)
             if dlg.ShowModal() != wx.wxID_YES:
                 dlg.Destroy()
                 return
         params['real_announce_list'] = annlist
     comment = self.commentCtl.GetValue()
     if comment != '':
         params['comment'] = comment
     self.statustext.SetLabel('working')
     self.queue.append(
         (self.dirCtl.GetValue(), self.annCtl.GetValue(), params))
     self.go_queue()
示例#3
0
 def complete(self, x):
     if not self.dirCtl.GetValue():
         dlg = wx.wxMessageDialog(
             self.frame,
             message="You must select a\nfile or directory",
             caption="Error",
             style=wx.wxOK | wx.wxICON_ERROR,
         )
         dlg.ShowModal()
         dlg.Destroy()
         return
     if not self.annCtl.GetValue():
         dlg = wx.wxMessageDialog(
             self.frame,
             message="You must specify a\nsingle tracker url",
             caption="Error",
             style=wx.wxOK | wx.wxICON_ERROR,
         )
         dlg.ShowModal()
         dlg.Destroy()
         return
     params = {"piece_size_pow2": self.piece_length_list[self.piece_length.GetSelection()]}
     annlist = self.getannouncelist()
     if len(annlist) > 0:
         warnings = ""
         for tier in annlist:
             if len(tier) > 1:
                 warnings += (
                     "WARNING: You should not specify multiple trackers\n"
                     + "     on the same line of the tracker list unless\n"
                     + "     you are certain they share peer data.\n"
                 )
                 break
         if not self.annCtl.GetValue() in annlist[0]:
             warnings += (
                 "WARNING: The single tracker url is not present in\n"
                 + "     the first line of the tracker list.  This\n"
                 + "     may produce a dysfunctional torrent.\n"
             )
         if warnings:
             warnings += "Are you sure you wish to produce a .torrent\n" + "with these parameters?"
             dlg = wx.wxMessageDialog(
                 self.frame, message=warnings, caption="Warning", style=wx.wxYES_NO | wx.wxICON_QUESTION
             )
             if dlg.ShowModal() != wx.wxID_YES:
                 dlg.Destroy()
                 return
         params["real_announce_list"] = annlist
     comment = self.commentCtl.GetValue()
     if comment != "":
         params["comment"] = comment
     self.statustext.SetLabel("working")
     self.queue.append((self.dirCtl.GetValue(), self.annCtl.GetValue(), params))
     self.go_queue()
示例#4
0
 def print_preview(self):
     """Print-preview current plot."""
     printout = graph_printout(self)
     printout2 = graph_printout(self)
     self.preview = wx.wxPrintPreview(printout, printout2, self.print_data)
     if not self.preview.Ok():
         wx.wxMessageDialog(self, "Print Preview failed.\n" \
                            "Check that default printer is configured\n", \
                            "Print error", wx.wxOK|wx.wxCENTRE).ShowModal()
     else:
         frame = wx.wxPreviewFrame(self.preview, self.parent, "Preview")
         frame.Initialize()
         frame.SetPosition(self.GetPosition())
         frame.SetSize(self.GetSize())
         frame.Show(wx.true)
示例#5
0
 def OnAbout(self, event):
     # Create a message dialog box
     dialog = wxMessageDialog(self, " slashManager is a Unix-oriented file manager\n"
                              " written in wxPython.",
                              "About slashManager", wxOK | wxICON_INFORMATION)
     dialog.ShowModal() # Shows it
     dialog.Destroy()   # finally destroy it when finished
示例#6
0
 def file_save_as(self, event):
     import os
     wildcard = "PNG files (*.png)|*.png|" \
                "BMP files (*.bmp)|*.bmp|" \
                "JPEG files (*.jpg)|*.jpg|" \
                "PCX files (*.pcx)|*.pcx|" \
                "TIFF files (*.tif)|*.tif|" \
                "All Files |*|"
     dlg = wx.wxFileDialog(self, "Save As", ".", "", wildcard, wx.wxSAVE)
     if dlg.ShowModal() == wx.wxID_OK:
         f = dlg.GetPath()
         dummy, ftype = os.path.splitext(f)
         # strip .
         ftype = ftype[1:]
         if ftype in image_type_map.keys():
             self.client.save(dlg.GetPath(),ftype)
         else:
             msg = "Extension is currently used to determine file type." \
                   "'%s' is not a valid extension."  \
                   "You may use one of the following extensions. %s" \
                       % (ftype,image_type_map.keys())
             d = wx.wxMessageDialog(self,msg,style=wx.wxOK)
             d.ShowModal()
             d.Destroy()
     dlg.Destroy()
示例#7
0
def __wxpython(title, message):
    from wxPython.wx import wxApp, wxMessageDialog, wxOK, wxICON_EXCLAMATION
    class LameApp(wxApp):
        def OnInit(self): return 1
    app = LameApp()
    dlg = wxMessageDialog(None, message, title, wxOK|wxICON_EXCLAMATION)
    dlg.ShowModal()
    dlg.Destroy()
示例#8
0
 def failed(self, e):
     e = str(e)
     self.call.build_failed(e)
     dlg = wx.wxMessageDialog(self.frame,
                              message='Error - ' + e,
                              caption='Error',
                              style=wx.wxOK | wx.wxICON_ERROR)
     dlg.ShowModal()
     dlg.Destroy()
示例#9
0
 def on_buildfailed(self, e):
     dlg = wx.wxMessageDialog(self.frame,
                              message='Error - ' + e,
                              caption='Error',
                              style=wx.wxOK | wx.wxICON_ERROR)
     dlg.ShowModal()
     dlg.Destroy()
     self.gauge.SetValue(0)
     self.statustext.SetLabel('ERROR')
     self.calls['dropTargetError']()
     self.working = False
     self.go_queue()
示例#10
0
def __wxpythonbox(title, message):
    import wxPython.wx as wx

    class LameApp(wx.wxApp):
        def OnInit(self):
            return 1

    LameApp()
    dlg = wx.wxMessageDialog(None, message, title,
                             wx.wxOK | wx.wxICON_EXCLAMATION)
    dlg.ShowModal()
    dlg.Destroy()
示例#11
0
 def delete_thost(self, x):
     dlg = wx.wxMessageDialog(self.frame,
                              message='Are you sure you want to delete\n' +
                              self.thostselection[:-6] + '?',
                              caption='Warning',
                              style=wx.wxYES_NO | wx.wxICON_EXCLAMATION)
     if dlg.ShowModal() != wx.wxID_YES:
         dlg.Destroy()
         return
     dlg.Destroy()
     os.remove(os.path.join(basepath, 'thosts', self.thostselection))
     self.thostselection = None
     self.refresh_thostlist()
示例#12
0
 def complete(self, x):
     if self.dirCtl.GetValue() == '':
         dlg = wx.wxMessageDialog(
             self.frame, message='You must select a directory',
             caption='Error', style=(wx.wxOK | wx.wxICON_ERROR))
         dlg.ShowModal()
         dlg.Destroy()
         return
     try:
         ps = 2 ** (21 - self.piece_length.GetSelection())
         CompleteDir(self.dirCtl.GetValue(), self.annCtl.GetValue(), ps)
     except:
         print_exc()
示例#13
0
 def delete_thost(self, x):
     dlg = wx.wxMessageDialog(
         self.frame,
         message="Are you sure you want to delete\n" + self.thostselection[:-6] + "?",
         caption="Warning",
         style=wx.wxYES_NO | wx.wxICON_EXCLAMATION,
     )
     if dlg.ShowModal() != wx.wxID_YES:
         dlg.Destroy()
         return
     dlg.Destroy()
     os.remove(os.path.join(basepath, "thosts", self.thostselection))
     self.thostselection = None
     self.refresh_thostlist()
示例#14
0
 def complete(self):
     params = {'piece_size_pow2': self.pl}
     try:
         completedir(self.d, self.a, params, self.flag, self.valcallback,
                     self.filecallback)
         if not self.flag.isSet():
             self.currentLabel.SetLabel('Done!')
             self.gauge.SetValue(1000)
             self.button.SetLabel('Close')
     except (OSError, IOError) as e:
         self.currentLabel.SetLabel('Error!')
         self.button.SetLabel('Close')
         dlg = wx.wxMessageDialog(
             self.frame, message='Error - ' + str(e), caption='Error',
             style=(wx.wxOK | wx.wxICON_ERROR))
         dlg.ShowModal()
         dlg.Destroy()
示例#15
0
 def complete(self):
     try:
         if self.separatetorrents:
             completedir(self.d, self.a, self.params, self.flag,
                         self.valcallback, self.filecallback)
         else:
             make_meta_file(self.d, self.a, self.params, self.flag,
                            self.valcallback, progress_percent=1)
         if not self.flag.isSet():
             self.currentLabel.SetLabel('Done!')
             self.gauge.SetValue(1000)
             self.button.SetLabel('Close')
             self.frame.Refresh()
     except (OSError, IOError) as e:
         self.currentLabel.SetLabel('Error!')
         self.button.SetLabel('Close')
         dlg = wx.wxMessageDialog(
             self.frame, message='Error - ' + str(e), caption='Error',
             style=wx.wxOK | wx.wxICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
示例#16
0
 def complete(self, x):
     if self.dirCtl.GetValue() == '':
         dlg = wx.wxMessageDialog(
             self.frame, message='You must select a\n file or directory',
             caption='Error', style=wx.wxOK | wx.wxICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
     params = {
         'piece_size_pow2': self.piece_length_list[
             self.piece_length.GetSelection()]
     }
     annlist = self.getannouncelist()
     if len(annlist) > 0:
         params['real_announce_list'] = annlist
     comment = self.commentCtl.GetValue()
     if comment != '':
         params['comment'] = comment
     try:
         CompleteDir(self.dirCtl.GetValue(), self.annCtl.GetValue(), params)
     except:
         print_exc()
示例#17
0
 def failed(self, e):
     e = str(e)
     self.call.build_failed(e)
     dlg = wx.wxMessageDialog(self.frame, message="Error - " + e, caption="Error", style=wx.wxOK | wx.wxICON_ERROR)
     dlg.ShowModal()
     dlg.Destroy()
示例#18
0
 def OnAbout(self,e):
     d= wxMessageDialog(self, " Aksy, controlling your Z48 sampler\n", "About Aksy", wxOK)
     d.ShowModal()
     d.Destroy()
示例#19
0
 def show(self,msg):
     app = _GetApp()
     dlg = wxMessageDialog(NULL, msg, self.caption,self.style,self.pos)
     val = dlg.ShowModal()
     dlg.Destroy()
     return self.retval[val]
示例#20
0
    def save_thost(self, x):
        if not self.annCtl.GetValue():
            dlg = wx.wxMessageDialog(
                self.frame,
                message="You must specify a\nsingle tracker url",
                caption="Error",
                style=wx.wxOK | wx.wxICON_ERROR,
            )
            dlg.ShowModal()
            dlg.Destroy()
            return
        try:
            metainfo = {}
            metainfo["announce"] = self.annCtl.GetValue()
            annlist = self.getannouncelist()
            if len(annlist) > 0:
                warnings = ""
                for tier in annlist:
                    if len(tier) > 1:
                        warnings += (
                            "WARNING: You should not specify "
                            "multiple trackers\n     on the same line of "
                            "the tracker list unless\n     you are certain "
                            "they share peer data.\n"
                        )
                        break
                if not self.annCtl.GetValue() in annlist[0]:
                    warnings += (
                        "WARNING: The single tracker url is not "
                        "present in\n     the first line of the tracker "
                        "list.  This\n     may produce a dysfunctional "
                        "torrent.\n"
                    )
                if warnings:
                    warnings += "Are you sure you wish to save a torrent " "host\nwith these parameters?"
                    dlg = wx.wxMessageDialog(
                        self.frame, message=warnings, caption="Warning", style=wx.wxYES_NO | wx.wxICON_QUESTION
                    )
                    if dlg.ShowModal() != wx.wxID_YES:
                        dlg.Destroy()
                        return
                metainfo["announce-list"] = annlist
        except:
            return

        if self.thostselectnum:
            d = self.thostselection
        else:
            d = ".thost"
        dl = wx.wxFileDialog(
            self.frame,
            "Save tracker data as",
            os.path.join(basepath, "thosts"),
            d,
            "*.thost",
            wx.wxSAVE | wx.wxOVERWRITE_PROMPT,
        )
        if dl.ShowModal() != wx.wxID_OK:
            return
        d = dl.GetPath()

        try:
            metainfo.write(d)
            garbage, self.thostselection = os.path.split(d)
        except:
            pass
        self.refresh_thostlist()
示例#21
0
 def OnAbout(self, e):
     d = wxMessageDialog(self, " Aksy, controlling your Z48 sampler\n",
                         "About Aksy", wxOK)
     d.ShowModal()
     d.Destroy()