Example #1
0
 def refresh_file_list(self, object):
     result = ioup.check_list(state_handler.get_token())
     if result == {" ":" "}:
         self.error("Wasn't able to refresh list")
         return
     state_handler.store_file_list(result)
     self.update_list()
Example #2
0
    def upload(self, path, filename):
        if len(filename) == 0:
            return
        self.dismiss_popup()
        file_name = os.path.join(path,filename[0])

        #uploading file
        result = ioup.upload_file(state_handler.get_token(), file_name)
        if result == " ":
            self.error("Cannot upload file "+file_name)
            return

        droid.setClipboard(result.encode('utf-8'))

        #updating the list
        result2 = ioup.check_list(state_handler.get_token())
        if result2 == {" ":" "}:
            self.error("Wasn't able to refresh list")
            return
        state_handler.store_file_list(result2)
        self.update_list()
        self.dismiss_popup()

        content = BoxLayout(orientation = 'vertical')
        content.add_widget(Label(text="Uploaded Successfully: \n"+file_name+"\n"+result))
        closeButton  = Button(text='OK',size_hint_y = 0.15)
        content.add_widget(closeButton)
        self._popup = Popup(title='Uploaded', content=content,size_hint=(0.8, 0.8))
        closeButton.bind(on_press=self._popup.dismiss)
        self._popup.open()
Example #3
0
 def refresh_file_list(self, object):
     result = ioup.check_list(state_handler.get_token())
     if result == {" ": " "}:
         self.error("Wasn't able to refresh list")
         return
     state_handler.store_file_list(result)
     self.update_list()
Example #4
0
    def upload(self, path, filename):
        if len(filename) == 0:
            return
        self.dismiss_popup()
        file_name = os.path.join(path, filename[0])

        #uploading file
        result = ioup.upload_file(state_handler.get_token(), file_name)
        if result == " ":
            self.error("Cannot upload file " + file_name)
            return

        droid.setClipboard(result.encode('utf-8'))

        #updating the list
        result2 = ioup.check_list(state_handler.get_token())
        if result2 == {" ": " "}:
            self.error("Wasn't able to refresh list")
            return
        state_handler.store_file_list(result2)
        self.update_list()
        self.dismiss_popup()

        content = BoxLayout(orientation='vertical')
        content.add_widget(
            Label(text="Uploaded Successfully: \n" + file_name + "\n" +
                  result))
        closeButton = Button(text='OK', size_hint_y=0.15)
        content.add_widget(closeButton)
        self._popup = Popup(title='Uploaded',
                            content=content,
                            size_hint=(0.8, 0.8))
        closeButton.bind(on_press=self._popup.dismiss)
        self._popup.open()
Example #5
0
    def delete_file_list(self, object):
        for data in self.data_items:
            if data.is_selected:
                result = ioup.remove_file(
                    state_handler.get_token(),
                    state_handler.get_file_list()[data.text])
                if result == False:
                    self.error("Could not remove file: \n" + data.text)
                    return

        #updating the list
        result2 = ioup.check_list(state_handler.get_token())
        if result2 == {" ": " "}:
            self.error("Wasn't able to refresh list")
            return
        state_handler.store_file_list(result2)
        self.update_list()
        self.dismiss_popup()
Example #6
0
    def delete_file_list(self, object):
        for data in self.data_items:
            if data.is_selected:
                result = ioup.remove_file(
                        state_handler.get_token(), 
                        state_handler.get_file_list()[data.text]
                )
                if result == False:
                    self.error("Could not remove file: \n"+ data.text)
                    return

        #updating the list
        result2 = ioup.check_list(state_handler.get_token())
        if result2 == {" ":" "}:
            self.error("Wasn't able to refresh list")
            return
        state_handler.store_file_list(result2)
        self.update_list()
        self.dismiss_popup()