def ShowFiles(self, path, refresh=False): mw=self.mainwindow if path == self.path and not refresh: return self.path=None mw.MakeCall( gui.Request(mw.wt.getfileonlylist, path), gui.Callback(self.OnShowFilesResults, path) )
def GetFullFS(self): mw = self.mainwindow mw.OnBusyStart() mw.GetStatusBar().progressminor(0, 100, 'Reading Phone File System ...') mw.MakeCall(gui.Request(mw.wt.fulldirlisting), gui.Callback(self.OnFullDirListingResults))
def OnFileOverwrite(self,_): path=self.itemtopath(self.GetFirstSelected()) with guihelper.WXDialogWrapper(wx.FileDialog(self, style=wx.OPEN|wx.HIDE_READONLY|wx.CHANGE_DIR), True) as (dlg, retcode): if retcode==wx.ID_OK: infile=dlg.GetPath() contents=open(infile, "rb").read() mw=self.mainwindow mw.MakeCall( gui.Request(mw.wt.writefile, path, contents), gui.Callback(self.OnFileOverwriteResults, guihelper.dirname(path)) )
def OnDataSendPhoneGotFundamentals(self, data, todo, exception, results): if exception != None: if not self.silent: self.mw.HandleException(exception) self.log("Auto Sync: Failed, Exception getting phone fundementals") self.mw.OnBusyEnd() return data.update(results) # Now scribble to phone self.log("Auto Sync: Sending results to phone") self.mw.MakeCall(gui.Request(self.mw.wt.senddata, data, todo), gui.Callback(self.OnDataSendCalenderResults))
def sendcalendertophone(self): res = 1 data = {} todo = [] data['calendar_version'] = self.mw.phoneprofile.BP_Calendar_Version self.mw.GetActiveCalendarWidget().getdata(data) todo.append((self.mw.wt.writecalendar, "Calendar", False)) todo.append((self.mw.wt.rebootcheck, "Phone Reboot")) self.mw.MakeCall( gui.Request(self.mw.wt.getfundamentals), gui.Callback(self.OnDataSendPhoneGotFundamentals, data, todo)) return res
def OnRestoreOK(self, zipf, names, parentdir): if len(names)==0: wx.MessageBox("You didn't select any files to restore!", "No files selected", wx.OK|wx.ICON_EXCLAMATION) return l=[] for zipname, fsname in names: l.append( (fsname, zipf.read(zipname)) ) mw=self.mainwindow mw.MakeCall( gui.Request(mw.wt.restorefiles, l), gui.Callback(self.OnRestoreResults, parentdir) )
def OnNewSubdir(self, _): with guihelper.WXDialogWrapper(wx.TextEntryDialog(self, "Subdirectory name?", "Create Subdirectory", "newfolder"), True) as (dlg, retcode): if retcode==wx.ID_OK: item=self.GetSelection() parent=self.itemtopath(item) if len(parent): path=parent+"/"+dlg.GetValue() else: path=dlg.GetValue() mw=self.mainwindow mw.MakeCall( gui.Request(mw.wt.mkdir, path), gui.Callback(self.OnNewSubdirResults, path) )
def OnNewFile(self,_): with guihelper.WXDialogWrapper(wx.FileDialog(self, style=wx.OPEN|wx.HIDE_READONLY|wx.CHANGE_DIR), True) as (dlg, retcode): if retcode==wx.ID_OK: infile=dlg.GetPath() contents=open(infile, "rb").read() if len(self.path): path=self.path+"/"+os.path.basename(dlg.GetPath()) else: path=os.path.basename(dlg.GetPath()) # you can't create files in root but I won't stop you mw=self.mainwindow mw.MakeCall( gui.Request(mw.wt.writefile, path, contents), gui.Callback(self.parent.OnNewFileResults, self.path) )
def OnAddFiles(self): mw=self.mainwindow if not len(self.add_files): return for file in self.add_files: if file is None: continue if len(self.add_target): path=self.add_target+"/"+os.path.basename(file) else: path=os.path.basename(file) # you can't create files in root but I won't stop you contents=open(file, "rb").read() mw.MakeCall( gui.Request(mw.wt.writefile, path, contents), gui.Callback(self.OnAddFilesResults, self.add_target) ) self.add_files.remove(file) # can only add one file at a time break
def OnDirListing(self, path): mw=self.mainwindow mw.MakeCall( gui.Request(mw.wt.singledirlisting, path), gui.Callback(self.OnDirListingResults, path) )
def OnPhoneOffline(self,_): mw=self.mainwindow mw.MakeCall( gui.Request(mw.wt.phoneofflinerequest), gui.Callback(self.OnPhoneOfflineResults) )
def OnPhoneReboot(self,_): mw=self.mainwindow mw.MakeCall( gui.Request(mw.wt.phonerebootrequest), gui.Callback(self.OnPhoneRebootResults) )
def OnBackup(self, recurse=0): path=self.itemtopath(self.GetSelection()) mw=self.mainwindow mw.MakeCall( gui.Request(mw.wt.getbackup, path, recurse), gui.Callback(self.OnBackupResults, path) )
def OnDirDelete(self, _): path=self.itemtopath(self.GetSelection()) mw=self.mainwindow mw.MakeCall( gui.Request(mw.wt.rmdirs, path), gui.Callback(self.OnDirDeleteResults, path) )
def OnModemMode(self,_): mw=self.mainwindow mw.MakeCall( gui.Request(mw.wt.modemmoderequest), gui.Callback(self.OnModemModeResults) )
def OnHexView(self, _): path=self.itemtopath(self.GetFirstSelected()) mw=self.mainwindow mw.MakeCall( gui.Request(mw.wt.getfile, path), gui.Callback(self.OnHexViewResults, path) )
def OnFileDelete(self, _): path=self.itemtopath(self.GetFirstSelected()) mw=self.mainwindow mw.MakeCall( gui.Request(mw.wt.rmfile, path), gui.Callback(self.OnFileDeleteResults, guihelper.dirname(path)) )