Esempio n. 1
0
    def create_widgets_ui(self, result_dict):
        self.toggle_loading_label()

        input_widgets_list = []
        if self.item:
            result_dict['EditWdg']['sobject'] = self.item.get_sobject()
            result_dict['EditWdg'][
                'parent_sobject'] = self.item.get_parent_sobject()

        tactic_edit_widget = tw.TacticEditWdg(result_dict['EditWdg'])
        tactic_edit_widget.set_stype(self.stype)

        self.edit_window = twc.QtTacticEditWidget(
            tactic_widget=tactic_edit_widget,
            qt_widgets=input_widgets_list,
            stype=self.stype,
            parent=self)

        for widget_dict in result_dict['InputWidgets']:

            tactic_widget_name = tw.get_widget_name(widget_dict['class_name'],
                                                    'input')

            widget_dict['sobject'] = result_dict['EditWdg'].get('sobject')
            widget_dict['parent_sobject'] = result_dict['EditWdg'].get(
                'parent_sobject')

            if not tactic_widget_name:
                tactic_widget_name = 'TacticCurrentCheckboxWdg'

            tactic_widget = getattr(tw, tactic_widget_name)
            qt_widget = getattr(twc, 'Q{0}'.format(tactic_widget_name))

            widget_dict['stype'] = self.stype

            tactic_widget_instance = tactic_widget(options_dict=widget_dict)
            qt_widget_instance = qt_widget(
                tactic_widget=tactic_widget_instance, parent=self.edit_window)

            # print '**************************************DEBUGINFO******************************************'
            # print qt_widget_instance, tactic_widget_instance
            # from pprint import pprint
            # pprint(widget_dict)

            input_widgets_list.append(qt_widget_instance)

        self.grid_layout.addWidget(self.edit_window)

        self.edit_window.create_ui()

        self.readSettings()
Esempio n. 2
0
    def begin_inst(self):

        # tactic_edit_widget = tw.TacticEditWdg(wdg_dict)
        print self.stype.get_code()
        # tactic_edit_widget.set_stype(self.stype)

        # {u'episode_code': u'EPISODE00010', u'name': u'test'}

        lst = {}
        for i, ep in enumerate(sorted(lst.keys())):
            print ep, i, 'out of:', len(lst)
            data = {'name': ep}
            wd = {
                u'input_prefix':
                u'insert',
                u'element_titles':
                [u'Preview', u'Name', u'Description', u'Keywords'],
                u'title':
                u'',
                u'element_names':
                [u'preview', u'name', u'description', u'keywords'],
                u'kwargs': {
                    u'search_type': u'melnitsapipeline/episode',
                    u'code': u'',
                    u'title_width': u'',
                    u'parent_key': None,
                    u'title': u'',
                    u'default': u'',
                    u'search_key': u'',
                    u'input_prefix': u'insert',
                    u'config_base': u'',
                    u'single': u'',
                    u'cbjs_edit_path': u'',
                    u'access': u'',
                    u'width': u'',
                    u'show_header': u'',
                    u'cbjs_cancel': u'',
                    u'mode': u'insert',
                    u'cbjs_insert_path': u'',
                    u'ignore': u'',
                    u'show_action': u'',
                    u'search_id': u'',
                    u'view': u'insert'
                },
                u'element_descriptions':
                [None, u'Name', u'Description', u'Keywords'],
                u'mode':
                u'insert',
                u'security_denied':
                False
            }
            tactic_edit_widget = tw.TacticEditWdg(wd)
            tactic_edit_widget.set_stype(
                self.stype.project.get_stypes()['melnitsapipeline/episode'])

            episode_sobj = tactic_edit_widget.commit(data)
            print episode_sobj
            for j, sc in enumerate(sorted(lst[ep])):
                print sc, j, 'out of:', len(ep)

                sc['episode_code'] = episode_sobj['code']

                scene_sobj = self.edit_window.tactic_widget.commit(sc)
                print scene_sobj
Esempio n. 3
0
    def edit_my_account(self):

        import thlib.tactic_widgets as tw
        import thlib.ui_classes.ui_tactic_widgets_classes as twc

        wd = {
            u'input_prefix': u'insert',
            u'element_titles':
            [u'Preview', u'Name', u'Description', u'Keywords'],
            u'title': u'',
            u'element_names':
            [u'preview', u'name', u'description', u'keywords'],
            u'kwargs': {
                u'search_type': u'melnitsapipeline/episode',
                u'code': u'',
                u'title_width': u'',
                u'parent_key': None,
                u'title': u'',
                u'default': u'',
                u'search_key': u'',
                u'input_prefix': u'insert',
                u'config_base': u'',
                u'single': u'',
                u'cbjs_edit_path': u'',
                u'access': u'',
                u'width': u'',
                u'show_header': u'',
                u'cbjs_cancel': u'',
                u'mode': u'insert',
                u'cbjs_insert_path': u'',
                u'ignore': u'',
                u'show_action': u'',
                u'search_id': u'',
                u'view': u'insert'
            },
            u'element_descriptions':
            [None, u'Name', u'Description', u'Keywords'],
            u'mode': u'insert',
            u'security_denied': False
        }
        tactic_edit_widget = tw.TacticEditWdg(wd)
        tactic_edit_widget.set_stype(
            env_inst.get_current_stypes()['tactichandler/bug'])

        input_widgets_list = []

        class Item(object):
            def __init__(self):
                self.get_pipeline = None
                self.type = 'fake'

        self.item = Item()

        # class item(object):
        def get_pipeline():
            return None

        self.item.get_pipeline = get_pipeline
        # self.item.get_pipeline = get_pipeline
        edit_window = twc.QtTacticEditWidget(tactic_widget=tactic_edit_widget,
                                             qt_widgets=input_widgets_list,
                                             stype=self.item,
                                             parent=self)

        edit_window.show()

        self.dlg = QtGui.QDialog(self)
        self.l = QtGui.QVBoxLayout()
        self.l.addWidget(edit_window)
        self.dlg.setLayout(self.l)
        self.dlg.show()

        import ui_addsobject_classes