Commit 0a37816286563f8b01939ca99479c550be8e39ab
- Diff rendering mode:
- inline
- side by side
src/evec_upload/config.py
(2 / 2)
|   | |||
| 81 | 81 | ||
| 82 | 82 | class Config(object): | |
| 83 | 83 | ||
| 84 | CONFIG_VERSION = '2.0-alpha6' | ||
| 84 | CONFIG_VERSION = '2.0-alpha6.1' | ||
| 85 | 85 | ||
| 86 | 86 | ||
| 87 | 87 | def __init__(self): | |
| … | … | ||
| 133 | 133 | ||
| 134 | 134 | self.config_obj = { 'version' : Config.CONFIG_VERSION, | |
| 135 | 135 | 'path_set' : False, | |
| 136 | 'backup' : 'backup', | ||
| 136 | 'backup' : False, | ||
| 137 | 137 | 'upl_maxthreads' : 2, | |
| 138 | 138 | 'upl_scale' : 100, | |
| 139 | 139 | 'em_token' : '21E34B5ADA0', |
src/evec_upload/main.py
(40 / 29)
|   | |||
| 71 | 71 | ||
| 72 | 72 | ||
| 73 | 73 | # Load config | |
| 74 | c = Config() | ||
| 75 | r = c.reinit | ||
| 74 | config = Config() | ||
| 75 | r = config.reinit | ||
| 76 | 76 | if r == -1: | |
| 77 | 77 | dlg = wx.MessageDialog(self, """The uploader client configuration has been reset since an old configuration file was found. | |
| 78 | 78 | Please check your configuration (such as user login and EVE path).""", 'Client Upgrade', wx.OK | wx.ICON_INFORMATION) | |
| … | … | ||
| 97 | 97 | wx.PostEvent(this, evt) | |
| 98 | 98 | self.updcb = updcb | |
| 99 | 99 | ||
| 100 | config = Config() | ||
| 101 | 100 | self.uploader = get_uploader(config, updcb) | |
| 102 | 101 | ||
| 103 | 102 | # Set icon | |
| 104 | |||
| 105 | 103 | self.SetIcon(images.getIconIcon()) | |
| 106 | 104 | ||
| 107 | 105 | # Task Bar | |
| 108 | |||
| 109 | 106 | self.tbicon = TaskBarIcon(self) | |
| 110 | 107 | ||
| 111 | |||
| 112 | 108 | # Create the menubar | |
| 113 | 109 | menuBar = wx.MenuBar() | |
| 114 | 110 | ||
| … | … | ||
| 131 | 131 | ||
| 132 | 132 | menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit") | |
| 133 | 133 | ||
| 134 | |||
| 135 | |||
| 136 | |||
| 137 | |||
| 138 | 134 | helpmenu.Append(self.MENU_ABOUT, "&About") | |
| 139 | 135 | ||
| 140 | 136 | # bind the menu event to an event handler | |
| … | … | ||
| 153 | 153 | # Now create the Panel to put the other controls on. | |
| 154 | 154 | panel = wx.Panel(self) | |
| 155 | 155 | ||
| 156 | # and a few controls | ||
| 157 | # text = wx.StaticText(panel, -1, "EVE-Central.com MarketUploader") | ||
| 158 | |||
| 159 | 156 | self.pathtext = wx.StaticText(panel, -1, "Please wait...") | |
| 160 | # self.pathtext.Enable(False) | ||
| 161 | 157 | self.pathtext_l = wx.StaticText(panel, -1, "Using folder: ") | |
| 162 | 158 | ||
| 163 | 159 | self.usertext_l = wx.StaticText(panel, -1, "Character name: ") | |
| … | … | ||
| 161 | 161 | ||
| 162 | 162 | self.uploadtext = wx.StaticText(panel, -1, "") | |
| 163 | 163 | ||
| 164 | config_obj = Config() | ||
| 165 | |||
| 166 | if config_obj['character_id'] == 0: | ||
| 164 | if config['character_id'] == 0: | ||
| 167 | 165 | self.uploads = long(0) | |
| 168 | 166 | else: | |
| 169 | self.uploads = get_charuploads(config_obj['character_id']) | ||
| 167 | self.uploads = get_charuploads(config['character_id']) | ||
| 170 | 168 | self.scans = 0 | |
| 171 | 169 | ||
| 172 | 170 | ||
| … | … | ||
| 213 | 213 | self.load_infowidgets() | |
| 214 | 214 | ||
| 215 | 215 | def load_infowidgets(self): | |
| 216 | config_obj = Config() | ||
| 216 | config = Config() | ||
| 217 | 217 | ||
| 218 | path = config_obj['evepath'][0] | ||
| 218 | path = config['evepath'][0] | ||
| 219 | 219 | if (path): | |
| 220 | 220 | self.pathtext.SetLabel( path) | |
| 221 | self.usertext.SetLabel(config_obj['character_name']) | ||
| 221 | self.usertext.SetLabel(config['character_name']) | ||
| 222 | 222 | self.uploadtext.SetLabel("Uploads so far: " + `self.uploads`[:-1] + " Scans so far: " + `self.scans`) | |
| 223 | 223 | ||
| 224 | 224 | def OnOptions(self, evt): | |
| 225 | config = Config() | ||
| 225 | 226 | dlg = evec_upload.options.OptionDialog(self) | |
| 226 | dlg.ShowModal() | ||
| 227 | r = dlg.ShowModal() | ||
| 228 | if r == wx.ID_OK: | ||
| 229 | config['backup'] = dlg.backup.GetValue() | ||
| 230 | if dlg.anon_cb.IsChecked(): | ||
| 231 | config['character_name'] = "Anonymous" | ||
| 232 | config['character_id'] = 0 | ||
| 233 | else: | ||
| 234 | v = get_charid(dlg.uname.GetValue(), dlg.passwd.GetValue()) | ||
| 235 | if v == -1: | ||
| 236 | dlge = wx.MessageDialog(self, 'User login information incorrect. Using old value', 'Bad login', | ||
| 237 | wx.OK | wx.ICON_ERROR | ||
| 238 | ) | ||
| 239 | dlge.ShowModal() | ||
| 240 | dlge.Destroy() | ||
| 241 | else: | ||
| 242 | config['character_id'] = v | ||
| 243 | config['character_name'] = dlg.uname.GetValue() | ||
| 244 | config.save_config() | ||
| 245 | self.load_infowidgets() | ||
| 227 | 246 | ||
| 247 | |||
| 248 | |||
| 249 | else: | ||
| 250 | pass | ||
| 251 | dlg.Destroy() | ||
| 252 | |||
| 253 | |||
| 228 | 254 | def OnTimeToClose(self, evt): | |
| 229 | 255 | """Event handler for the button click.""" | |
| 230 | 256 | self.tbicon.OnTaskBarQuit(None) | |
| … | … | ||
| 283 | 283 | ||
| 284 | 284 | ||
| 285 | 285 | def OnTimer(self, evt): | |
| 286 | config_obj = Config() | ||
| 286 | config = Config() | ||
| 287 | 287 | self.SetStatusText("Uploading...") | |
| 288 | 288 | ||
| 289 | job = UploadPayload(config_obj['evepath'][0], self.uploader, self.donecb) | ||
| 289 | job = UploadPayload(config['evepath'][0], self.uploader, self.donecb) | ||
| 290 | 290 | self.upload_thread.trigger(job) | |
| 291 | 291 | ||
| 292 | 292 | ||
| 293 | 293 | def OnLocate(self, evt): | |
| 294 | config_obj = Config() | ||
| 294 | config = Config() | ||
| 295 | 295 | dlg = wx.DirDialog(self, "Please locate the cache folder", | |
| 296 | 296 | style=wx.DD_DEFAULT_STYLE, | |
| 297 | 297 | defaultPath=default_location() ) | |
| 298 | 298 | ||
| 299 | 299 | if dlg.ShowModal() == wx.ID_OK: | |
| 300 | 300 | print os.path.abspath(dlg.GetPath()) | |
| 301 | config_obj['evepath'][0] = os.path.abspath(dlg.GetPath()) | ||
| 302 | config_obj['path_set'] = True | ||
| 301 | config['evepath'][0] = os.path.abspath(dlg.GetPath()) | ||
| 302 | config['path_set'] = True | ||
| 303 | 303 | ||
| 304 | config.save() | ||
| 304 | 305 | self.load_infowidgets() | |
| 305 | 306 | ||
| 306 | 307 | ||
| 307 | 308 | def update_motd(self): | |
| 308 | |||
| 309 | |||
| 310 | 309 | motdf = urllib.urlopen("http://eve-central.com/motd.txt") | |
| 311 | 310 | motd = "" | |
| 312 | 311 | for line in motdf.readlines(): |
src/evec_upload/options.py
(26 / 1)
|   | |||
| 24 | 24 | import images | |
| 25 | 25 | import urllib | |
| 26 | 26 | ||
| 27 | from evec_upload.config import Config | ||
| 27 | 28 | ||
| 28 | |||
| 29 | 29 | class OptionDialog(wx.Dialog): | |
| 30 | 30 | def __init__(self, parent): | |
| 31 | config = Config() | ||
| 31 | 32 | ||
| 32 | 33 | wx.Dialog.__init__(self, parent, -1, "Options", style = wx.DEFAULT_DIALOG_STYLE) | |
| 33 | 34 | ||
| … | … | ||
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | 41 | self.backup = wx.CheckBox(self, -1, "Create CSV dumps the uploaded data") | |
| 42 | self.backup.SetValue(config['backup']) | ||
| 42 | 43 | sizer.Add(self.backup, 0, wx.ALL, 5) | |
| 43 | 44 | ||
| 44 | 45 | self.suggest = wx.CheckBox(self, -1, "Offer suggestions of what can be uploaded") | |
| 45 | 46 | sizer.Add(self.suggest, 0, wx.ALL, 5) | |
| 46 | 47 | ||
| 48 | self.anon_cb = wx.CheckBox(self, -1, "Anonymous login - no username") | ||
| 49 | self.Bind(wx.EVT_CHECKBOX, self.OnAnonCb, self.anon_cb) | ||
| 50 | sizer.Add(self.anon_cb, 0, wx.ALL, 5) | ||
| 47 | 51 | ||
| 48 | 52 | line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) | |
| 49 | 53 | sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) | |
| … | … | ||
| 98 | 98 | ||
| 99 | 99 | self.SetSizer(sizer) | |
| 100 | 100 | sizer.Fit(self) | |
| 101 | |||
| 102 | char_name = config['character_name'] | ||
| 103 | |||
| 104 | if char_name == "Anonymous": | ||
| 105 | self.anon_cb.SetValue(True) | ||
| 106 | self.uname.Enable(False) | ||
| 107 | self.passwd.Enable(False) | ||
| 108 | else: | ||
| 109 | self.uname.SetValue(char_name) | ||
| 110 | |||
| 111 | |||
| 112 | def OnAnonCb(self, evt): | ||
| 113 | if self.uname.IsEnabled(): | ||
| 114 | self.uname.Enable(False) | ||
| 115 | else: | ||
| 116 | self.uname.Enable(True) | ||
| 117 | if self.passwd.IsEnabled(): | ||
| 118 | self.passwd.Enable(False) | ||
| 119 | else: | ||
| 120 | self.passwd.Enable(True) |
src/evec_upload/uploader.py
(0 / 8)
|   | |||
| 33 | 33 | ||
| 34 | 34 | from evec_upload.config import Config | |
| 35 | 35 | ||
| 36 | |||
| 37 | ProgramVersion = 2000 | ||
| 38 | ProgramVersionNice = "2.0" | ||
| 39 | CheckVersion = 1031 | ||
| 40 | |||
| 41 | #(UpdateUploadEvent, EVT_UPDATE_UPLOAD) = wx.lib.newevent.NewEvent() | ||
| 42 | #(DoneUploadEvent, EVT_DONE_UPLOAD) = wx.lib.newevent.NewEvent() | ||
| 43 | |||
| 44 | 36 | def get_uploader(cfg, updcb): | |
| 45 | 37 | config = Config() | |
| 46 | 38 | upl = UploaderEC(identity=0, donecb=updcb) |

