def __init__(self, parent=None, bucketid=None): QtGui.QWidget.__init__(self, parent) self.file_manager_ui = Ui_FileManager() self.file_manager_ui.setupUi(self) # connect ComboBox change listener QtCore.QObject.connect( self.file_manager_ui.bucket_select_combo_box, QtCore.SIGNAL('currentIndexChanged(const QString&)'), self.createNewFileListUpdateThread) # create bucket action QtCore.QObject.connect( self.file_manager_ui.file_mirrors_bt, QtCore.SIGNAL('clicked()'), self.open_mirrors_list_window) # create bucket action QtCore.QObject.connect( self.file_manager_ui.quit_bt, QtCore.SIGNAL('clicked()'), self.close) # create bucket action QtCore.QObject.connect( self.file_manager_ui.file_download_bt, QtCore.SIGNAL('clicked()'), self.open_single_file_download_window) # delete selected file QtCore.QObject.connect( self.file_manager_ui.file_delete_bt, QtCore.SIGNAL('clicked()'), self.delete_selected_file) # delete selected file QtCore.QObject.connect( self.file_manager_ui.new_file_upload_bt, QtCore.SIGNAL('clicked()'), self.open_single_file_upload_window) self.storj_engine = StorjEngine() self.createNewBucketResolveThread()
def initialize_buckets_table(self): self.storj_engine = StorjEngine() # init StorjEngine logger.info("resolving buckets") model = QStandardItemModel(1, 1) # initialize model for inserting to table model.setHorizontalHeaderLabels(['Name', 'Storage', 'Transfer', 'ID']) i = 0 try: for bucket in self.storj_engine.storj_client.bucket_list(): item = QStandardItem(bucket.name) model.setItem(i, 0, item) # row, column, item (QStandardItem) item = QStandardItem(str(bucket.storage)) model.setItem(i, 1, item) # row, column, item (QStandardItem) item = QStandardItem(str(bucket.transfer)) model.setItem(i, 2, item) # row, column, item (QStandardItem) item = QStandardItem(bucket.id) model.setItem(i, 3, item) # row, column, item (QStandardItem) i = i + 1 except sjexc.StorjBridgeApiError as e: QtGui.QMessageBox.about( self, 'Unhandled bucket resolving exception', 'Exception: %s' % e) self.bucket_manager_ui.total_buckets_label.setText(str(i)) # set label of user buckets number self.bucket_manager_ui.bucket_list_tableview.setModel(model) self.bucket_manager_ui.bucket_list_tableview.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
def __init__(self, parent=None): # EXIT_CODE_REBOOT = -123 QtGui.QWidget.__init__(self, parent) self.ui = Ui_MainMenu() self.ui.setupUi(self) # QtCore.QObject.connect(self.ui.pushButton_3, QtCore.SIGNAL("clicked()"), self.save_config) # open bucket manager self.storj_engine = StorjEngine() # init StorjEngine self.account_manager = AccountManager() # init AccountManager user_email = self.account_manager.get_user_email() self.ui.account_label.setText(html_format_begin + str(user_email).strip() + html_format_end) # BUTTONS: # QtCore.QObject.connect(self.ui., QtCore.SIGNAL("clicked()"), self.open_login_window) # open login window # QtCore.QObject.connect(self.ui.pushButton_4, QtCore.SIGNAL("clicked()"), self.open_register_window) # open login window QtCore.QObject.connect( self.ui.create_bucket_bt, QtCore.SIGNAL("clicked()"), self.open_bucket_create_window) # open bucket create window QtCore.QObject.connect( self.ui.bucket_manager_bt, QtCore.SIGNAL("clicked()"), self.open_bucket_manager_window) # open bucket manager window QtCore.QObject.connect(self.ui.settings_bt, QtCore.SIGNAL("clicked()"), self.open_settings_window) # open settings ui QtCore.QObject.connect( self.ui.file_manager_bt, QtCore.SIGNAL("clicked()"), self.open_file_manager_window) # open file manager window QtCore.QObject.connect( self.ui.uploader_bt, QtCore.SIGNAL("clicked()"), self.open_single_file_upload_window) # open single file upload ui QtCore.QObject.connect( self.ui.downloader_bt, QtCore.SIGNAL("clicked()"), self.open_file_mirrors_list_window) # open single file download ui
def initialize_buckets_select_list(self): """Get all the buckets in which it is possible to store files, and show the names in the dropdown list""" # self.__logger.warning(str({ # "log_event_type": "info", # "title": "Buckets", # "description": "Resolving buckets from Bridge to buckets combobox..."})) # self.__logger.warning('"log_event_type": "info"') self.__logger.debug('"title": "Buckets"') self.__logger.debug('"description": "Resolving buckets from Bridge to buckets combobox..."') self.buckets_list = [] self.bucket_id_list = [] self.storj_engine = StorjEngine() try: for bucket in self.storj_engine.storj_client.bucket_list(): self.__logger.debug('Found bucket: %s', bucket.name) # append buckets to list self.buckets_list.append(str(bucket.name).decode('utf8')) self.bucket_id_list.append(bucket.id) except storj.exception.StorjBridgeApiError as e: self.__logger.error(e) QMessageBox.about( self, 'Unhandled bucket resolving exception', 'Exception: %s' % e) self.ui_single_file_upload.save_to_bucket_select.addItems(self.buckets_list) if APPLY_SELECTED_BUCKET_TO_UPLOADER: self.ui_single_file_upload.save_to_bucket_select.setCurrentIndex(int(self.dashboard_instance.current_bucket_index))
def __init__(self, parent=None, bucketid=None): QtGui.QWidget.__init__(self, parent) self.file_manager_ui = Ui_MainMenu() self.file_manager_ui.setupUi(self) #self.change_loading_gif() QtCore.QObject.connect( self.file_manager_ui.bucket_select_combo_box, QtCore.SIGNAL('currentIndexChanged(const QString&)'), self. createNewFileListUpdateThread) # connect ComboBox change listener QtCore.QObject.connect( self.file_manager_ui.file_mirrors_bt, QtCore.SIGNAL('clicked()'), self.open_mirrors_list_window) # create bucket action # create bucket action # QtCore.QObject.connect(self.file_manager_ui.quit_bt, QtCore.SIGNAL('clicked()'), self.close) QtCore.QObject.connect( self.file_manager_ui.file_download_bt, QtCore.SIGNAL('clicked()'), self.open_single_file_download_window) # create bucket action QtCore.QObject.connect( self.file_manager_ui.file_delete_bt, QtCore.SIGNAL('clicked()'), self.delete_selected_file) # delete selected file self.connect(self, QtCore.SIGNAL("changeLoadingGif"), self.change_loading_gif) self.file_manager_ui.settings_bt.mousePressEvent = self.open_settings_window self.file_manager_ui.refresh_bt.mousePressEvent = self.createNewFileListUpdateThread # self.file_manager_ui.refresh_bt.mousePressEvent = self.createNewFileListUpdateThread() QtCore.QObject.connect( self.file_manager_ui.new_file_upload_bt, QtCore.SIGNAL('clicked()'), self.open_single_file_upload_window) # delete selected file # open bucket edit window QtCore.QObject.connect( self.file_manager_ui.edit_bucket_bt, QtCore.SIGNAL('clicked()'), lambda: self.open_bucket_editing_window(action='edit')) # open bucket edit window QtCore.QObject.connect( self.file_manager_ui.create_bucket_bt, QtCore.SIGNAL('clicked()'), lambda: self.open_bucket_editing_window(action='add')) self.storj_engine = StorjEngine() # init StorjEngine # self.account_manager = AccountManager() # init AccountManager user_email = self.storj_engine.account_manager.get_user_email() self.file_manager_ui.account_label.setText(str(user_email)) self.createNewBucketResolveThread()
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.ui_initial_window = Ui_InitialWindow() self.ui_initial_window.setupUi(self) # QtCore.QObject.connect(self.ui.pushButton_3, QtCore.SIGNAL("clicked()"), self.save_config) # open bucket manager self.storj_engine = StorjEngine() # init StorjEngine QtCore.QObject.connect(self.ui_initial_window.login_bt, QtCore.SIGNAL("clicked()"), self.open_login_window) # open login window QtCore.QObject.connect(self.ui_initial_window.register_bt, QtCore.SIGNAL("clicked()"), self.open_register_window) # open login window
def initialize_bucket_select_combobox(self): self.buckets_list = [] self.bucket_id_list = [] self.storj_engine = StorjEngine() # init StorjEngine i = 0 try: for bucket in self.storj_engine.storj_client.bucket_list(): self.buckets_list.append(str(bucket.name)) # append buckets to list self.bucket_id_list.append(str(bucket.id)) # append buckets to list i = i + 1 except sjexc.StorjBridgeApiError as e: QtGui.QMessageBox.about(self, "Unhandled bucket resolving exception", "Exception: " + str(e)) self.file_manager_ui.bucket_select_combo_box.addItems(self.buckets_list)
def __init__( self, parent=None, ): QtGui.QWidget.__init__(self, parent) self.account_dash_ui = Ui_AccountDash() self.account_dash_ui.setupUi(self) self.storj_engine = StorjEngine() # init StorjEngine self.tools = Tools() self.initialize_buckets_stats_table() self.createNewBucketsStatsGetThread()
def __init__(self, parent=None, nodeid=None): QtGui.QWidget.__init__(self, parent) self.storj_engine = StorjEngine() # init StorjEngine # login UI self.node_details_ui = Ui_NodeDetails() self.node_details_ui.setupUi(self) self.nodeid = nodeid self.tools = Tools() QtCore.QObject.connect(self.node_details_ui.ok_bt, QtCore.SIGNAL("clicked()"), self.close) # close window self.connect(self, QtCore.SIGNAL("showBridgeExceptionMessageBox"), self.show_storj_bridge_exception) self.createNewNodeDetailsResolveThread()
def initialize_buckets_select_list(self): logger.warning(str({"log_event_type": "info", "title": "Buckets", "description": "Resolving buckets from Bridge to buckets combobox..."})) self.buckets_list = [] self.bucket_id_list = [] self.storj_engine = StorjEngine() # init StorjEngine i = 0 try: for bucket in self.storj_engine.storj_client.bucket_list(): self.buckets_list.append(str(bucket.name)) # append buckets to list self.bucket_id_list.append(str(bucket.id)) # append buckets to list i = i + 1 except storj.exception.StorjBridgeApiError as e: QMessageBox.about(self, "Unhandled bucket resolving exception", "Exception: " + str(e)) self.ui_single_file_upload.save_to_bucket_select.addItems(self.buckets_list)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.bucket_create_ui = Ui_BucketCreate() self.bucket_create_ui.setupUi(self) QtCore.QObject.connect(self.bucket_create_ui.create_bucket_bt, QtCore.SIGNAL("clicked()"), self.createNewBucketCreateThread) # create bucket action QtCore.QObject.connect(self.bucket_create_ui.cancel_bt, QtCore.SIGNAL("clicked()"), self.close) # create bucket action self.connect(self, QtCore.SIGNAL('showBucketCreatingException'), self.show_bucket_creating_exception_dialog) self.connect(self, QtCore.SIGNAL('showBucketCreatedSuccessfully'), self.show_bucket_crated_successfully) self.connect( self, QtCore.SIGNAL('showBucketCreationMissingFields'), lambda: QtGui.QMessageBox.about( self, "Warning", "Please fill out all fields!")) self.storj_engine = StorjEngine() # init StorjEngine
def __init__(self, parent=None, bucketid=None, action=None, dashboard_instance=None): QtGui.QWidget.__init__(self, parent) self.bucket_create_ui = Ui_BucketEditing() self.bucket_create_ui.setupUi(self) self.bucket_id = bucketid QtCore.QObject.connect( self.bucket_create_ui.cancel_bt, QtCore.SIGNAL('clicked()'), self.close) self.connect(self, QtCore.SIGNAL('printBucketDetails'), self.set_bucket_details) self.connect(self, QtCore.SIGNAL('showBucketCreatingException'), self.show_bucket_creating_exception_dialog) self.connect(self, QtCore.SIGNAL('showBucketCreatedSuccessfully'), self.show_bucket_created_successfully) self.connect(self, QtCore.SIGNAL('showBucketDeletedSuccessfully'), self.show_bucket_deleted_successfully) self.connect(self, QtCore.SIGNAL('showBucketUpdatedSuccessfully'), self.show_bucket_updated_successfully) self.connect(self, QtCore.SIGNAL('showBucketCreationMissingFields'), lambda: QtGui.QMessageBox.about(self, 'Warning', 'Please fill out all fields!')) self.dashboard_instance = dashboard_instance self.storj_engine = StorjEngine() if action == 'add': # create bucket action QtCore.QObject.connect( self.bucket_create_ui.create_edit_bucket_bt, QtCore.SIGNAL('clicked()'), self.createNewBucketCreateThread) self.bucket_create_ui.create_edit_bucket_bt.setText('CREATE') self.bucket_create_ui.remove_bucket_bt.setVisible(False) self.setWindowTitle('Add bucket - Storj GUI') else: self.createBucketDetailsLoadThread() # edit bucket action QtCore.QObject.connect(self.bucket_create_ui.create_edit_bucket_bt, QtCore.SIGNAL('clicked()'), lambda: self.createNewBucketEditThread()) # remove bucket action QtCore.QObject.connect(self.bucket_create_ui.remove_bucket_bt, QtCore.SIGNAL('clicked()'), self.createNewBucketRemoveThread) self.bucket_create_ui.create_edit_bucket_bt.setText('SAVE')
def initialize_buckets_select_list(self): """Get all the buckets in which it is possible to store files, and show the names in the dropdown list""" self.__logger.debug('Buckets') self.__logger.debug( 'Resolving buckets from Bridge to buckets combobox...') self.buckets_list = [] self.bucket_id_list = [] self.bucket_id_name_2D_list = [] self.storj_engine = StorjEngine() try: for bucket in self.storj_engine.storj_client.bucket_list(): self.bucket_id_name_2D_list.append([ str(bucket.id), str(bucket.name).decode('utf8') ]) # append buckets to list if BUCKETS_LIST_SORTING_ENABLED: self.bucket_id_name_2D_list = sorted( self.bucket_id_name_2D_list, key=lambda x: x[1], reverse=False) for arr_data in self.bucket_id_name_2D_list: self.buckets_list.append(arr_data[1]) self.bucket_id_list.append(arr_data[0]) except storj.exception.StorjBridgeApiError as e: self.__logger.error(e) QMessageBox.about(self, 'Unhandled bucket resolving exception', 'Exception: %s' % e) self.ui_single_file_upload.save_to_bucket_select.addItems( self.buckets_list) if APPLY_SELECTED_BUCKET_TO_UPLOADER: self.ui_single_file_upload.save_to_bucket_select.setCurrentIndex( int(self.dashboard_instance.current_bucket_index))
def initialize_bucket_select_combobox(self): self.file_manager_ui.bucket_select_combo_box.clear() self.buckets_list = [] self.bucket_id_list = [] self.storj_engine = StorjEngine() # init StorjEngine i = 0 self.emit(QtCore.SIGNAL("changeLoadingGif"), True) try: for bucket in self.storj_engine.storj_client.bucket_list(): self.buckets_list.append(str( bucket.name).decode('utf8')) # append buckets to list self.bucket_id_list.append(str( bucket.id)) # append buckets to list i = i + 1 except sjexc.StorjBridgeApiError as e: self.__logger.error(e) QtGui.QMessageBox.about(self, 'Unhandled bucket resolving exception', 'Exception: ' % e) self.file_manager_ui.bucket_select_combo_box.addItems( self.buckets_list) self.emit(QtCore.SIGNAL("changeLoadingGif"), False)
def __init__(self, parent=None, bucketid=None, fileid=None, filename=None): QtGui.QWidget.__init__(self, parent) self.file_mirrors_list_ui = Ui_FileMirrorsList() self.file_mirrors_list_ui.setupUi(self) # model = self.file_mirrors_list_ui.established_mirrors_tree.model() self.file_mirrors_list_ui.mirror_details_bt.clicked.connect( lambda: self.open_mirror_details_window("established")) self.file_mirrors_list_ui.mirror_details_bt_2.clicked.connect( lambda: self.open_mirror_details_window("available")) self.file_mirrors_list_ui.quit_bt.clicked.connect(self.close) self.connect(self, QtCore.SIGNAL("showStorjBridgeException"), self.show_storj_bridge_exception) self.connect(self, QtCore.SIGNAL("showUnhandledException"), self.show_unhandled_exception) self.connect(self, QtCore.SIGNAL("changeLoadingGif"), self.change_loading_gif) # self.connect(self.file_mirrors_list_ui.established_mirrors_tree, QtCore.SIGNAL("selectionChanged(QItemSelection, QItemSelection)"), self.open_mirror_details_window) # self.connect(self.file_mirrors_list_ui.established_mirrors_tree, QtCore.SIGNAL('selectionChanged()'), self.open_mirror_details_window) # QtCore.QObject.connect(self.file_mirrors_list_ui.established_mirrors_tree.selectionModel(), QtCore.SIGNAL('selectionChanged(QItemSelection, QItemSelection)'), # self.open_mirror_details_window) # self.file_mirrors_list_ui.established_mirrors_tree. self.bucketid = bucketid self.fileid = fileid self.filename = str(filename).decode('utf-8') self.file_mirrors_list_ui.file_id.setText(str(self.fileid)) self.file_mirrors_list_ui.file_name.setText(str(self.filename).decode('utf-8')) logger.info(self.fileid) self.storj_engine = StorjEngine() # init StorjEngine self.createNewMirrorListInitializationThread()
def __init__(self, parent=None, bucketid=None, fileid=None): QtGui.QWidget.__init__(self, parent) self.ui_single_file_download = Ui_SingleFileDownload() self.ui_single_file_download.setupUi(self) # QtCore.QObject.connect(self.ui_single_file_download., QtCore.SIGNAL("clicked()"), self.save_config) # open bucket manager self.storj_engine = StorjEngine() # init StorjEngine self.tools = Tools() # init loggers # self.log_handler = LogHandler() # logging.setLoggerClass(get_global_logger(self.log_handler)) # logger.addHandler(self.log_handler) # self.initialize_shard_queue_table(file_pointers) self.account_manager = AccountManager() # init AccountManager self.user_password = self.account_manager.get_user_password() ########3 QtCore.QObject.connect( self.ui_single_file_download.file_save_path_bt, QtCore.SIGNAL("clicked()"), self.select_file_save_path) # open file select dialog QtCore.QObject.connect( self.ui_single_file_download.tmp_dir_bt, QtCore.SIGNAL("clicked()"), self.select_tmp_directory) # open tmp directory select dialog QtCore.QObject.connect( self.ui_single_file_download.start_download_bt, QtCore.SIGNAL("clicked()"), lambda: self.createNewDownloadInitThread( bucketid, fileid)) # begin file downloading process # QtCore.QObject.connect(self.ui_single_file_download.open_log_bt, QtCore.SIGNAL("clicked()"), # self.open_logs_window) # open logs window self.connect(self, QtCore.SIGNAL("incrementShardsDownloadProgressCounters"), self.increment_shards_download_progress_counters) self.connect(self, QtCore.SIGNAL("updateShardDownloadProgress"), self.update_shard_download_progess) self.connect(self, QtCore.SIGNAL("beginDownloadProccess"), self.download_begin) self.connect(self, QtCore.SIGNAL("refreshOverallDownloadProgress"), self.refresh_overall_download_progress) self.connect(self, QtCore.SIGNAL("showDestinationFileNotSelectedError"), self.show_error_not_selected_file) self.connect(self, QtCore.SIGNAL("showInvalidDestinationPathError"), self.show_error_invalid_file_path) self.connect(self, QtCore.SIGNAL("showInvalidTemporaryDownloadPathError"), self.show_error_invalid_temporary_path) self.connect(self, QtCore.SIGNAL("updateDownloadTaskState"), self.update_download_task_state) self.connect(self, QtCore.SIGNAL("showStorjBridgeException"), self.show_storj_bridge_exception) self.connect(self, QtCore.SIGNAL("showUnhandledException"), self.show_unhandled_exception) self.connect(self, QtCore.SIGNAL("showFileDownloadedSuccessfully"), self.show_download_finished_message) self.shards_already_downloaded = 0 self.createNewInitializationThread(bucketid, fileid) self.shard_download_percent_list = [] # init limit variables self.max_retries_download_from_same_farmer = 3 self.max_retries_get_file_pointers = 10 # set default paths self.ui_single_file_download.tmp_dir.setText(str("/tmp/")) # set config variables self.combine_tmpdir_name_with_token = False # set overall progress to 0 self.ui_single_file_download.overall_progress.setValue(0)
def __init__(self, parent=None, bucketid=None, fileid=None): QtGui.QWidget.__init__(self, parent) self.ui_single_file_download = Ui_SingleFileDownload() self.ui_single_file_download.setupUi(self) # QtCore.QObject.connect(self.ui_single_file_download., QtCore.SIGNAL("clicked()"), self.save_config) # open bucket manager self.storj_engine = StorjEngine() # init StorjEngine self.filename_from_bridge = "" self.tools = Tools() self.bucket_id = bucketid self.file_id = fileid # init loggers # self.log_handler = LogHandler() # logging.setLoggerClass(get_global_logger(self.log_handler)) # logger.addHandler(self.log_handler) # self.initialize_shard_queue_table(file_pointers) self.is_upload_active = False self.account_manager = AccountManager() # init AccountManager self.user_password = self.account_manager.get_user_password() ########3 QtCore.QObject.connect( self.ui_single_file_download.file_path_select_bt, QtCore.SIGNAL("clicked()"), self.select_file_save_path) # open file select dialog QtCore.QObject.connect( self.ui_single_file_download.tmp_dir_bt, QtCore.SIGNAL("clicked()"), self.select_tmp_directory) # open tmp directory select dialog QtCore.QObject.connect( self.ui_single_file_download.cancel_bt, QtCore.SIGNAL("clicked()"), self.handle_cancel_action) # open tmp directory select dialog QtCore.QObject.connect( self.ui_single_file_download.start_download_bt, QtCore.SIGNAL("clicked()"), lambda: self.createNewDownloadInitThread( bucketid, fileid)) # begin file downloading process # print fileid + " id pliku" # QtCore.QObject.connect(self.ui_single_file_download.open_log_bt, QtCore.SIGNAL("clicked()"), # self.open_logs_window) # open logs window self.connect(self, QtCore.SIGNAL("incrementShardsDownloadProgressCounters"), self.increment_shards_download_progress_counters) self.connect(self, QtCore.SIGNAL("updateShardDownloadProgress"), self.update_shard_download_progess) self.connect(self, QtCore.SIGNAL("beginShardDownloadProccess"), self.shard_download) self.connect(self, QtCore.SIGNAL("refreshOverallDownloadProgress"), self.refresh_overall_download_progress) self.connect(self, QtCore.SIGNAL("showDestinationFileNotSelectedError"), self.show_error_not_selected_file) self.connect(self, QtCore.SIGNAL("showInvalidDestinationPathError"), self.show_error_invalid_file_path) self.connect(self, QtCore.SIGNAL("showInvalidTemporaryDownloadPathError"), self.show_error_invalid_temporary_path) self.connect(self, QtCore.SIGNAL("updateDownloadTaskState"), self.update_download_task_state) self.connect(self, QtCore.SIGNAL("showStorjBridgeException"), self.show_storj_bridge_exception) self.connect(self, QtCore.SIGNAL("showUnhandledException"), self.show_unhandled_exception) self.connect(self, QtCore.SIGNAL("showFileDownloadedSuccessfully"), self.show_download_finished_message) self.connect(self, QtCore.SIGNAL("showException"), self.show_unhandled_exception) self.connect(self, QtCore.SIGNAL("addRowToDownloadQueueTable"), self.add_row_download_queue_table) self.connect(self, QtCore.SIGNAL("getNextSetOfPointers"), self.request_and_download_next_set_of_pointers) self.connect(self, QtCore.SIGNAL("setCurrentState"), self.set_current_status) self.connect(self, QtCore.SIGNAL("updateShardCounters"), self.update_shards_counters) self.connect(self, QtCore.SIGNAL("retryWithNewDownloadPointer"), self.retry_download_with_new_pointer) self.connect(self, QtCore.SIGNAL("showDestinationPathNotSelectedMsg"), self.show_error_invalid_file_path) self.connect(self, QtCore.SIGNAL("selectFileDestinationPath"), self.select_file_save_path) self.connect(self, QtCore.SIGNAL("askFileOverwrite"), self.ask_overwrite) self.connect( self, QtCore.SIGNAL("finishDownload"), lambda: self.create_download_finish_thread( str( os.path.split( str(self.ui_single_file_download.file_save_path.text()) )[1]).decode('utf-8'))) self.overwrite_question_result = None self.overwrite_question_closed = False self.ui_single_file_download.current_state.setText( "Waiting for user action...") self.ui_single_file_download.downloaded_shards.setText( "Waiting for user...") self.shards_already_downloaded = 0 self.createNewInitializationThread(bucketid, fileid) self.shard_download_percent_list = [] # init limit variables self.max_retries_download_from_same_farmer = 3 self.max_retries_get_file_pointers = 30 # set default paths temp_dir = "" if platform == "linux" or platform == "linux2": # linux temp_dir = "/tmp/" elif platform == "darwin": # OS X temp_dir = "/tmp/" elif platform == "win32": # Windows temp_dir = "C:\\Windows\\temp\\" self.ui_single_file_download.tmp_dir.setText(str(temp_dir)) # set config variables self.combine_tmpdir_name_with_token = False # set overall progress to 0 self.ui_single_file_download.overall_progress.setValue(0) self.current_active_connections = 0 self.already_started_shard_downloads_count = 0 self.all_shards_count = 0
def __init__(self, parent=None, bucketid=None, fileid=None, dashboard_instance=None): QtGui.QWidget.__init__(self, parent) self.ui_single_file_upload = Ui_SingleFileUpload() self.ui_single_file_upload.setupUi(self) # open bucket manager QtCore.QObject.connect(self.ui_single_file_upload.start_upload_bt, QtCore.SIGNAL('clicked()'), self.createNewUploadThread) # open file select dialog QtCore.QObject.connect(self.ui_single_file_upload.file_path_select_bt, QtCore.SIGNAL('clicked()'), self.select_file_path) # open tmp directory select dialog QtCore.QObject.connect(self.ui_single_file_upload.tmp_path_select_bt, QtCore.SIGNAL('clicked()'), self.select_tmp_directory) # handle cancel action QtCore.QObject.connect(self.ui_single_file_upload.cancel_bt, QtCore.SIGNAL('clicked()'), self.handle_cancel_action) self.already_used_farmers_nodes = [] self.tools = Tools() self.storj_engine = StorjEngine() self.initialize_upload_queue_table() self.dashboard_instance = dashboard_instance self.ui_single_file_upload.uploaded_shards.setText("Waiting...") self.is_upload_active = False self.current_active_connections = 0 self.ui_single_file_upload.connections_onetime.setValue( int(MAX_UPLOAD_CONNECTIONS_AT_SAME_TIME) ) # user can set it manually default value from constants file if platform == 'linux' or platform == 'linux2': # linux self.temp_dir = '/tmp' elif platform == 'darwin': # OS X self.temp_dir = '/tmp' elif platform == 'win32': # Windows self.temp_dir = 'C:\\Windows\\temp\\' self.ui_single_file_upload.tmp_path.setText(self.temp_dir) # initialize variables self.shards_already_uploaded = 0 self.uploaded_shards_count = 0 self.upload_queue_progressbar_list = [] self.connect(self, QtCore.SIGNAL('addRowToUploadQueueTable'), self.add_row_upload_queue_table) self.connect(self, QtCore.SIGNAL('incrementShardsProgressCounters'), self.increment_shards_progress_counters) self.connect(self, QtCore.SIGNAL('updateUploadTaskState'), self.update_upload_task_state) self.connect(self, QtCore.SIGNAL('updateShardUploadProgress'), self.update_shard_upload_progess) self.connect(self, QtCore.SIGNAL('showFileNotSelectedError'), self.show_error_not_selected_file) self.connect(self, QtCore.SIGNAL('showInvalidPathError'), self.show_error_invalid_file_path) self.connect(self, QtCore.SIGNAL('showInvalidTemporaryPathError'), self.show_error_invalid_temporary_path) self.connect(self, QtCore.SIGNAL('refreshOverallProgress'), self.refresh_overall_progress) self.connect(self, QtCore.SIGNAL('showFileUploadedSuccessfully'), self.show_upload_finished_message) self.connect( self, QtCore.SIGNAL('finishUpload'), lambda: self.finish_upload( os.path.split(str(self.ui_single_file_upload.file_path.text())) [1], str(self.current_selected_bucket_id))) self.connect(self, QtCore.SIGNAL('setCurrentUploadState'), self.set_current_status) self.connect(self, QtCore.SIGNAL('updateShardUploadCounters'), self.update_shards_counters) self.connect(self, QtCore.SIGNAL('setCurrentActiveConnections'), self.set_current_active_connections) self.connect(self, QtCore.SIGNAL('setShardSize'), self.set_shard_size) self.connect(self, QtCore.SIGNAL('createShardUploadThread'), self.createNewShardUploadThread) # self.connect(self, QtCore.SIGNAL('handleCancelAction'), self.ha) # resolve buckets and put to buckets combobox self.createBucketResolveThread() self.ui_single_file_upload.files_list_view_bt.mousePressEvent = self.display_files_queue_change self.is_files_queue_table_visible = False # self.emit(QtCore.SIGNAL("addRowToUploadQueueTable"), "important", "information") # self.emit(QtCore.SIGNAL("addRowToUploadQueueTable"), "important", "information") # self.emit(QtCore.SIGNAL("incrementShardsProgressCounters")) # self.initialize_shard_queue_table(file_pointers) self.shard_upload_percent_list = [] self.ui_single_file_upload.overall_progress.setValue(0) self.prepare_files_queue_table() self.clip = QtGui.QApplication.clipboard() self.ui_single_file_upload.connections_onetime.setMaximum( MAX_ALLOWED_UPLOAD_CONCURRENCY) if DATA_TABLE_EDIT_ENABLED == False: self.ui_single_file_upload.shard_queue_table_widget.setEditTriggers( QtGui.QAbstractItemView.NoEditTriggers) self.current_row = 0
def __init__(self, parent=None, bucketid=None, fileid=None): QtGui.QWidget.__init__(self, parent) self.ui_single_file_upload = Ui_SingleFileUpload() self.ui_single_file_upload.setupUi(self) QtCore.QObject.connect(self.ui_single_file_upload.start_upload_bt, QtCore.SIGNAL("clicked()"), self.createNewUploadThread) # open bucket manager QtCore.QObject.connect(self.ui_single_file_upload.file_path_select_bt, QtCore.SIGNAL("clicked()"), self.select_file_path) # open file select dialog QtCore.QObject.connect(self.ui_single_file_upload.tmp_path_select_bt, QtCore.SIGNAL("clicked()"), self.select_tmp_directory) # open tmp directory select dialog self.storj_engine = StorjEngine() # init StorjEngine self.initialize_upload_queue_table() # init loggers # self.log_handler = LogHandler() # logging.setLoggerClass(get_global_logger(self.log_handler)) # logger.addHandler(self.log_handler) self.account_manager = AccountManager() # init AccountManager self.user_password = self.account_manager.get_user_password() if platform == "linux" or platform == "linux2": # linux self.ui_single_file_upload.tmp_path.setText(str("/tmp/")) elif platform == "darwin": # OS X self.ui_single_file_upload.tmp_path.setText(str("/tmp/")) elif platform == "win32": # Windows self.ui_single_file_upload.tmp_path.setText(str("C://Windows/temp/")) # initialize variables self.shards_already_uploaded = 0 self.uploaded_shards_count = 0 self.upload_queue_progressbar_list = [] self.connect(self, SIGNAL("addRowToUploadQueueTable"), self.add_row_upload_queue_table) self.connect(self, SIGNAL("incrementShardsProgressCounters"), self.increment_shards_progress_counters) self.connect(self, SIGNAL("updateUploadTaskState"), self.update_upload_task_state) self.connect(self, SIGNAL("updateShardUploadProgress"), self.update_shard_upload_progess) self.connect(self, SIGNAL("showFileNotSelectedError"), self.show_error_not_selected_file) self.connect(self, SIGNAL("showInvalidPathError"), self.show_error_invalid_file_path) self.connect(self, SIGNAL("showInvalidTemporaryPathError"), self.show_error_invalid_temporary_path) self.connect(self, SIGNAL("refreshOverallProgress"), self.refresh_overall_progress) self.connect(self, SIGNAL("showFileUploadedSuccessfully"), self.show_upload_finished_message) self.createBucketResolveThread() # resolve buckets and put to buckets combobox # file_pointers = self.storj_engine.storj_client.file_pointers("6acfcdc62499144929cf9b4a", "dfba26ab34466b1211c60d02") # self.emit(SIGNAL("addRowToUploadQueueTable"), "important", "information") # self.emit(SIGNAL("addRowToUploadQueueTable"), "important", "information") # self.emit(SIGNAL("incrementShardsProgressCounters")) self.max_retries_upload_to_same_farmer = 3 self.max_retries_negotiate_contract = 10 # # print self.config.max_retries_upload_to_same_farmer # self.initialize_shard_queue_table(file_pointers) self.shard_upload_percent_list = [] self.ui_single_file_upload.overall_progress.setValue(0)
def __init__(self, parent=None, bucketid=None, fileid=None, dashboard_instance=None): QtGui.QWidget.__init__(self, parent) self.ui_single_file_upload = Ui_SingleFileUpload() self.ui_single_file_upload.setupUi(self) # open bucket manager QtCore.QObject.connect( self.ui_single_file_upload.start_upload_bt, QtCore.SIGNAL('clicked()'), self.createNewUploadThread) # open file select dialog QtCore.QObject.connect( self.ui_single_file_upload.file_path_select_bt, QtCore.SIGNAL('clicked()'), self.select_file_path) # open tmp directory select dialog QtCore.QObject.connect( self.ui_single_file_upload.tmp_path_select_bt, QtCore.SIGNAL('clicked()'), self.select_tmp_directory) # handle cancel action QtCore.QObject.connect( self.ui_single_file_upload.cancel_bt, QtCore.SIGNAL('clicked()'), self.handle_cancel_action) self.tools = Tools() self.storj_engine = StorjEngine() self.initialize_upload_queue_table() self.dashboard_instance = dashboard_instance self.ui_single_file_upload.uploaded_shards.setText("Waiting...") self.is_upload_active = False self.current_active_connections = 0 if platform == 'linux' or platform == 'linux2': # linux self.temp_dir = '/tmp' elif platform == 'darwin': # OS X self.temp_dir = '/tmp' elif platform == 'win32': # Windows self.temp_dir = 'C:\\Windows\\temp\\' self.ui_single_file_upload.tmp_path.setText(self.temp_dir) # initialize variables self.shards_already_uploaded = 0 self.uploaded_shards_count = 0 self.upload_queue_progressbar_list = [] self.connect(self, QtCore.SIGNAL('addRowToUploadQueueTable'), self.add_row_upload_queue_table) self.connect(self, QtCore.SIGNAL('incrementShardsProgressCounters'), self.increment_shards_progress_counters) self.connect(self, QtCore.SIGNAL('updateUploadTaskState'), self.update_upload_task_state) self.connect(self, QtCore.SIGNAL('updateShardUploadProgress'), self.update_shard_upload_progess) self.connect(self, QtCore.SIGNAL('showFileNotSelectedError'), self.show_error_not_selected_file) self.connect(self, QtCore.SIGNAL('showInvalidPathError'), self.show_error_invalid_file_path) self.connect(self, QtCore.SIGNAL('showInvalidTemporaryPathError'), self.show_error_invalid_temporary_path) self.connect(self, QtCore.SIGNAL('refreshOverallProgress'), self.refresh_overall_progress) self.connect(self, QtCore.SIGNAL('showFileUploadedSuccessfully'), self.show_upload_finished_message) self.connect(self, QtCore.SIGNAL('finishUpload'), lambda: self.finish_upload(os.path.split( str(self.ui_single_file_upload.file_path.text()))[1], str(self.current_selected_bucket_id))) self.connect(self, QtCore.SIGNAL('setCurrentUploadState'), self.set_current_status) self.connect(self, QtCore.SIGNAL('updateShardUploadCounters'), self.update_shards_counters) self.connect(self, QtCore.SIGNAL('setCurrentActiveConnections'), self.set_current_active_connections) self.connect(self, QtCore.SIGNAL('setShardSize'), self.set_shard_size) #self.connect(self, QtCore.SIGNAL('handleCancelAction'), self.ha) # resolve buckets and put to buckets combobox self.createBucketResolveThread() # file_pointers = self.storj_engine.storj_client.file_pointers( # "6acfcdc62499144929cf9b4a", "dfba26ab34466b1211c60d02") # self.emit(QtCore.SIGNAL("addRowToUploadQueueTable"), "important", "information") # self.emit(QtCore.SIGNAL("addRowToUploadQueueTable"), "important", "information") # self.emit(QtCore.SIGNAL("incrementShardsProgressCounters")) self.max_retries_upload_to_same_farmer = MAX_RETRIES_UPLOAD_TO_SAME_FARMER self.max_retries_negotiate_contract = MAX_RETRIES_NEGOTIATE_CONTRACT # self.initialize_shard_queue_table(file_pointers) self.shard_upload_percent_list = [] self.ui_single_file_upload.overall_progress.setValue(0)