Пример #1
0
    def __init__(self,
                 parent,
                 title,
                 data,
                 sortable=False,
                 column_labels=None,
                 row_labels=None,
                 row_labels_height=25,
                 width=800,
                 height=400):
        super(QtTableWindow, self).__init__(parent)
        self.setWindowTitle(title)
        self.setGeometry(50, 50, width, height)

        self.table = TableView(data=data,
                               parent=None,
                               sortable=sortable,
                               column_labels=column_labels,
                               row_labels=row_labels,
                               row_labels_height=row_labels_height)
        self.setCentralWidget(self.table)
        self.table.show()

        save_to_action = QtWidgets.QAction('Save to File', self)
        save_to_action.triggered.connect(lambda a=None: self.save_to_event())

        menubar = self.menuBar()
        file_menu = menubar.addMenu('File')
        file_menu.addAction(save_to_action)
Пример #2
0
        def _addmenu(data, menu):
            '''Fill a menu from "data"'''
            menu.setTearOffEnabled(True)
            menu.setWindowTitle(menu.title())  # needed for Windows
            for item in data:
                if item[0] == 'separator':
                    menu.addSeparator()
                elif item[0] == 'menu':
                    _addmenu(item[2], menu.addMenu(item[1].replace('&', '&&')))
                elif item[0] == 'command':
                    command = item[2]
                    if command is None:
                        print('warning: skipping', item)
                    else:
                        if isinstance(command, str):
                            command = lambda c=command: cmd.do(c)
                        menu.addAction(item[1], command)
                elif item[0] == 'check':
                    if len(item) > 4:
                        menu.addAction(
                            SettingAction(self, cmd, item[2], item[1], item[3],
                                          item[4]))
                    else:
                        menu.addAction(
                            SettingAction(self, cmd, item[2], item[1]))
                elif item[0] == 'radio':
                    label, name, value = item[1:4]
                    try:
                        group, type_, values = actiongroups[item[2]]
                    except KeyError:
                        group = QtWidgets.QActionGroup(self)
                        type_, values = cmd.get_setting_tuple(name)
                        actiongroups[item[2]] = group, type_, values
                    action = QtWidgets.QAction(label, self)
                    action.triggered.connect(lambda _=0, args=(name, value):
                                             cmd.set(*args, log=1, quiet=0))

                    self.setting_callbacks[cmd.setting._get_index(
                        name)].append(
                            lambda v, V=value, a=action: a.setChecked(v == V))

                    group.addAction(action)
                    menu.addAction(action)
                    action.setCheckable(True)
                    if values[0] == value:
                        action.setChecked(True)
                elif item[0] == 'open_recent_menu':
                    self.open_recent_menu = menu.addMenu('Open Recent...')
                else:
                    print('error:', item)
Пример #3
0
def SettingAction(parent,
                  cmd,
                  name,
                  label='',
                  true_value=1,
                  false_value=0,
                  command=None):
    '''
    Menu toggle action for a PyMOL setting

    parent: parent QObject
    cmd: PyMOL instance
    name: setting name
    label: menu item text
    '''
    if not label:
        label = name

    index = cmd.setting._get_index(name)
    type_, values = cmd.get_setting_tuple(index)
    action = QtWidgets.QAction(label, parent)

    if not command:
        command = lambda: cmd.set(index,
                                  true_value
                                  if action.isChecked() else false_value,
                                  log=1,
                                  quiet=0)

    parent.setting_callbacks[index].append(
        lambda v: action.setChecked(v != false_value))

    if type_ in (
            1,  # bool
            2,  # int
            3,  # float
            5,  # color
            6,  # str
    ):
        action.setCheckable(True)
        if values[0] == true_value:
            action.setChecked(True)
    else:
        print('TODO', type_, name)

    action.triggered.connect(command)
    return action
Пример #4
0
def add_qt_menu_command(parent,
                        label,
                        command=None,
                        fg_color=None,
                        bg_color=None):
    """
    Adds to a 'parent' QMenu widget a new menu item.
    """

    # Color the label of the menu item.
    if fg_color != None:
        action = QtWidgets.QWidgetAction(parent)
        label_widget = QtWidgets.QLabel(label)
        s = """QLabel {
            background-color: %s;
            color: %s;
            padding: 3px;
        }

        QLabel:hover {
            background-color: #466e82;
            color: %s;
        }""" % (bg_color, fg_color, fg_color)

        label_widget.setStyleSheet(s)
        action.setDefaultWidget(label_widget)

    # Don't color, use a regular 'QAction' object.
    else:
        action = QtWidgets.QAction(label, parent)

    # Associates a command.
    if command is not None:
        action.triggered.connect(command)
    parent.addAction(action)

    return action
Пример #5
0
    def __init__(self, *args, **kwargs):

        super(PyMod_plot_window_qt, self).__init__(*args, **kwargs)

        # Central widget.
        self.central_widget = QtWidgets.QWidget()
        self.setCentralWidget(self.central_widget)
        self.central_widget_layout = QtWidgets.QGridLayout()
        self.central_widget.setLayout(self.central_widget_layout)


        #------------------------------------------------
        # Upper frame (contains the plot and controls). -
        #------------------------------------------------

        expanding_size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                                      QtWidgets.QSizePolicy.Expanding)

        preferred_size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                                      QtWidgets.QSizePolicy.Preferred)

        # The upper frame contains three frames: info, plot and controls frames.
        # The infor and controls frames will be displayed only if the 'use_controls'
        # argument is set to 'True' when calling the 'build_plotting_area' method.
        self.upper_frame = QtWidgets.QFrame()
        self.upper_frame.setStyleSheet("background-color: #646464")
        self.upper_frame_layout = QtWidgets.QGridLayout()
        self.upper_frame.setLayout(self.upper_frame_layout)
        self.upper_frame.setSizePolicy(expanding_size_policy)
        self.central_widget_layout.addWidget(self.upper_frame, 0, 0)

        # Info frame, it contains the messagebar of the plot.
        self.info_frame = QtWidgets.QFrame()
        self.info_frame_layout = QtWidgets.QHBoxLayout()
        self.info_frame.setLayout(self.info_frame_layout)
        self.info_frame.setSizePolicy(preferred_size_policy)

        self.info_label = QtWidgets.QLabel("")
        self.info_frame_layout.addWidget(self.info_label)

        # Plot frame.
        self.plot_frame = QtWidgets.QFrame()
        # self.plot_frame.setStyleSheet("background-color: red")
        self.plot_frame_layout = QtWidgets.QGridLayout()
        self.plot_frame.setLayout(self.plot_frame_layout)
        self.plot_frame.setSizePolicy(expanding_size_policy)
        self.build_plot_widget()


        # Controls frame.
        self.controls_frame = QtWidgets.QWidget()
        self.controls_frame.setStyleSheet("background-color: #747474")
        self.controls_frame_layout = QtWidgets.QGridLayout()
        self.controls_frame.setLayout(self.controls_frame_layout)
        self.controls_frame_layout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)

        self.controls_scrollarea = QtWidgets.QScrollArea()
        self.controls_scrollarea.setWidgetResizable(True)
        self.controls_scrollarea.setWidget(self.controls_frame)

        self.labels_title = QtWidgets.QLabel("Plots list")


        # Middle splitter.
        self.middle_splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal)
        self.middle_splitter.setSizePolicy(expanding_size_policy)


        #---------------------------------------
        # Lower frame (contains some options). -
        #---------------------------------------

        self.lower_frame = QtWidgets.QFrame()
        self.lower_frame_layout = QtWidgets.QGridLayout()
        self.lower_frame.setLayout(self.lower_frame_layout)
        self.central_widget_layout.addWidget(self.lower_frame, 1, 0)

        # View buttons.
        self.view_label = QtWidgets.QLabel("View:")
        self.lower_frame_layout.addWidget(self.view_label, 0, 0)

        self.home_view_button = QtWidgets.QPushButton("Fit to data")
        self.home_view_button.clicked.connect(self.on_home_button_click)
        self.lower_frame_layout.addWidget(self.home_view_button, 0, 1)

        # On click behaviour. The buttons will be shown later, in the
        # 'build_plotting_area' metohd.
        self.interact_buttons_group = QtWidgets.QButtonGroup()

        self.on_click_label = QtWidgets.QLabel("Interact on click:")

        self.interact_button = QtWidgets.QPushButton("Yes")
        self.interact_button.setCheckable(True)
        self.interact_buttons_group.addButton(self.interact_button)
        self.interact_button.clicked.connect(self.on_interact_button_click)

        self.no_interaction_button = QtWidgets.QPushButton("No")
        self.no_interaction_button.setCheckable(True)
        self.no_interaction_button.setChecked(True)
        self.interact_buttons_group.addButton(self.no_interaction_button)
        self.no_interaction_button.clicked.connect(self.on_no_interaction_button_click)


        # Show/hide all buttons. They will be shown later, in the 'build_plotting_area'
        # method.
        self.show_label = QtWidgets.QLabel("Show:")

        self.show_all_button = QtWidgets.QPushButton("All")
        self.show_all_button.clicked.connect(self.show_all_command)

        self.hide_all_button = QtWidgets.QPushButton("None")
        self.hide_all_button.clicked.connect(self.hide_all_command)

        self.lower_frame_layout.setAlignment(QtCore.Qt.AlignLeft)


        #---------------------
        # Build a main menu. -
        #---------------------

        self.save_to_csv_action = QtWidgets.QAction('Save to CSV', self)
        self.save_to_csv_action.triggered.connect(lambda a=None: self.save_to_csv_event())
        self.save_to_png_action = QtWidgets.QAction('Save to PNG', self)
        self.save_to_png_action.triggered.connect(lambda a=None: self.save_to_png_event())

        self.main_menubar = self.menuBar()
        self.file_menu = self.main_menubar.addMenu('File')
Пример #6
0
    def make_main_menu(self):
        """
        This method is called when initializing the main window in order to build its main menu.
        """

        self.menubar = self.menuBar()
        self.menubar.setNativeMenuBar(False)

        #---------------
        # "File" menu. -
        #---------------

        self.file_menu = self.menubar.addMenu('File')

        # Sequences submenu.
        self.sequences_submenu = QtWidgets.QMenu('Sequences and Structures',
                                                 self)
        self.file_menu.addMenu(self.sequences_submenu)
        add_qt_menu_command(self.sequences_submenu, 'Open from File',
                            self.pymod.open_file_from_the_main_menu)
        add_qt_menu_command(self.sequences_submenu, 'Add Raw Sequence',
                            self.pymod.show_raw_seq_input_window)
        add_qt_menu_command(self.sequences_submenu, 'Import PyMOL Objects',
                            self.pymod.import_pymol_selections_from_main_menu)

        # self.file_menu.addSeparator()

        # Submenu to open alignments.
        self.alignment_files_submenu = QtWidgets.QMenu('Alignments', self)
        self.file_menu.addMenu(self.alignment_files_submenu)
        add_qt_menu_command(self.alignment_files_submenu, 'Open from File',
                            self.pymod.open_alignment_from_main_menu)

        # Submenu to open results files from external programs.
        self.external_results_submenu = QtWidgets.QMenu(
            'External Programs Results', self)
        self.file_menu.addMenu(self.external_results_submenu)

        self.hhsuite_results_submenu = QtWidgets.QMenu('HH-suite', self)
        self.external_results_submenu.addMenu(self.hhsuite_results_submenu)
        add_qt_menu_command(self.hhsuite_results_submenu,
                            'Template Search (.hhr)',
                            self.pymod.open_hhsuite_hhr_from_main_menu)
        add_qt_menu_command(self.hhsuite_results_submenu,
                            'Multiple Sequence Alignment (.a3m)',
                            self.pymod.open_hhsuite_a3m_from_main_menu)

        self.file_menu.addSeparator()

        # Workspace submenu.
        self.sessions_submenu = QtWidgets.QMenu('Sessions', self)
        self.file_menu.addMenu(self.sessions_submenu)
        add_qt_menu_command(self.sessions_submenu, 'New',
                            self.pymod.start_new_session_from_main_menu)
        add_qt_menu_command(self.sessions_submenu, 'Save',
                            self.pymod.save_session_from_main_menu)
        add_qt_menu_command(self.sessions_submenu, 'Open',
                            self.pymod.open_session_from_main_menu)

        self.file_menu.addSeparator()

        # Exit command.
        add_qt_menu_command(self.file_menu, 'Exit',
                            self.pymod.exit_from_main_menu)

        #----------------
        # "Tools" menu. -
        #----------------

        self.tools_menu = self.menubar.addMenu('Tools')

        # Database search for homologous sequences.
        self.database_search_submenu = QtWidgets.QMenu('Database Search', self)
        self.tools_menu.addMenu(self.database_search_submenu)

        self.blast_tools_submenu = QtWidgets.QMenu('BLAST', self)
        self.database_search_submenu.addMenu(self.blast_tools_submenu)
        add_qt_menu_command(
            self.blast_tools_submenu, 'Local BLAST',
            lambda: self.pymod.launch_blast_algorithm("blastp"))
        add_qt_menu_command(self.blast_tools_submenu, 'Remote BLAST',
                            lambda: self.pymod.launch_blast_algorithm("blast"))
        add_qt_menu_command(
            self.database_search_submenu, 'PSI-BLAST',
            lambda: self.pymod.launch_blast_algorithm("psi-blast"))
        self.database_search_submenu.addSeparator()
        add_qt_menu_command(
            self.database_search_submenu, 'phmmer',
            lambda: self.pymod.launch_hmmer_algorithm("phmmer"))
        add_qt_menu_command(
            self.database_search_submenu, 'jackhmmer',
            lambda: self.pymod.launch_hmmer_algorithm("jackhmmer"))
        add_qt_menu_command(
            self.database_search_submenu, 'hmmsearch',
            lambda: self.pymod.launch_hmmer_algorithm("hmmsearch"))

        # Alignment tools
        self.alignments_tools_submenu = QtWidgets.QMenu(
            'Alignment Tools', self)
        self.tools_menu.addMenu(self.alignments_tools_submenu)

        # Sequence alignment tools.
        self.sequence_alignments_submenu = QtWidgets.QMenu(
            'Sequence Alignment', self)
        self.alignments_tools_submenu.addMenu(self.sequence_alignments_submenu)
        add_qt_menu_command(
            self.sequence_alignments_submenu, 'ClustalW',
            lambda: self.pymod.launch_alignment_from_the_main_menu(
                "clustalw", "regular"))
        add_qt_menu_command(
            self.sequence_alignments_submenu, 'Clustal Omega',
            lambda: self.pymod.launch_alignment_from_the_main_menu(
                "clustalo", "regular"))
        add_qt_menu_command(
            self.sequence_alignments_submenu, 'MUSCLE',
            lambda: self.pymod.launch_alignment_from_the_main_menu(
                "muscle", "regular"))
        add_qt_menu_command(
            self.sequence_alignments_submenu, 'SALIGN (Sequence Alignment)',
            lambda: self.pymod.launch_alignment_from_the_main_menu(
                "salign-seq", "regular"))

        # Profile alignment tools.
        self.sequence_profile_alignments_submenu = QtWidgets.QMenu(
            'Profile Alignment', self)
        self.alignments_tools_submenu.addMenu(
            self.sequence_profile_alignments_submenu)
        add_qt_menu_command(
            self.sequence_profile_alignments_submenu, 'ClustalW',
            lambda: self.pymod.launch_alignment_from_the_main_menu(
                "clustalw", "profile"))
        add_qt_menu_command(
            self.sequence_profile_alignments_submenu, 'Clustal Omega',
            lambda: self.pymod.launch_alignment_from_the_main_menu(
                "clustalo", "profile"))
        add_qt_menu_command(
            self.sequence_profile_alignments_submenu,
            'SALIGN (Sequence Alignment)',
            lambda: self.pymod.launch_alignment_from_the_main_menu(
                "salign-seq", "profile"))

        # Structural alignment tools.
        self.structural_alignment_submenu = QtWidgets.QMenu(
            'Structural Alignment', self)
        self.alignments_tools_submenu.addMenu(
            self.structural_alignment_submenu)
        # add_qt_menu_command(self.structural_alignment_submenu, 'Superpose', self.pymod.superpose_from_main_menu)
        add_qt_menu_command(
            self.structural_alignment_submenu, 'CE Alignment',
            lambda: self.pymod.launch_alignment_from_the_main_menu(
                "ce", "regular"))
        add_qt_menu_command(
            self.structural_alignment_submenu, 'SALIGN (Structure Alignment)',
            lambda: self.pymod.launch_alignment_from_the_main_menu(
                "salign-str", "regular"))

        # Domain tools.
        self.domain_analysis_submenu = QtWidgets.QMenu('Domains Analysis',
                                                       self)
        self.tools_menu.addMenu(self.domain_analysis_submenu)
        self.hmmscan_tools_submenu = QtWidgets.QMenu('hmmscan', self)
        self.domain_analysis_submenu.addMenu(self.hmmscan_tools_submenu)
        add_qt_menu_command(self.hmmscan_tools_submenu, 'Local hmmscan',
                            lambda: self.pymod.launch_domain_analysis("local"))
        add_qt_menu_command(
            self.hmmscan_tools_submenu, 'Remote hmmscan',
            lambda: self.pymod.launch_domain_analysis("remote"))

        # Structural analysis.
        self.structural_analysis_submenu = QtWidgets.QMenu(
            'Structural Analysis', self)
        self.tools_menu.addMenu(self.structural_analysis_submenu)
        add_qt_menu_command(self.structural_analysis_submenu,
                            'Ramachandran Plot',
                            self.pymod.ramachandran_plot_from_main_menu)
        add_qt_menu_command(self.structural_analysis_submenu, 'Contact Map',
                            self.pymod.contact_map_from_main_menu)
        add_qt_menu_command(self.structural_analysis_submenu,
                            'Structural Divergence Plot',
                            self.pymod.sda_from_main_menu)
        self.structural_analysis_submenu.addSeparator()
        add_qt_menu_command(self.structural_analysis_submenu,
                            'Assess with DOPE', self.pymod.dope_from_main_menu)
        self.structural_analysis_submenu.addSeparator()
        add_qt_menu_command(self.structural_analysis_submenu, 'PSIPRED',
                            self.pymod.launch_psipred_from_main_menu)

        # Modeling.
        self.modeling_submenu = QtWidgets.QMenu('Modeling', self)
        self.tools_menu.addMenu(self.modeling_submenu)
        add_qt_menu_command(self.modeling_submenu,
                            "MODELLER (Homology Modeling)",
                            self.pymod.launch_modeller_hm_from_main_menu)
        add_qt_menu_command(self.modeling_submenu, "MODELLER (Loop Modeling)",
                            self.pymod.launch_modeller_lr_from_main_menu)

        # Options.
        self.tools_menu.addSeparator()
        add_qt_menu_command(self.tools_menu, 'Options',
                            self.pymod.show_pymod_options_window)

        #---------------------
        # "Alignments" menu. -
        #---------------------

        self.alignments_menu = self.menubar.addMenu('Alignments')
        self.build_alignment_submenu()

        #-----------------
        # "Models" menu. -
        #-----------------

        # When the plugin is started there are no models.
        self.models_menu = self.menubar.addMenu('Models')
        self.build_models_submenu()

        #--------------------
        # "Selection" menu. -
        #--------------------

        self.main_selection_menu = self.menubar.addMenu('Selection')
        add_qt_menu_command(self.main_selection_menu, 'Select All [Ctrl+a]',
                            self.pymod.select_all_from_main_menu)
        add_qt_menu_command(self.main_selection_menu, 'Deselect All [Esc]',
                            self.pymod.deselect_all_from_main_menu)

        # Structures selection submenu.
        self.selection_structures_menu = QtWidgets.QMenu('Structures', self)
        self.main_selection_menu.addMenu(self.selection_structures_menu)
        add_qt_menu_command(self.selection_structures_menu,
                            'Show All in PyMOL [Ctrl+s]',
                            self.pymod.show_all_structures_from_main_menu)
        add_qt_menu_command(self.selection_structures_menu,
                            'Hide All in PyMOL [Ctrl+h]',
                            self.pymod.hide_all_structures_from_main_menu)
        self.selection_structures_menu.addSeparator()
        add_qt_menu_command(self.selection_structures_menu, 'Select All',
                            self.pymod.select_all_structures_from_main_menu)
        add_qt_menu_command(self.selection_structures_menu, 'Deselect All',
                            self.pymod.deselect_all_structures_from_main_menu)
        # Clusters selection submenu.
        self.selection_clusters_menu = QtWidgets.QMenu('Clusters', self)
        self.main_selection_menu.addMenu(self.selection_clusters_menu)
        add_qt_menu_command(self.selection_clusters_menu, 'Expand All',
                            self.pymod.expand_all_clusters_from_main_menu)
        add_qt_menu_command(self.selection_clusters_menu, 'Collapse All',
                            self.pymod.collapse_all_clusters_from_main_menu)

        #------------------
        # "Display" menu. -
        #------------------

        self.display_menu = self.menubar.addMenu('Display')
        if self.pymod.DEVELOP:
            add_qt_menu_command(self.display_menu,
                                'Print Selected Sequences',
                                command=self.print_selected)

        # Color menu.
        self.main_color_menu = QtWidgets.QMenu('Color all Sequences', self)
        self.display_menu.addMenu(self.main_color_menu)
        add_qt_menu_command(
            self.main_color_menu,
            'By Default Color',
            command=lambda: self.color_selection("all", None, "regular"))
        self.main_residues_colors_menu = QtWidgets.QMenu(
            'By Residue Properties', self)
        self.main_color_menu.addMenu(self.main_residues_colors_menu)
        add_qt_menu_command(
            self.main_residues_colors_menu,
            'Residue Type',
            command=lambda: self.color_selection("all", None, "residue_type"))
        add_qt_menu_command(
            self.main_residues_colors_menu,
            'Polarity',
            command=lambda: self.color_selection("all", None, "polarity"))
        add_qt_menu_command(self.main_color_menu,
                            'By Secondary Structure',
                            command=lambda: self.color_selection(
                                "all", None, "secondary-auto"))

        # Font selection.
        self.font_selection_menu = QtWidgets.QMenu('Font Selection', self)
        self.display_menu.addMenu(self.font_selection_menu)
        if self.pymod.DEVELOP:
            add_qt_menu_command(self.display_menu, 'Font Type and Size',
                                self.pymod.change_font_from_main_menu)

        # Font size selection.
        self.font_size_selection_menu = QtWidgets.QMenu('Font Size', self)
        self.font_selection_menu.addMenu(self.font_size_selection_menu)
        font_size_action_group = QtWidgets.QActionGroup(
            self.font_size_selection_menu)
        font_size_action_group.setExclusive(True)
        for font_size in ("6", "7", "8", "9", "10", "11", "12", "13", "14",
                          "15", "16"):
            action = font_size_action_group.addAction(
                QtWidgets.QAction(font_size,
                                  self.font_size_selection_menu,
                                  checkable=True))
            self.font_size_selection_menu.addAction(action)
            if font_size == str(self.font_size):
                action.setChecked(True)
            action.triggered.connect(lambda a=None, t=None, s=font_size: self.
                                     pymod.change_font_from_action(t, s))

        # Font type selection.
        self.font_type_selection_menu = QtWidgets.QMenu('Font Type', self)
        self.font_selection_menu.addMenu(self.font_type_selection_menu)
        font_type_action_group = QtWidgets.QActionGroup(
            self.font_type_selection_menu)
        font_type_action_group.setExclusive(True)
        for font_type in self.get_available_fonts():
            action = font_type_action_group.addAction(
                QtWidgets.QAction(font_type,
                                  self.font_type_selection_menu,
                                  checkable=True))
            self.font_type_selection_menu.addAction(action)
            if font_type == str(self.font):
                action.setChecked(True)
            action.triggered.connect(lambda a=None, t=font_type, s=None: self.
                                     pymod.change_font_from_action(t, s))

        #---------------
        # "Help" menu. -
        #---------------

        self.help_menu = self.menubar.addMenu('Help')
        if self.pymod.DEVELOP:
            add_qt_menu_command(self.help_menu, 'Test',
                                self.pymod.launch_default)
        add_qt_menu_command(self.help_menu, 'Online Documentation',
                            self.pymod.open_online_documentation)
        add_qt_menu_command(self.help_menu, 'About',
                            self.pymod.show_about_dialog)
        self.help_menu.addSeparator()
        add_qt_menu_command(self.help_menu, "Install PyMod Components",
                            self.pymod.launch_components_installation)
        add_qt_menu_command(self.help_menu, "Check for Database Updates",
                            self.pymod.launch_databases_update)

        if self.pymod.TEST:
            self.help_menu.addSeparator()
            self.examples_menu = QtWidgets.QMenu('Examples', self)
            self.help_menu.addMenu(self.examples_menu)
            add_qt_menu_command(
                self.examples_menu,
                "Load random sequence from UniProt",
                lambda a=None: self.pymod.load_uniprot_random())
            add_qt_menu_command(self.examples_menu,
                                "Load random PDB entry",
                                lambda a=None: self.pymod.load_pdb_random())