Beispiel #1
0
    def __init__(self, *args, **kwargs):
        """Sidebar ListBox

        Args:
            stack (Gtk.Stack): entities stack;
            entity_label (Gtk.Label): title of the visible entity;
            description_label (Gtk.Label): description of the visible entity;
            autoselect (bool): whether to select the first element
                by default.
        """
        ListBox.__init__(self, *args, **kwargs)
        self.set_header_func(self.update_header)
Beispiel #2
0
    def on_patient_selected(self, list_box: Gtk.ListBox, row: Gtk.ListBoxRow):
        """React to the user selecting a patient.

        This will switch to the page 'pain_evaluation'.

        Args:
            list_box (Gtk.ListBox): The Gtk.ListBox that is the row's parent
            row (Gtk.ListBoxRow): The Gtk.ListBoxRow that was selected
        """
        if row is not None:
            self.get_toplevel().active_patient = row.get_child().patient

            self.get_toplevel().switch_page("pain_evaluation")
        list_box.unselect_all()
Beispiel #3
0
    def on_qaree_selected(self, listbox: Gtk.ListBox,
                          listboxrow: Gtk.ListBoxRow) -> None:
        if not listboxrow:
            return

        if glob.telaawa_name == listboxrow.id:
            return
        glob.telaawa_name = listboxrow.id

        # Reset the display
        def reset(listboxrow: Gtk.ListBoxRow) -> None:
            listboxrow.icon_status.set_opacity(0)

        listbox.foreach(reset)

        listboxrow.icon_status.set_opacity(1)

        # Interrupt the telaawa playback if it is playing
        if self.ready_to_play:
            self.playback(TelaawaPlayer.PLAY)
    def add_source(self, source_list_widget: Gtk.ListBox, window: Gtk.Window):
        dialog = Gtk.FileChooserDialog(
            "Wybierz plik z przykładowymi tekstami",
            window,
            Gtk.FileChooserAction.OPEN,
            (
                Gtk.STOCK_CANCEL,
                Gtk.ResponseType.CANCEL,
                Gtk.STOCK_OPEN,
                Gtk.ResponseType.OK,
            ),
        )

        response = dialog.run()
        if response == Gtk.ResponseType.OK:
            print(dialog.get_filename())
            lines = open(dialog.get_filename(), encoding='utf8').read().splitlines()
            self.__marcow_chain.feed(lines)
            source_list_widget.add(Gtk.Label(dialog.get_filename()))
            window.show_all()
        dialog.destroy()
Beispiel #5
0
    def __init__(self, autoselect=False, *args, **kwargs):
        """Sidebar ListBox
        
        Args:
            entity_label (Gtk.Label): title of the visible entity;
            description_label (Gtk.Label): description of the visible entity;
            autoselect (bool): whether to select the first element
                by default.

        """
        ListBox.__init__(self, *args, **kwargs)

        # Set some inputs as attributes
        self.autoselect = autoselect

        # Set "last" selected entities attribute
        self.last = []

        # Set separator as row header
        self.set_header_func(self.update_header)

        self.connect("row-selected", self.sidebar_row_selected_cb)
Beispiel #6
0
    def on_selected(self, listbox: Gtk.ListBox,
                    listboxrow: Gtk.ListBoxRow) -> None:
        """Select the activated Musshaf list item."""
        if listboxrow.id == self.musshaf_name:
            self.button_ok.set_sensitive(False)
            self.button_ok.set_label('Downloading...')
        elif not listboxrow.is_downloaded:
            self.button_ok.set_label('Download')
            self.button_ok.set_sensitive(not self.musshaf_name)
        else:
            self.button_ok.set_sensitive(True)
            self.button_ok.set_label('Open')

        if glob.musshaf_name == listboxrow.id:
            return
        glob.musshaf_name = listboxrow.id

        def reset(listboxrow: Gtk.ListBoxRow) -> None:
            if listboxrow.is_downloaded:
                listboxrow.icon_status.set_opacity(0)

        listbox.foreach(reset)

        listboxrow.icon_status.set_opacity(1)
Beispiel #7
0
    def __init__(self, *args, frame=True, **kwargs):
        ListBox.__init__(self, *args, **kwargs)
        self.set_header_func(self.update_header)

        if not frame:
            self.set_shadow_type(0)  #None
 def reset_sources(self, source_list_widget: Gtk.ListBox, window: Gtk.Window):
     self.__marcow_chain.reset()
     source_list_widget.foreach(lambda widget: source_list_widget.remove(widget))
     pass