Пример #1
0
 def model_run(self, model_context):
     from camelot.view import action_steps
     admin = model_context.field_attributes['admin']
     selected_objects = yield action_steps.SelectObjects(admin)
     for selected_object in selected_objects:
         yield action_steps.UpdateEditor('selected_object', selected_object)
         break
Пример #2
0
 def model_run(self, model_context):
     from camelot.view import action_steps
     buttons = QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No
     answer = yield action_steps.MessageBox(title=self.message_title,
                                            text=self.message_text,
                                            standard_buttons=buttons)
     if answer == QtWidgets.QMessageBox.Yes:
         yield action_steps.UpdateEditor('value', None, propagate=True)
Пример #3
0
 def model_run(self, model_context):
     from camelot.view import action_steps
     admin = model_context.field_attributes['admin']
     admin = yield action_steps.SelectSubclass(admin)
     obj = admin.entity()
     # Give the default fields their value
     admin.add(obj)
     admin.set_defaults(obj)
     yield action_steps.UpdateEditor('new_value', obj)
     yield action_steps.OpenFormView([obj], admin)
Пример #4
0
 def model_run(self, model_context):
     from camelot.view import action_steps
     filenames = yield action_steps.SelectFile(self.file_name_filter)
     storage = model_context.field_attributes['storage']
     for file_name in filenames:
         remove = False
         if model_context.field_attributes.get('remove_original'):
             reply = yield action_steps.MessageBox(
                 text=_('Do you want to remove the original file?'),
                 icon=QtWidgets.QMessageBox.Warning,
                 title=_('The file will be stored.'),
                 standard_buttons=QtWidgets.QMessageBox.No
                 | QtWidgets.QMessageBox.Yes)
             if reply == QtWidgets.QMessageBox.Yes:
                 remove = True
         yield action_steps.UpdateProgress(text='Attaching file')
         stored_file = storage.checkin(file_name)
         yield action_steps.UpdateEditor('value',
                                         stored_file,
                                         propagate=True)
         if remove:
             os.remove(file_name)
Пример #5
0
 def model_run(self, model_context):
     from camelot.view import action_steps
     yield action_steps.UpdateEditor('selected_object', None)