Exemplo n.º 1
0
    def OnDrop(self, event):
        """Handles files which are dropped into GSBrowser; prompts a message box and uploads the files accordingly"""
        fileNames = event.GetFiles()
        msgBox = wx.MessageDialog(
            self, helper.list2str(fileNames),
            "Are you sure you want to upload these files?", wx.YES_NO)
        if msgBox.ShowModal() == wx.ID_NO:
            return
        else:
            bucketName = self.GetSelectedItems(self.bktList)[0]
            self.StatusBar.SetStatusText("Uploading...")
            normalCursor = self.GetCursor()
            busyCursor = wx.StockCursor(wx.CURSOR_WAIT)
            self.SetCursor(busyCursor)
            for fname in fileNames:
                pdlg = wx.ProgressDialog(fname,
                                         "FileUpload",
                                         maximum=os.path.getsize(fname))
                pdlg.SetSize((400, 100))

                def update(m, n):
                    pdlg.Update(m, str(100 * m / n) + "% done")

                gs.uploadObject(bucketName, fname, update)
            self.StatusBar.SetStatusText("Done!")
            self.SetCursor(normalCursor)
            #refresh
            self.OnListBox(event)
Exemplo n.º 2
0
 def OnDelete(self, event, fileNameList):
     """Delete(s) object(s)"""
     msgBox = wx.MessageDialog(
         self, "Are you sure you want to delete these object(s)?\n" +
         helper.list2str(fileNameList), "GS", wx.YES_NO)
     if msgBox.ShowModal() == wx.ID_NO:
         return
     bucketName = self.GetSelectedItems(self.bktList)[0]
     self.StatusBar.SetStatusText("Deleting object " + str(fileNameList) +
                                  " in bucket " + bucketName)
     gs.deleteObjects(bucketName, fileNameList)
     self.StatusBar.SetStatusText("Updating...")
     self.OnListBox(event)  #refresh
     self.StatusBar.SetStatusText("Done!")
Exemplo n.º 3
0
	def OnDrop(self,event):
		"""Handles files which are dropped into GSBrowser; prompts a message box and uploads the files accordingly"""
		fileNames = event.GetFiles()
		msgBox = wx.MessageDialog(self,helper.list2str(fileNames),"Are you sure you want to upload these files?",wx.YES_NO)
		if msgBox.ShowModal() == wx.ID_NO:
                         return
		else:
			bucketName = self.GetSelectedItems(self.bktList)[0]
			self.StatusBar.SetStatusText("Uploading...")
	                normalCursor = self.GetCursor()
        	        busyCursor = wx.StockCursor(wx.CURSOR_WAIT)
                	self.SetCursor(busyCursor)
			for fname in fileNames:
				pdlg = wx.ProgressDialog(fname,"FileUpload",maximum=os.path.getsize(fname))
				pdlg.SetSize((400,100))
				def update(m,n):
					pdlg.Update(m,str(100*m/n)+ "% done")
				gs.uploadObject(bucketName,fname,update)
			self.StatusBar.SetStatusText("Done!")
        	        self.SetCursor(normalCursor)
	                #refresh
                	self.OnListBox(event)
Exemplo n.º 4
0
	def OnDelete(self,event,fileNameList):
		 """Delete(s) object(s)"""
		 msgBox = wx.MessageDialog(self,"Are you sure you want to delete these object(s)?\n"+helper.list2str(fileNameList),"GS",wx.YES_NO)
		 if msgBox.ShowModal() == wx.ID_NO:
		 	return
		 bucketName = self.GetSelectedItems(self.bktList)[0]
		 self.StatusBar.SetStatusText("Deleting object "+str(fileNameList)+" in bucket "+bucketName)
		 gs.deleteObjects(bucketName,fileNameList)
		 self.StatusBar.SetStatusText("Updating...")
		 self.OnListBox(event) #refresh
		 self.StatusBar.SetStatusText("Done!")