Called by question_bank_view to display the GUI for selecting a category
771571
public function display_options() {
        $this->display_category_form($this->contexts, $this->baseurl, $this->cat);
        $this->print_category_info($this->category);
    }
220261
public function question_category_object($page, $pageurl, $contexts, $currentcat, $defaultcategory, $todelete, $addcontexts) {
        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
        self::__construct($page, $pageurl, $contexts, $currentcat, $defaultcategory, $todelete, $addcontexts);
    }
1186256
def selected_hazard_category(self):
        
        item = self.lstHazardCategories.currentItem()
        try:
            return definition(item.data(QtCore.Qt.UserRole))
        except (AttributeError, NameError):
            return None
582884
def selected_purpose(self):
        
        item = self.lstCategories.currentItem()
        try:
            return definition(item.data(QtCore.Qt.UserRole))
        except (AttributeError, NameError):
            return None
1272604
def get(self, *args, **kwargs):
        """"""
        self.initial = {"category_name":  kwargs.get('category_name', None)}
        return super(CategoryFormView, self).get(*args, **kwargs)
123073
public void onCategoriesTabSelection() {

        if (!m_galleryDialog.getCategoriesTab().isInitOpen()) {
            m_galleryDialog.getCategoriesTab().onContentChange();
            return;
        }
        m_galleryDialog.getCategoriesTab().openFirstLevel();
        m_galleryDialog.getCategoriesTab().setInitOpen(false);
    }
1131454
def set_widgets(self):
        """"""
        self.clear_further_steps()
        # Set widgets
        purpose = self.parent.step_kw_purpose.selected_purpose()
        self.lstSubcategories.clear()
        self.lblDescribeSubcategory.setText('')
        self.lblIconSubcategory.setPixmap(QPixmap())
        self.lblSelectSubcategory.setText(
            get_question_text('%s_question' % purpose['key']))
        for i in self.subcategories_for_layer():
            # noinspection PyTypeChecker
            item = QListWidgetItem(i['name'], self.lstSubcategories)
            # noinspection PyTypeChecker
            item.setData(QtCore.Qt.UserRole, i['key'])
            self.lstSubcategories.addItem(item)

        # Check if layer keywords are already assigned
        key = self.parent.step_kw_purpose.selected_purpose()['key']
        keyword = self.parent.get_existing_keyword(key)

        # Overwrite the keyword if it's KW mode embedded in IFCW mode
        if self.parent.parent_step:
            keyword = self.parent.get_parent_mode_constraints()[1]['key']

        # Set values based on existing keywords or parent mode
        if keyword:
            subcategories = []
            for index in range(self.lstSubcategories.count()):
                item = self.lstSubcategories.item(index)
                subcategories.append(item.data(QtCore.Qt.UserRole))
            if keyword in subcategories:
                self.lstSubcategories.setCurrentRow(
                    subcategories.index(keyword))

        self.auto_select_one_item(self.lstSubcategories)
116021
def _to_add_with_category(self, catid):
        '''
        
        '''

        catinfo = MCategory.get_by_uid(catid)
        kwd = {
            'uid': self._gen_uid(),
            'userid': self.userinfo.user_name if self.userinfo else '',
            'gcat0': catid,
            'parentname': MCategory.get_by_uid(catinfo.pid).name,
            'catname': MCategory.get_by_uid(catid).name,
        }

        self.render('autogen/add/add_{0}.html'.format(catid),
                    userinfo=self.userinfo,
                    kwd=kwd)
537208
def list_view_on_selected(self, widget, selected_item_key):
        
        self.lbl.set_text('List selection: ' + self.listView.children[selected_item_key].get_text())
642998
public function on_question_category_end() {
        // make sure that the category data were written by {@link self::process_question()}
        // if not, write it now. this may happen when the current category does not contain any
        // questions so the subpaths is missing completely
        if (empty($this->currentcategorywritten)) {
            $this->write_xml('question_category', $this->currentcategory, array('/question_category/id'));
        } else {
            $this->xmlwriter->end_tag('question_category');
        }
        $this->converter->set_stash('question_categories', $this->currentcategory, $this->currentcategory['id']);
    }
114783
def python_sidebar(python_input):
    
    def get_text_fragments():
        tokens = []

        def append_category(category):
            tokens.extend([
                ('class:sidebar', '  '),
                ('class:sidebar.title', '   %-36s' % category.title),
                ('class:sidebar', '\n'),
            ])

        def append(index, label, status):
            selected = index == python_input.selected_option_index

            @if_mousedown
            def select_item(mouse_event):
                python_input.selected_option_index = index

            @if_mousedown
            def goto_next(mouse_event):
                " Select item and go to next value. "
                python_input.selected_option_index = index
                option = python_input.selected_option
                option.activate_next()

            sel = ',selected' if selected else ''

            tokens.append(('class:sidebar' + sel, ' >' if selected else '  '))
            tokens.append(('class:sidebar.label' + sel, '%-24s' % label, select_item))
            tokens.append(('class:sidebar.status' + sel, ' ', select_item))
            tokens.append(('class:sidebar.status' + sel, '%s' % status, goto_next))

            if selected:
                tokens.append(('[SetCursorPosition]', ''))

            tokens.append(('class:sidebar.status' + sel, ' ' * (13 - len(status)), goto_next))
            tokens.append(('class:sidebar', '<' if selected else ''))
            tokens.append(('class:sidebar', '\n'))

        i = 0
        for category in python_input.options:
            append_category(category)

            for option in category.options:
                append(i, option.title, '%s' % option.get_current_value())
                i += 1

        tokens.pop()  # Remove last newline.

        return tokens

    class Control(FormattedTextControl):
        def move_cursor_down(self):
            python_input.selected_option_index += 1

        def move_cursor_up(self):
            python_input.selected_option_index -= 1

    return Window(
        Control(get_text_fragments),
        style='class:sidebar',
        width=Dimension.exact(43),
        height=Dimension(min=3),
        scroll_offsets=ScrollOffsets(top=1, bottom=1))
440120
public function listCategory($category_group_id)
    {
        $this->setCategoryGroup($category_group_id);
        $this->actionListCategory();

        $this->setTitleListCategory();
        $this->setBreadcrumbListCategory();
        $this->setFilterListCategory();
        $this->setPagerListCategory();

        $this->setData('categories', $this->getListCategory());
        $this->setData('category_group_id', $category_group_id);

        $this->outputListCategory();
    }
550702
def _query_view(self, model, **kwargs):
        
        QueryForm = functions.get_form('QueryForm')

        if 'form_cls' not in kwargs:
            kwargs['form_cls'] = QueryForm
        query = functions.QueryView(model, **kwargs)
        return query
925060
def browse_in_qt5_ui(self):
        """"""
        self._render_type = "browse"
        self._tree.show(tree_style=self._get_tree_style())
726164
def display_candidates(self, tree, html_path, filename_prefix):
        
        imgs = self.display_boxes(
            tree, html_path, filename_prefix, alternate_colors=True
        )
        return display(*imgs)
607826
def get_listing_view(self, request, queryset, opts=None):
        
        view = self.get_view(request, self.view_class, opts)
        view.queryset = queryset
        return view
143710
def show_category(self):
        
        url = 'https://openapi.youku.com/v2/schemas/show/category.json'
        r = requests.get(url)
        check_error(r)
        return r.json()