Example #1
0
    def OnOptions(self, evt):
        config = Config()
        dlg = evec_upload.options.OptionDialog(self)
        r = dlg.ShowModal()
        if r == wx.ID_OK:
            config['backup'] = dlg.backup.GetValue()
            if dlg.anon_cb.IsChecked():
                config['character_name'] = "Anonymous"
                config['character_id'] = 0
            else:
                v = get_charid(dlg.uname.GetValue(), dlg.passwd.GetValue())
                if v == -1:
                    dlge = wx.MessageDialog(self, 'User login information incorrect. Using old value', 'Bad login',
                                           wx.OK | wx.ICON_ERROR
                                           )
                    dlge.ShowModal()
                    dlge.Destroy()
                else:
                    config['character_id'] = v
                    config['character_name'] = dlg.uname.GetValue()
            config.save_config()
            self.load_infowidgets()



        else:
            pass
        dlg.Destroy()
Example #2
0
    def OnLocate(self, evt):
        config = Config()
        dlg = wx.DirDialog(self, "Please locate the cache folder",
                           style=wx.DD_DEFAULT_STYLE,
                           defaultPath=default_location() )

        if dlg.ShowModal() == wx.ID_OK:
            print os.path.abspath(dlg.GetPath())
            config['evepath'][0] = os.path.abspath(dlg.GetPath())
            config['path_set'] = True

        config.save()
        self.load_infowidgets()
Example #3
0
 def record_hidden(self):
     config = Config()
     if self.frame.IsShown():
         config['hide'] = False
     else:
         config['hide'] = True
     print "Hide state is now ", config['hide']
Example #4
0
    def launch():

        config_obj = Config()

        dlg = evec_upload.login.LoginDialog(self, config_obj['character_name'])
        r = dlg.ShowModal()
        if r == wx.ID_OK:
            if dlg.anon_cb.IsChecked():
                config_obj['character_name'] = "Anonymous"
                config_obj['character_id'] = 0

                self.load_infowidgets()
            else:
                v = get_charid(dlg.uname.GetValue(), dlg.passwd.GetValue())
                if v == -1:
                    dlge = wx.MessageDialog(
                        self,
                        'User login information incorrect. Using old value',
                        'Bad login', wx.OK | wx.ICON_ERROR)
                    dlge.ShowModal()
                    dlge.Destroy()
                else:
                    config_obj['character_id'] = v
                    config_obj['character_name'] = dlg.uname.GetValue()
                    self.load_infowidgets()

        else:
            pass
        dlg.Destroy()
Example #5
0
def make_csv_file(orders, region, typeid, timestamp):
    config = Config()
    filename = os.path.join(documents_path,
                            str(region) + "-" + str(typeid) + ".csv")
    with open(filename, 'w') as f:
        print >> f, orders
    return
Example #6
0
    def OnTimer(self, evt):
        config = Config()
        self.SetStatusText("Uploading...")

        if not self.paths or self.paths_age > (time.time() + (60 * 60 * 24)):
            self.paths = default_locations()
            self.paths_age = time.time()

        for path in self.paths:
            print "Scanning path ", path
            job = ScannerPayload(path, self.uploader, self.donecb)
            self.scanner_thread.trigger(job)
Example #7
0
    def __init__(self, queue=None, donecb=None, identity=None):
        config = Config()
        Thread.__init__(self)
        self.setDaemon(True)

        self.donecb = donecb
        self.identity = identity

        self.maxthreads = int(config['upl_maxthreads'])
        self.scale = int(config['upl_scale'])
        self.helper = []

        self.queue = queue
        if not self.queue:
            self.queue = Queue()
Example #8
0
    def OnInit(self):

        frame = MainFrame(None, "Contribtastic!")
        self.SetTopWindow(frame)
        config = Config()
        show = True

        if len(sys.argv) > 1 and sys.argv[1] == "-hide":
            show = False

        print "Startup config: ", config.config_obj
        if 'hide' in config:
            show = not config['hide']

        frame.Show(show)

        return True
Example #9
0
    print "DONE: %i, %s" % (
        count,
        success,
    )


def updcb(typename, success):
    print "UPD: %s, %s" % (
        typename,
        success,
    )


from evec_upload.uploader import get_uploader
from evec_upload.config import Config
config = Config()
upl = get_uploader(config, updcb)

from evec_upload.upload import UploadPayload, upload_data
uc = 0
while True:
    for path in argv[1:]:
        print "starting ", path
        job = UploadPayload(path, upl, donecb=donecb)
        upc = upload_data(job)
        uc += upc
        print "done: %i -> %i total" % (
            upc,
            uc,
        )
Example #10
0
    def __init__(self, parent):
        config = Config()

        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           "Options",
                           style=wx.DEFAULT_DIALOG_STYLE)

        sizer = wx.BoxSizer(wx.VERTICAL)
        label = wx.StaticText(self, -1, "Configure how the Uploader operates")
        sizer.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)

        self.backup = wx.CheckBox(self, -1,
                                  "Create CSV dumps the uploaded data")
        self.backup.SetValue(config['backup'])
        sizer.Add(self.backup, 0, wx.ALL, 5)

        self.suggest = wx.CheckBox(
            self, -1, "Offer suggestions of what can be uploaded")
        sizer.Add(self.suggest, 0, wx.ALL, 5)

        self.anon_cb = wx.CheckBox(self, -1, "Anonymous login - no username")
        self.Bind(wx.EVT_CHECKBOX, self.OnAnonCb, self.anon_cb)
        sizer.Add(self.anon_cb, 0, wx.ALL, 5)

        line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
        sizer.Add(line, 0,
                  wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)

        box = wx.BoxSizer(wx.HORIZONTAL)

        label = wx.StaticText(self, -1, "Username:"******"", size=(80, -1))

        box.Add(self.uname, 1, wx.ALIGN_CENTRE | wx.ALL, 5)

        sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        box = wx.BoxSizer(wx.HORIZONTAL)

        label = wx.StaticText(self, -1, "Password: "******"",
                                  size=(80, -1),
                                  style=wx.TE_PASSWORD)

        box.Add(self.passwd, 1, wx.ALIGN_CENTRE | wx.ALL, 5)

        sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
        sizer.Add(line, 0,
                  wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)

        btnsizer = wx.StdDialogButtonSizer()

        btn = wx.Button(self, wx.ID_OK)

        btn.SetDefault()
        btnsizer.AddButton(btn)

        btn = wx.Button(self, wx.ID_CANCEL)

        btnsizer.AddButton(btn)
        btnsizer.Realize()

        sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

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

        char_name = config['character_name']

        if char_name == "Anonymous":
            self.anon_cb.SetValue(True)
            self.uname.Enable(False)
            self.passwd.Enable(False)
        else:
            self.uname.SetValue(char_name)
Example #11
0
def get_uploader(cfg, updcb):
    config = Config()
    upl = UploaderEC(identity=0, donecb=updcb)
    upl.start()
    return upl
Example #12
0
    def __init__(self, parent, title):
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          title,
                          pos=(150, 150),
                          style=wx.CAPTION | wx.MINIMIZE_BOX | wx.RESIZE_BORDER
                          | wx.SYSTEM_MENU | wx.CLOSE_BOX)  # size=(350, 150))

        try:
            check_protocol()
            r = check_client()
            if r is not True:
                dlg = wx.MessageDialog(
                    self, 'Client outdated! New version ' + ` r ` +
                    ' available! Visit EVE-Central.com to update!',
                    'Outdated client', wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                os.system("explorer http://eve-central.com")
                sys.exit(-1)

        except IOError:
            dlg = wx.MessageDialog(
                self,
                'The network appears to be down. I cannot reach EVE-central.com. Check your firewall settings or internet connection',
                'Can\'t communicate with EVE-Central.com',
                wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            sys.exit(-1)

        # Load config
        config = Config()
        r = config.reinit
        if r == -1:
            dlg = wx.MessageDialog(
                self,
                """The uploader client configuration has been reset since an old configuration file was found.    Please check your configuration (such as path).""",
                'Client Upgrade', wx.OK | wx.ICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()

        self.scanner_thread = ScannerThread()
        self.scanner_thread.start()

        def donecb(count, success, this=self):
            evt = DoneUploadEvent(count=count, success=success)
            wx.PostEvent(this, evt)

        self.donecb = donecb

        def updcb(typename, success, this=self):
            #print "UPD: %s, %s" % (typename, success,)
            evt = UpdateUploadEvent(typename=typename, success=success)
            wx.PostEvent(this, evt)

        self.updcb = updcb

        self.uploader = get_uploader(config, updcb)

        # Set icon
        self.SetIcon(images.getIconIcon())

        # Task Bar
        self.tbicon = TaskBarIcon(self)

        # Create the menubar
        menuBar = wx.MenuBar()

        # and a menu
        menu = wx.Menu()

        # option menu
        opmenu = wx.Menu()

        # help menu
        helpmenu = wx.Menu()

        # add an item to the menu, using \tKeyName automatically
        # creates an accelerator, the third param is some help text
        # that will show up in the statusbar
        menu.Append(self.MENU_SCANNOW, "S&can now...")
        menu.AppendSeparator()

        #menu.Append(self.MENU_SETTINGS, "&Settings...")
        #menu.Append(self.MENU_LOCATE, "&Locate cache folder...")

        menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit")

        helpmenu.Append(self.MENU_ABOUT, "&About")

        # bind the menu event to an event handler
        self.Bind(wx.EVT_MENU, self.OnTimer, id=self.MENU_SCANNOW)
        self.Bind(wx.EVT_MENU, self.OnTimeToClose, id=wx.ID_EXIT)
        self.Bind(wx.EVT_MENU, self.OnAbout, id=self.MENU_ABOUT)
        self.Bind(wx.EVT_CLOSE, self.OnTimeToClose)

        # and put the menu on the menubar
        menuBar.Append(menu, "&File")

        menuBar.Append(helpmenu, "&Help")
        self.SetMenuBar(menuBar)

        self.CreateStatusBar()
        self.SetStatusText("Idle")

        # Now create the Panel to put the other controls on.
        panel = wx.Panel(self)

        self.pathtext = wx.StaticText(panel, -1, "Please wait...")
        self.pathtext_l = wx.StaticText(
            panel, -1, "Using folder:  Autodetecting folders.")

        #self.usertext_l = wx.StaticText(panel, -1, "Character name:  ")
        #self.usertext = wx.StaticText(panel, -1, "...")

        self.uploadtext = wx.StaticText(panel, -1, "")

        if config['character_id'] == 0:
            self.uploads = long(0)
        else:
            self.uploads = long(0)
        self.scans = 0

        self.motd = wx.TextCtrl(panel,
                                -1,
                                "",
                                size=(200, 100),
                                style=wx.TE_MULTILINE | wx.TE_READONLY)

        self.update_motd()

        #text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))

        sizer = wx.BoxSizer(wx.VERTICAL)

        sizer_path = wx.FlexGridSizer(2, 2)
        #--
        sizer_path.Add(self.pathtext_l, 2, wx.EXPAND | wx.ALL, 1)
        sizer_path.Add(self.pathtext, 0, wx.ALL | wx.EXPAND, 1)

        #sizer_path.Add(self.usertext_l, 2, wx.EXPAND|wx.ALL, 1)
        #sizer_path.Add(self.usertext, 0, wx.ALL|wx.EXPAND, 1)

        #--
        sizer.Add(sizer_path, 0, wx.EXPAND | wx.ALL, 1)
        line = wx.StaticLine(panel, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
        sizer.Add(line, 0,
                  wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)

        sizer.Add(self.uploadtext, 0, wx.ALL, 1)

        sizer.Add(self.motd, 4, wx.ALL | wx.EXPAND, 1)

        panel.SetSizer(sizer)
        panel.Layout()

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

        self.Bind(wx.EVT_TIMER, self.OnTimer)
        self.Bind(EVT_UPDATE_UPLOAD, self.OnUploadUpdate)
        self.Bind(EVT_DONE_UPLOAD, self.OnUploadDone)

        self.load_infowidgets()

        self.paths = []
        self.paths_age = time.time()
Example #13
0
    def load_infowidgets(self):
        config = Config()

        self.pathtext.SetLabel("")
        self.uploadtext.SetLabel("Uploads so far: " + ` self.uploads ` [:-1] +
                                 "  Scans so far: " + ` self.scans `)