コード例 #1
0
    def __init__(self,
                 entity,
                 *args,
                 widget=True,
                 selected=None,
                 open_button=None,
                 select_entities=None):
        """Search result widget in 'open new entity' dialog

            Args:
                entity (dict): havig keys "URI, "Label", "Description" and "Data".
                selected (list): keep track of entity's selected status
        """
        CheckButton.__init__(self, *args)

        self.entity = entity

        if widget:
            self.label.set_text(entity['Label'])
            self.description.set_text(entity['Description'])
            self.URI.set_text(entity['URI'])
        else:
            self.label.destroy()
            self.description.destroy()
            self.URI.destroy()

        #TODO: implement selected as signal in cointaining listbox
        if selected != None:
            if entity["URI"] in (v["URI"] for v in selected):
                self.set_active(True)
            args = [self.toggled_cb, selected]
            if open_button: args = args + [open_button]
            if select_entities: args = args + [select_entities]
            self.connect("toggled", *args)
        self.show_all()
コード例 #2
0
ファイル: cardsgenerator.py プロジェクト: ltsdw/Asts
    def _setSelectAll(self) -> None:
        """
        Sets up widgets to select all sentences.

        :return:
        """

        grid: Grid = Grid()
        grid.set_halign(Align.END)
        self._subtitles_grid.attach(grid, 0, 2, 1, 1)

        lbl: Label = Label(label='Select all')
        setMargin(lbl, 5)

        grid.attach(lbl, 0, 0, 1, 1)

        all_vid_toggle: CheckButton = CheckButton()
        all_vid_toggle.set_halign(Align.CENTER)
        all_vid_toggle.connect('toggled', self._onAllVideosToggled)

        setMargin(all_vid_toggle, 5)

        grid.attach(all_vid_toggle, 1, 0, 1, 1)

        lbl2: Label = Label(label='Videos')

        setMargin(lbl2, 5)

        grid.attach(lbl2, 1, 1, 1, 1)

        all_audio_toggle: CheckButton = CheckButton()
        all_audio_toggle.set_halign(Align.CENTER)
        all_audio_toggle.connect('toggled', self._onAllAudiosToggled,
                                 all_vid_toggle)

        setMargin(all_audio_toggle, 5)

        grid.attach(all_audio_toggle, 2, 0, 1, 1)

        lbl3: Label = Label(label='Audios')

        setMargin(lbl3, 5)

        grid.attach(lbl3, 2, 1, 1, 1)

        all_img_toggle: CheckButton = CheckButton()
        all_img_toggle.set_halign(Align.CENTER)
        all_img_toggle.connect('toggled', self._onAllImagesToggled)

        setMargin(all_img_toggle, 5)

        grid.attach(all_img_toggle, 3, 0, 1, 1)

        lbl4: Label = Label(label='Snapshot')

        setMargin(lbl4, 5)

        grid.attach(lbl4, 3, 1, 1, 1)
コード例 #3
0
 def set_check_box_boolean(check_box: Gtk.CheckButton,
                           checked: bool) -> None:
     """
     Sets the state of a check box widget
     :param check_box: the check box widget to be modified
     :param checked: flag to determine if the check box should be activated or not:
             True: Selected, False: Deselected
     :return: void
     """
     check_box.set_active(checked)
コード例 #4
0
 def on_checkbutton(self, widget: Gtk.CheckButton, hint: int) -> None:
     '''
     One of the check buttons to activate or deactivate an input hint
     has been clicked.
     '''
     LOGGER.info('Clicked checkbutton %s %s', widget, hint)
     if widget.get_active():
         self._input_hints |= hint
     else:
         self._input_hints &= ~hint
     self._test_entry.set_input_hints(Gtk.InputHints(self._input_hints))
     self._test_text_view.set_input_hints(Gtk.InputHints(self._input_hints))
     input_hints_entry = self._test_entry.get_input_hints()
     input_hints_text_view = self._test_text_view.get_input_hints()
     LOGGER.info('New value of self._input_hints=%s',
                 format(int(input_hints_entry), '016b'))
     if int(input_hints_entry) != int(self._input_hints):
         LOGGER.error('input_hints_entry != self._input_hints: %s %s',
                      input_hints_entry, self._input_hints)
     if int(input_hints_entry) != int(input_hints_text_view):
         LOGGER.error('input_hints_entry != input_hints_text_view: %s %s',
                      input_hints_entry, input_hints_text_view)
     for input_hint in list(itb_util.InputHints):
         if self._input_hints & input_hint:
             LOGGER.info('hint: %s %s', str(hint),
                         format(int(hint), '016b'))
コード例 #5
0
 def on_var_changed_check(self, var: Pmd2ScriptGameVar, offset: int,
                          wdg: Gtk.CheckButton, *args):
     if self._suppress_events:
         return
     with variables_lock:
         self.variables_changed_but_not_saved = True
         self._queue_variable_write(var.id, offset,
                                    1 if wdg.get_active() else 0)
         return True
コード例 #6
0
    def on_toggle(self, button: Gtk.CheckButton) -> None:
        """
        Manage the toggle button event.

        :param button: The button.
        """
        if self.__config is not None:
            self.__config[self.identifier] = button.get_active()
            GrammalecteConfig().set_value(GrammalecteConfig.ANALYZE_OPTIONS,
                                          self.__config, 1)
コード例 #7
0
ファイル: window.py プロジェクト: michalsustr/spielviz
 def toggle_full_tree(self, button: Gtk.CheckButton):
     do_show = button.get_active()
     if do_show:
         self.show_full_tree = True
         self.lookbehind_spinner.set_sensitive(False)
         self.lookahead_spinner.set_sensitive(False)
     else:
         self.show_full_tree = False
         self.lookbehind_spinner.set_sensitive(True)
         self.lookahead_spinner.set_sensitive(True)
     self.update_plot_area(self.state)
コード例 #8
0
def on_prefer_dark_theme_check_toggled(check: Gtk.CheckButton, *args):
    """
    @brief      Handler for theme variant checkbox.

    @details    This is called when the theme variant checkbox is toggled.

    @param      check    Gtk.CheckButton

    @param      args     place holder list

    @return     None
    """
    status = check.get_active()
    # print(f"Toggle status: {status}")
    apply_theme(dark=status)
コード例 #9
0
def get_keep_value(keep: Gtk.CheckButton, value: str):
    """Set keep value."""
    return 'keep' if keep.get_active() else value
コード例 #10
0
 def on_rules_a8_toggled(self, widget: Gtk.CheckButton, *area):
     self._rules_pos_toggle(8, widget.get_active())
コード例 #11
0
 def on_sr_search_setting_match_words_toggled(self, btn: Gtk.CheckButton,
                                              *args):
     s: GtkSource.SearchSettings = self._active_search_context.get_settings(
     )
     s.set_at_word_boundaries(btn.get_active())
コード例 #12
0
ファイル: utils.py プロジェクト: krthkj/rfi-file-monitor
 def _checkbutton_toggled_cb(self, checkbutton: Gtk.CheckButton,
                             param_name: str):
     self._params[param_name] = checkbutton.get_active()
コード例 #13
0
ファイル: exposureloader.py プロジェクト: awacha/cct
 def on_override_mask_changed(self, checkbutton: Gtk.CheckButton):
     self.builder.get_object('mask_chooser').set_sensitive(checkbutton.get_active())
     return True
コード例 #14
0
 def on_sr_search_setting_case_sensitive_toggled(self, btn: Gtk.CheckButton,
                                                 *args):
     s: GtkSource.SearchSettings = self._active_search_context.get_settings(
     )
     s.set_case_sensitive(btn.get_active())
コード例 #15
0
ファイル: window.py プロジェクト: michalsustr/spielviz
 def toggle_perfect_recall(self, button: Gtk.CheckButton):
     do_show = button.get_active()
     self.show_perfect_recall = do_show
     self.update_observer()
コード例 #16
0
ファイル: window.py プロジェクト: michalsustr/spielviz
 def toggle_public_info(self, button: Gtk.CheckButton):
     do_show = button.get_active()
     self.show_public_info = do_show
     self.update_observer()
コード例 #17
0
def on_setting_toggled(checkbutton: Gtk.CheckButton) -> None:
    current_value = checkbutton.get_active()
    section = checkbutton.get_section_name()
    option = checkbutton.get_name()

    config.new(section, option, current_value)
コード例 #18
0
ファイル: calibration.py プロジェクト: awacha/cct
 def on_overridemask_toggled(self, checkbutton: Gtk.CheckButton):
     self.builder.get_object('maskchooser').set_sensitive(checkbutton.get_active())
コード例 #19
0
 def get_boolean_from_check_box(check_box: Gtk.CheckButton) -> bool:
     """
     Checks if a check box is currently selected and returns the value
     :return: True if the check box is selected, False otherwise
     """
     return check_box.get_active()