当前位置: 首页>>代码示例>>Python>>正文


Python QMenu.setTitle方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QMenu.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Python QMenu.setTitle方法的具体用法?Python QMenu.setTitle怎么用?Python QMenu.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QMenu的用法示例。


在下文中一共展示了QMenu.setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: addShowActions

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
    def addShowActions(self):
        """Adds a submenu giving access to the (other)
        opened viewer documents"""
        mds = self._actionCollection.viewer_document_select
        docs = mds.viewdocs()
        document_actions = {}
        multi_docs = len(docs) > 1
        if self._panel.widget().currentViewdoc():
            current_doc_filename = self._panel.widget().currentViewdoc().filename()

        m = self._menu
        sm = QMenu(m)
        sm.setTitle(_("Show..."))
        sm.setEnabled(multi_docs)
        ag = QActionGroup(m)
        ag.triggered.connect(self._panel.slotShowViewdoc)

        for d in docs:
            action = QAction(sm)
            action.setText(d.name())
            action._document_filename = d.filename()
            # TODO: Tooltips aren't shown by Qt (it seems)
            action.setToolTip(d.filename())
            action.setCheckable(True)
            action.setChecked(d.filename() == current_doc_filename)

            ag.addAction(action)
            sm.addAction(action)

        m.addSeparator()
        m.addMenu(sm)
开发者ID:19joho66,项目名称:frescobaldi,代码行数:33,代码来源:contextmenu.py

示例2: cb_backends

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
    def cb_backends(self):
        self.cb_backends = QComboBox()

        self.cb_backends.addItem('Auto')

        menuLyricSource = QMenu(self.ui.menuEdit)
        menuLyricSource.setTitle('Lyric source')

        self.lyricGroup = QActionGroup(self)

        def addAction(name, checked=False):
            action = QAction(name, self)
            action.setText(name)
            action.setCheckable(True)
            action.setChecked(checked)
            action.setActionGroup(self.lyricGroup)

            return action

        menuLyricSource.addAction(addAction('Auto', True))
        menuLyricSource.addSeparator()
        menuLyricSource.triggered.connect(self._menu_backend_change)

        for backend in Pyrics.get_backends():
            menuLyricSource.addAction(addAction(backend.__name__))
            self.cb_backends.addItem(backend.__name__)

        self.ui.menuEdit.addMenu(menuLyricSource)
        self.ui.toolBar.addWidget(self.cb_backends)

        self.cb_backends.currentIndexChanged.connect(self._cb_backend_change)
开发者ID:xcution,项目名称:pyrics,代码行数:33,代码来源:qpyrics.py

示例3: create_menu

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
def create_menu():
    u"""Set up the menu."""
    mn = QMenu()
    mn.setTitle("Nachschlagen")
    mw.form.menuTools.addAction(mn.menuAction())
    #
    mw.form.menu_nachschlagen = mn
    # add actions
    if show_japanese:
        # Maybe not show the Japanese actions.
        wae = QAction(mw)
        wae.setText("Japanisch bei Wadoku")
        # wae.setShortcut("Ctrl+4")
        mn.addAction(wae)
        mw.connect(wae, SIGNAL("triggered()"), on_lookup_wadoku_expression)
        wam = QAction(mw)
        wam.setText("Deutsch bei Wadoku")
        # wam.setShortcut("Ctrl+2")
        mn.addAction(wam)
        mw.connect(wam, SIGNAL("triggered()"), on_lookup_wadoku_meaning)
        was = QAction(mw)
        was.setText("Auswahl bei Wadoku")
        mn.addAction(was)
        mw.connect(was, SIGNAL("triggered()"), on_lookup_wadoku_selection)

        if show_saiga:
            # Personal taste: i like the Kanjilexikon better than the
            # Saiga look up. So i like this switched off.
            sae = QAction(mw)
            sae.setText("Kanji bei Saiga")
            #sae.setShortcut("Ctrl+4")
            mn.addAction(sae)
            mw.connect(sae, SIGNAL("triggered()"), on_lookup_saiga_expression)
            sas = QAction(mw)
            sas.setText("Kanjiauswahl bei Saiga")
            mn.addAction(sas)
            mw.connect(sas, SIGNAL("triggered()"), on_lookup_saiga_selection)

        kle = QAction(mw)
        kle.setText("Kanji bei Kanji-Lexikon")
        # kle.setShortcut("Ctrl+4")
        mn.addAction(kle)
        mw.connect(kle, SIGNAL("triggered()"), on_lookup_kl_expression)
        kls = QAction(mw)
        kls.setText("Kanjiauswahl bei Kanji-Lexikon")
        mn.addAction(kls)
        mw.connect(kls, SIGNAL("triggered()"), on_lookup_kl_selection)
    # Show these always.
    fae = QAction(mw)
    fae.setText("Ausdruck bei Forvo")
    # fae.setShortcut("Ctrl+4")
    mn.addAction(fae)
    mw.connect(fae, SIGNAL("triggered()"), on_lookup_forvo_expression)
    fas = QAction(mw)
    fas.setText("Auswahl bei Forvo")
    mn.addAction(fas)
    mw.connect(fas, SIGNAL("triggered()"), on_lookup_forvo_selection)
开发者ID:ospalh,项目名称:anki-addons,代码行数:59,代码来源:nachschlagen.py

示例4: menu_sessions

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
def menu_sessions(parent):
    m = QMenu(parent)
    m.setTitle(_('menu title', '&Session'))
    m.triggered.connect(slot_session_action)
    import sessions
    for name in sessions.sessionNames():
        a = m.addAction(name.replace('&', '&&'))
        a.setObjectName(name)
    qutil.addAccelerators(m.actions())
    return m
开发者ID:19joho66,项目名称:frescobaldi,代码行数:12,代码来源:globalmenu.py

示例5: menu_file_open_recent

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
def menu_file_open_recent(parent):
    m = QMenu(parent)
    m.setTitle(_("Open &Recent"))
    m.triggered.connect(slot_file_open_recent_action)
    import recentfiles
    for url in recentfiles.urls():
        f = url.toLocalFile()
        dirname, basename = os.path.split(f)
        text = "{0}  ({1})".format(basename, util.homify(dirname))
        m.addAction(text).url = url
    qutil.addAccelerators(m.actions())
    return m
开发者ID:19joho66,项目名称:frescobaldi,代码行数:14,代码来源:globalmenu.py

示例6: addZoomActions

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
 def addZoomActions(self):
     """Add actions to zoom the viewer"""
     m = self._menu
     m.addSeparator()
     sm = QMenu(m)
     sm.setTitle(_("Zoom"))
     m.addMenu(sm)
     ac = self._actionCollection
     sm.addAction(ac.viewer_fit_width)
     sm.addAction(ac.viewer_fit_height)
     sm.addAction(ac.viewer_fit_both)
     sm.addSeparator()
     sm.addAction(ac.viewer_zoom_in)
     sm.addAction(ac.viewer_zoom_out)
     sm.addAction(ac.viewer_zoom_original)
开发者ID:19joho66,项目名称:frescobaldi,代码行数:17,代码来源:contextmenu.py

示例7: get_or_create_menu

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
def get_or_create_menu(attribute_name, label):

    if not hasattr(mw, attribute_name):
        menu = QMenu(_(label), mw)
        setattr(mw, attribute_name, menu)

        mw.form.menubar.insertMenu(
            mw.form.menuTools.menuAction(),
            menu
        )
    else:
        menu = getattr(mw, attribute_name)
        menu.setTitle(_(label))

    return menu
开发者ID:krassowski,项目名称:Anki-Night-Mode,代码行数:17,代码来源:menu.py

示例8: menu_file

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
def menu_file(parent):
    m = QMenu(parent)
    m.setTitle(_("menu title", "&File"))
    m.addAction(icons.get('document-new'), _("action: new document", "&New"), file_new)
    m.addMenu(menu_file_new_from_template(m))
    m.addAction(icons.get('tools-score-wizard'), _("New Score with &Wizard..."), file_new_with_wizard)
    m.addSeparator()
    m.addAction(icons.get('document-open'), _("&Open..."), file_open)
    m.addMenu(menu_file_open_recent(m))
    m.addSeparator()
    m.addMenu(menu_file_import(m))
    m.addSeparator()
    role = QAction.QuitRole if use_osx_menu_roles() else QAction.NoRole
    m.addAction(icons.get('application-exit'), _("&Quit"), app.qApp.quit).setMenuRole(role)
    return m
开发者ID:19joho66,项目名称:frescobaldi,代码行数:17,代码来源:globalmenu.py

示例9: addOpenCloseActions

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
 def addOpenCloseActions(self):
     """Add actions to close documents.
     This is not implemented in the base class"""
     m = self._menu
     ac = self._actionCollection
     m.addAction(ac.viewer_open)
     docs = self._actionCollection.viewer_document_select.viewdocs()
     if docs:
         sm = QMenu(m)
         sm.setTitle(_("Close..."))
         m.addMenu(sm)
         sm.addAction(ac.viewer_close)
         multi_docs = len(docs) > 1
         ac.viewer_close_other.setEnabled(multi_docs)
         ac.viewer_close_all.setEnabled(multi_docs)
         sm.addAction(ac.viewer_close_other)
         sm.addAction(ac.viewer_close_all)
开发者ID:19joho66,项目名称:frescobaldi,代码行数:19,代码来源:contextmenu.py

示例10: menu_file_new_from_template

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
def menu_file_new_from_template(parent):
    m = QMenu(parent)
    m.setTitle(_("New from &Template"))
    m.triggered.connect(slot_file_new_from_template_action)
    from snippet import model, actions, snippets
    groups = {}
    for name in sorted(model.model().names()):
        variables = snippets.get(name).variables
        group = variables.get('template')
        if group:
            action = actions.action(name, m)
            if action:
                groups.setdefault(group, []).append(action)
    for group in sorted(groups):
        for action in groups[group]:
            m.addAction(action)
        m.addSeparator()
    qutil.addAccelerators(m.actions())
    return m
开发者ID:19joho66,项目名称:frescobaldi,代码行数:21,代码来源:globalmenu.py

示例11: create_menu

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
    def create_menu(self):
        self.popup = QMenu(self)
        main_acts = [self.open_act, self.open_new_act, self.reload_act, self.print_act, self.save_act]
        edit_acts1 = [self.rotleft_act, self.rotright_act, self.fliph_act, self.flipv_act]
        edit_acts2 = [self.resize_act, self.crop_act]
        view_acts = [self.next_act, self.prev_act, self.zin_act, self.zout_act, self.fit_win_act, self.fulls_act, self.ss_act, self.ss_next_act]
        help_acts = [self.help_act, self.about_act, self.aboutQt_act]
        end_acts = [self.prefs_act, self.props_act, self.close_act, self.exit_act]
        for act in main_acts:
            self.popup.addAction(act)
        edit_menu = QMenu(self.popup)
        edit_menu.setTitle('&Edit')
        for act in edit_acts1:
            edit_menu.addAction(act)
        edit_menu.addSeparator()
        for act in edit_acts2:
            edit_menu.addAction(act)
        self.popup.addMenu(edit_menu)
        view_menu = QMenu(self.popup)
        view_menu.setTitle('&View')
        for act in view_acts:
            view_menu.addAction(act)
        self.popup.addMenu(view_menu)
        help_menu = QMenu(self.popup)
        help_menu.setTitle('&Help')
        for act in help_acts:
            help_menu.addAction(act)
        self.popup.addMenu(help_menu)
        for act in end_acts:
            self.popup.addAction(act)

        self.action_list = main_acts + edit_acts1 + edit_acts2 + view_acts + help_acts + end_acts
        for act in self.action_list:
            self.addAction(act)
开发者ID:riverrun,项目名称:cheesemaker,代码行数:36,代码来源:gui.py

示例12: MenuBar

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
class MenuBar(QMenuBar):
    def __init__(self, parent):
        super(MenuBar, self).__init__(parent)

        self.file_menu = FileMenu(self)
        self.edit_menu = QMenu(self)
        self.view_menu = QMenu(self)
        self.window_menu = QMenu(self)
        self.help_menu = QMenu(self)

        self.addAction(self.file_menu.menuAction())
        self.addAction(self.edit_menu.menuAction())
        self.addAction(self.view_menu.menuAction())
        self.addAction(self.window_menu.menuAction())
        self.addAction(self.help_menu.menuAction())

        self.file_menu.setTitle("File")
        self.edit_menu.setTitle("Edit")
        self.view_menu.setTitle("View")
        self.window_menu.setTitle("Window")
        self.help_menu.setTitle("Help")
开发者ID:mhhg,项目名称:FarsStat,代码行数:23,代码来源:menu_bar.py

示例13: setTitle

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
 def setTitle(self, title):
     self._title.setText(title)
     QMenu.setTitle(title)
开发者ID:wxgeo,项目名称:geophar,代码行数:5,代码来源:qtlib.py

示例14: menu_help

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]
def menu_help(parent):
    m = QMenu(parent)
    m.setTitle(_('menu title', '&Help'))
    role = QAction.AboutRole if use_osx_menu_roles() else QAction.NoRole
    m.addAction(icons.get('help-about'), _("&About {appname}...").format(appname=appinfo.appname), help_about).setMenuRole(role)
    return m
开发者ID:19joho66,项目名称:frescobaldi,代码行数:8,代码来源:globalmenu.py

示例15: MainWindow

# 需要导入模块: from PyQt5.QtWidgets import QMenu [as 别名]
# 或者: from PyQt5.QtWidgets.QMenu import setTitle [as 别名]

#.........这里部分代码省略.........
            msgBox.setText(message)
            msgBox.setIcon(QMessageBox.Information)
            icon = QIcon()
            icon.addPixmap(QPixmap("./resource/weather-thunder.png"), QIcon.Normal, QIcon.Off)
            msgBox.setWindowIcon(icon)
            msgBox.setWindowTitle(" ")
            msgBox.exec_()
            return

        move(dayPic,directory)
        move(densityPic,directory)

    def openMxdDay(self):
        program  = u'C:/Program Files (x86)/ArcGIS/Desktop10.3/bin/ArcMap.exe'
        src_dir = ''.join([cwd,u'/data/LightningBulletin.gdb'])
        dest_dir = ''.join([cwd,u"/bulletinTemp/",self.in_parameters[u'datetime'], u"/" , self.in_parameters[u'target_area']])
        src_file = ''.join([self.in_parameters[u'target_area'] , u"地闪雷暴日空间分布模板.mxd"])

        copy(os.path.join(src_dir,src_file),dest_dir)

        arguments = [os.path.join(dest_dir,src_file)]
        self.process = QProcess(self)
        self.process.start(program,arguments)

    def openMxdDensity(self):
        program  = u'C:/Program Files (x86)/ArcGIS/Desktop10.3/bin/ArcMap.exe'
        src_dir = ''.join([cwd,u'/data/LightningBulletin.gdb'])
        dest_dir = ''.join([cwd,u"/bulletinTemp/",self.in_parameters[u'datetime'], u"/" , self.in_parameters[u'target_area']])
        src_file = ''.join([self.in_parameters[u'target_area'] ,u"闪电密度空间分布模板.mxd"])


        copy(os.path.join(src_dir,src_file),dest_dir)

        arguments = [os.path.join(dest_dir,src_file)]
        self.process = QProcess(self)
        self.process.start(program,arguments)

    def showAbout(self):
        self.about = About_Dialog()

    def showHelp(self):
        program  = u'C:/Windows/hh.exe'
        arguments = [''.join([cwd,'/help/help.CHM'])]
        self.process = QProcess(self)
        self.process.start(program,arguments)

    def updateTargetArea(self, area):
        self.in_parameters[u'target_area'] = area

    def updateDatetime(self, date):
        self.in_parameters[u'datetime'] = str(date.year()) + u'年'
        if self.in_parameters.has_key(u'origin_data_path'):
            self.in_parameters.__delitem__(u'origin_data_path')

    def updateDensityCell(self, cell):
        self.in_parameters[u'density_cell'] = str(cell)

    def updateDensityClass(self, nclass):
        self.in_parameters[u'density_class'] = nclass

    def updateDayCell(self, cell):
        self.in_parameters[u'day_cell'] = str(cell)


    def updateDayClass(self, nclass):
        self.in_parameters[u'day_class'] = nclass

    def center(self):
        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())

    def retranslateUi(self):
        _translate = QCoreApplication.translate
        self.setWindowTitle(_translate("MainWindow", "绍兴防雷中心 雷电公报制图"))
        self.datetime_label.setText(_translate("MainWindow", "年份"))
        self.datetime.setDisplayFormat(_translate("MainWindow", "yyyy"))
        self.target_area_label.setText(_translate("MainWindow", "地区"))
        self.target_area.setItemText(0, _translate("MainWindow", "绍兴市"))
        self.target_area.setItemText(1, _translate("MainWindow", "柯桥区"))
        self.target_area.setItemText(2, _translate("MainWindow", "上虞区"))
        self.target_area.setItemText(3, _translate("MainWindow", "诸暨市"))
        self.target_area.setItemText(4, _translate("MainWindow", "嵊州市"))
        self.target_area.setItemText(5, _translate("MainWindow", "新昌县"))
        self.density_cell_label.setText(_translate("MainWindow", "插值网格大小"))
        self.density_class_label.setText(_translate("MainWindow", "制图分类数目"))
        self.density_mxd.setText(_translate("MainWindow", "ArcGIS文档"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.density_tab), _translate("MainWindow", "电闪密度"))
        self.day_cell_label.setText(_translate("MainWindow", "插值网格大小"))
        self.day_class_label.setText(_translate("MainWindow", "制图分类数目"))
        self.day_mxd.setText(_translate("MainWindow", "ArcGIS文档"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.day_tab), _translate("MainWindow", "雷暴日"))
        self.execute_button.setText(_translate("MainWindow", "执行"))
        self.file_menu.setTitle(_translate("MainWindow", "文件"))
        self.help_menu.setTitle(_translate("MainWindow", "帮助"))
        self.action_add_data.setText(_translate("MainWindow", "加载数据"))
        self.action_help.setText(_translate("MainWindow", "使用说明"))
        self.action_about.setText(_translate("MainWindow", "关于"))
        self.action_save_pic.setText(_translate("MainWindow", "图片另存为"))
开发者ID:LuckyBoy314,项目名称:LightningBulletin_v1,代码行数:104,代码来源:UI.py


注:本文中的PyQt5.QtWidgets.QMenu.setTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。