def delete_watch_from_watch_folders_dict(self, sobject_item): buttons = (('Remove', QtGui.QMessageBox.YesRole), ('Keep', QtGui.QMessageBox.ActionRole), ('Cancel', QtGui.QMessageBox.NoRole)) reply = gf.show_message_predefined( 'Remove Watch Folder dirs from repos?', 'Watch Folder Directories and Files can also be removed from Your Repositories' '<br>Remove or Keep this Dirs and Files?</br>', buttons=buttons, message_type='question') delete_files = False delete_watch_folder = False if reply == QtGui.QMessageBox.YesRole: delete_files = True delete_watch_folder = True elif reply == QtGui.QMessageBox.ActionRole: delete_files = False delete_watch_folder = True if delete_watch_folder: self.stop_watch_by_skey(sobject_item.sobject.get_search_key()) idx = self.get_watch_dict_by_skey( sobject_item.sobject.get_search_key())['idx'] self.watch_folders_dict['assets_names'].pop(idx) self.watch_folders_dict['assets_codes'].pop(idx) self.watch_folders_dict['assets_stypes'].pop(idx) self.watch_folders_dict['assets_skeys'].pop(idx) self.watch_folders_dict['assets_pipelines'].pop(idx) self.watch_folders_dict['paths'].pop(idx) repos = self.watch_folders_dict['repos'].pop(idx) self.watch_folders_dict['statuses'].pop(idx) sobject_item.check_watch_folder(True) self.writeSettings() if delete_files: self.delete_watch_folders_and_files(repos, sobject_item)
def add_item_to_queue(self, args_dict, commit_queue_ui=None): if not self.check_for_duplicates(args_dict): commit_item = gf.add_commit_item(self.filesQueueTreeWidget, args_dict['item_widget']) commit_item.set_args_dict(args_dict) self.queue_list.append(commit_item) commit_widget = commitWidget(args_dict=args_dict, commit_queue_ui=commit_queue_ui) commit_item.set_commit_widget(commit_widget) commit_item.fill_info() commit_widget.set_commit_item(commit_item) self.set_current_commit_widget(commit_widget) else: buttons = (('Update', QtGui.QMessageBox.YesRole), ('Cancel', QtGui.QMessageBox.NoRole)) reply = gf.show_message_predefined( 'Already in Commit Queue?', 'File you are trying to Save already ' 'in Commit Queue.<br>Update This commit?</br>', buttons=buttons, message_type='question' ) if reply == QtGui.QMessageBox.YesRole: commit_item = self.check_for_duplicates(args_dict) commit_item.set_args_dict(args_dict) commit_item.fill_info() old_commit_widget = commit_item.get_commit_widget() old_commit_widget.close() old_commit_widget.deleteLater() commit_widget = commitWidget(args_dict) commit_item.set_commit_widget(commit_widget) commit_item.fill_info() commit_widget.set_commit_item(commit_item) self.set_current_commit_widget(commit_widget)
def closeEvent(self, event): if not self.sync_in_progress: self.writeSettings() self.deleteLater() self.refresh_search_widget() event.accept() else: buttons = (('Ok', QtGui.QMessageBox.NoRole), ('Interrupt', QtGui.QMessageBox.ActionRole)) reply = gf.show_message_predefined( title='Download in Progress', message='Some files are not yet Downloaded.\nInterrupt the Sync Process?.', buttons=buttons, parent=self, message_type='question', ) if reply == QtGui.QMessageBox.ActionRole: self.interrupt_sync_process() self.deleteLater() event.accept() else: event.ignore()
def delete_preset_from_server(self, preset_name=None): if not preset_name: idx = self.presets_combo_box.currentIndex() preset_name = self.presets_combo_box.itemData(idx) # ask before delete buttons = (('Yes', QtGui.QMessageBox.YesRole), ('Cancel', QtGui.QMessageBox.NoRole)) reply = gf.show_message_predefined( 'Removing preset from server', u'Are You sure want to remove <b>" {0} "</b> preset from Server?'.format(preset_name), buttons=buttons, message_type='question', parent=self ) if reply == QtGui.QMessageBox.YesRole: server = tc.server_start() data = self.get_preset_config(preset_name) search_type = 'sthpw/wdg_settings' # Checking for existing key filters = [('key', data['key'])] columns = ['code', 'project'] widget_settings = server.query(search_type, filters, columns, single=True) search_key = widget_settings['__search_key__'] server.delete_sobject(search_key) self.get_all_presets_from_server() self.fill_presets_combo_box(preset_name)