Exemple #1
0
    def report_issue(self):
        if PY3:
            from urllib.parse import quote
        else:
            from urllib import quote     # analysis:ignore

        issue_template = """\
## Description

- *What steps will reproduce the problem?*
1.
2.
3.

- *What is the expected output? What do you see instead?*


- *Please provide any additional information below*


## Version and main components

- Conda Package Manager Version:  {version}
- Conda Version:  {conda version}
- Python Version:  {python version}
- Qt Version    :  {Qt version}
- QtPy Version    :  {QtPy version}
"""
        url = QUrl("https://github.com/spyder-ide/conda-manager/issues/new")
        url.addEncodedQueryItem("body", quote(issue_template))
        QDesktopServices.openUrl(url)
Exemple #2
0
 def open_url(self, url):
     """
     Open link from action in default operating system browser.
     """
     if url is None:
         return
     QDesktopServices.openUrl(QUrl(url))
Exemple #3
0
 def open_url(self, url):
     """
     Open link from action in default operating system browser.
     """
     if url is None:
         return
     QDesktopServices.openUrl(QUrl(url))
    def report_issue(self):
        if PY3:
            from urllib.parse import quote
        else:
            from urllib import quote     # analysis:ignore

        issue_template = """\
## Description

- *What steps will reproduce the problem?*
1.
2.
3.

- *What is the expected output? What do you see instead?*


- *Please provide any additional information below*


## Version and main components

- Conda Package Manager Version:  {version}
- Conda Version:  {conda version}
- Python Version:  {python version}
- Qt Version    :  {Qt version}
- QtPy Version    :  {QtPy version}
"""
        url = QUrl("https://github.com/spyder-ide/conda-manager/issues/new")
        url.addEncodedQueryItem("body", quote(issue_template))
        QDesktopServices.openUrl(url)
 def helpClicked(self):
     try:
         from pymantidplot.proxies import showCustomInterfaceHelp
         showCustomInterfaceHelp("Filter Events")
     except ImportError:
         url = ("http://docs.mantidproject.org/nightly/interfaces/{}.html"
                "".format("Filter Events"))
         QDesktopServices.openUrl(QUrl(url))
Exemple #6
0
 def helpClicked(self):
     try:
         from pymantidplot.proxies import showCustomInterfaceHelp
         showCustomInterfaceHelp("Filter Events")
     except ImportError:
         url = ("http://docs.mantidproject.org/nightly/interfaces/{}.html"
                "".format("Filter Events"))
         QDesktopServices.openUrl(QUrl(url))
Exemple #7
0
 def mouseReleaseEvent(self, event):
     """Ooen anchors when clicked."""
     if self.anchor:
         QDesktopServices.openUrl(QUrl(self.anchor))
         QApplication.setOverrideCursor(Qt.ArrowCursor)
         self.anchor = None
     else:
         super(ControlWidget, self).mouseReleaseEvent(event)
Exemple #8
0
 def open_login_page(self):
     """
     """
     conda_url = CONF.get('main', 'conda_url')
     url = "{0}/{1}".format(conda_url, self.username)
     qurl = QUrl(url)
     QDesktopServices.openUrl(qurl)
     self.tracker.track_event('content', 'clicked', url)
Exemple #9
0
    def open_url(url):
        """
        Open link from action in default operating system browser.

        ADD TRACKING!.
        """
        if url:
            QDesktopServices.openUrl(QUrl(url))
Exemple #10
0
 def launch(self, uri, title):
     """
     Emit signal with youtube video identifier string.
     """
     qurl = QUrl(uri)
     QDesktopServices.openUrl(qurl)
     self.tracker.track_event('content', 'click', uri)
     self.sig_view_video.emit(uri, title)
Exemple #11
0
 def helpClicked(self):
     try:
         import mantidqt
         mantidqt.interfacemanager.InterfaceManager(
         ).showCustomInterfaceHelp("Filter Events", "utility")
     except ImportError:
         url = ("http://docs.mantidproject.org/nightly/interfaces/{}.html"
                "".format("Filter Events"))
         QDesktopServices.openUrl(QUrl(url))
Exemple #12
0
def do_show_help(main_window):
    """ Show help
    """
    # close previous service
    main_window._assistantProcess.close()
    main_window._assistantProcess.waitForFinished()

    # launch
    helper_url = QUrl('https://neutrons.github.io/addie/index.html')
    QDesktopServices.openUrl(helper_url)
Exemple #13
0
def do_show_help(main_window):
    """ Show help
    """
    # close previous service
    main_window._assistantProcess.close()
    main_window._assistantProcess.waitForFinished()

    # launch
    helper_url = QUrl('https://neutrons.github.io/addie/index.html')
    QDesktopServices.openUrl(helper_url)
Exemple #14
0
    def open_web_report(body, title=None):
        """
        Open a new issue on Github with prefilled information.

        Parameters
        ----------
        body: str
            The body content of the report.
        title: str or None, optional
            The title of the report. Default is None.
        """
        url = QUrl(__project_url__ + '/issues/new')
        query = QUrlQuery()
        query.addQueryItem("body", quote(body))

        if title:
            query.addQueryItem("title", quote(title))

        url.setQuery(query)
        QDesktopServices.openUrl(url)
Exemple #15
0
def make_about_widget(mfixgui, label_policy):
    """ Create widget for About filemenu pane """
    about_widget = mfixgui.ui.file_menu_about_widget = get_ui('about.ui')
    about_widget.about_label.setSizePolicy(label_policy)
    about_widget.copy_btn.clicked.connect(lambda: _copy_version_info(mfixgui))
    about_widget.mailinglist_lbl.linkActivated.connect(lambda url: QDesktopServices.openUrl(QUrl(url)))

    about_widget.version_info_txtbrowser.setText(os.linesep.join(get_version_info()))

    splash = about_widget.label_splash
    pixmap = get_pixmap('splash.png', 600, 338)
    splash.setPixmap(pixmap)
    splash.setAlignment(Qt.AlignCenter)

    return about_widget
Exemple #16
0
    def _handle_error_msg(self, msg):
        """Handle error message with an error dialog."""
        error_message_dialog = QMessageBox(self._parent)
        error_message_dialog.setText(
            _("<b>An error ocurred while Kite was installing!</b><br><br>"
              "You can follow our manual install instructions to<br>"
              "integrate Kite with Spyder yourself."))
        error_message_dialog.setWindowTitle(_('Kite install error'))

        get_help_button = QPushButton(_('Contact Kite for help'))
        get_help_button.clicked.connect(
            lambda: QDesktopServices.openUrl(
                    QUrl('https://kite.com/contact/')))
        error_message_dialog.addButton(get_help_button, QMessageBox.ActionRole)
        error_message_dialog.exec_()
        self.accept()
Exemple #17
0
def start_file(filename):
    """
    Generalized os.startfile for all platforms supported by Qt

    This function is simply wrapping QDesktopServices.openUrl

    Returns True if successful, otherwise returns False.
    """

    # We need to use setUrl instead of setPath because this is the only
    # cross-platform way to open external files. setPath fails completely on
    # Mac and doesn't open non-ascii files on Linux.
    # Fixes spyder-ide/spyder#740.
    url = QUrl()
    url.setUrl(filename)
    return QDesktopServices.openUrl(url)
Exemple #18
0
def start_file(filename):
    """
    Generalized os.startfile for all platforms supported by Qt

    This function is simply wrapping QDesktopServices.openUrl

    Returns True if successfull, otherwise returns False.
    """
    from qtpy.QtCore import QUrl
    from qtpy.QtGui import QDesktopServices

    # We need to use setUrl instead of setPath because this is the only
    # cross-platform way to open external files. setPath fails completely on
    # Mac and doesn't open non-ascii files on Linux.
    # Fixes Issue 740
    url = QUrl()
    url.setUrl(filename)
    return QDesktopServices.openUrl(url)
Exemple #19
0
 def call(self, channels, sender):
     QDesktopServices.openUrl(QUrl(BBB_URL))
Exemple #20
0
 def open_url(self, url):
     qurl = QUrl(url)
     QDesktopServices.openUrl(qurl)
     self.tracker.track_event('help', 'documentation', url)
Exemple #21
0
 def _link_activated(url):
     QDesktopServices.openUrl(QUrl(url))
     from anaconda_navigator.utils.analytics import GATracker
     tracker = GATracker()
     tracker.track_event('content', 'link', url)
Exemple #22
0
 def open_url(self, url):
     """Open given url in the default browser and log the action."""
     self.tracker.track_event('content', 'click', url)
     self.sig_url_clicked.emit(url)
     QDesktopServices.openUrl(QUrl(url))
Exemple #23
0
 def getCacheFolder():
     return QDesktopServices.storageLocation(QDesktopServices.CacheLocation)
Exemple #24
0
 def open_archiver(self):
     QDesktopServices.openUrl(QUrl(VIEWER_URL))
Exemple #25
0
 def openUrlWithDefaultApplication(self, url):
     return QDesktopServices.openUrl(url)
Exemple #26
0
 def goto_avs(self):
     ''' Open the corresponding AVS post. '''
     QDesktopServices.openUrl(
         QUrl(self.__get_catalogue_from_results()['AVS']))
Exemple #27
0
 def goto_catalogue(self):
     ''' Opens the catalogue page in a browser '''
     QDesktopServices.openUrl(
         QUrl(self.__get_catalogue_from_results()['Catalogue']))
Exemple #28
0
 def _link_activated(self, url):
     QDesktopServices.openUrl(QUrl(url))
     tracker = GATracker()
     tracker.track_event('content', 'link', url)
Exemple #29
0
 def show_url(self, url=None):
     """Open url in default browser."""
     if url:
         qurl = QUrl(url)
         QDesktopServices.openUrl(qurl)
         self.tracker.track_event('help', 'documentation', url)
Exemple #30
0
    def __init__(self):
        super(XicamMainWindow, self).__init__()

        # Set icon
        self.setWindowIcon(QIcon(QPixmap(str(path("icons/xicam.gif")))))

        # Set size and position
        self.setGeometry(0, 0, 1000, 600)
        frameGm = self.frameGeometry()
        screen = QApplication.desktop().screenNumber(
            QApplication.desktop().cursor().pos())
        centerPoint = QApplication.desktop().screenGeometry(screen).center()
        frameGm.moveCenter(centerPoint)
        self.move(frameGm.topLeft())

        # Init child widgets to None
        self.topwidget = (self.leftwidget) = (self.rightwidget) = (
            self.bottomwidget
        ) = self.lefttopwidget = self.righttopwidget = self.leftbottomwidget = self.rightbottomwidget = None

        # Setup appearance
        self.setWindowTitle("Xi-cam")
        self.load_style()

        # Attach an object to restore config when loaded
        self._config_restorer = ConfigRestorer()

        # Load plugins
        pluginmanager.qt_is_safe = True
        pluginmanager.initialize_types()
        pluginmanager.collect_plugins()
        pluginmanager.collect_user_plugins()

        # Setup center/toolbar/statusbar/progressbar
        self.pluginmodewidget = pluginModeWidget()
        self.pluginmodewidget.sigSetStage.connect(self.setStage)
        self.pluginmodewidget.sigSetGUIPlugin.connect(self.setGUIPlugin)
        self.addToolBar(self.pluginmodewidget)
        self.setStatusBar(QStatusBar(self))
        msg.progressbar = QProgressBar(self)
        msg.progressbar.hide()
        msg.statusbar = self.statusBar()
        self.statusBar().addPermanentWidget(msg.progressbar)
        self.setCentralWidget(QStackedWidget())
        # NOTE: CentralWidgets are force-deleted when replaced, even if the object is still referenced;
        # To avoid this, a QStackedWidget is used for the central widget.

        # Setup menubar
        menubar = DebuggableMenuBar()
        self.setMenuBar(menubar)
        file = QMenu("&File", parent=menubar)
        plugins = QMenu("&Plugins", parent=menubar)
        menubar.addMenu(file)
        file.addAction("Se&ttings",
                       self.showSettings,
                       shortcut=QKeySequence(Qt.CTRL + Qt.ALT + Qt.Key_S))
        file.addAction("E&xit", self.close)
        menubar.addMenu(plugins)
        plugins.addAction("Open User &Plugin Directory",
                          self.openUserPluginDir,
                          shortcut=QKeySequence(Qt.CTRL + Qt.ALT + Qt.Key_P))

        # Set up help
        help = QMenu("&Help", parent=menubar)
        documentation_link = QUrl("https://xi-cam.readthedocs.io/en/latest/")
        help.addAction("Xi-CAM &Help",
                       lambda: QDesktopServices.openUrl(documentation_link))
        slack_link = QUrl("https://nikea.slack.com")
        help.addAction("Chat on &Slack",
                       lambda: QDesktopServices.openUrl(slack_link))
        help.addSeparator()

        about_title = "About Xi-CAM"
        version_text = f"""Version: <strong>{version.get_versions()['version']}</strong>"""
        copyright_text = f"""<small>Copyright (c) 2016, The Regents of the University of California, \
            through Lawrence Berkeley National Laboratory \
            (subject to receipt of any required approvals from the U.S. Dept. of Energy). \
            All rights reserved.</small>"""
        funding_text = f"""Funding for this research was provided by: \
            Lawrence Berkeley National Laboratory (grant No. TReXS LDRD to AH); \
            US Department of Energy (award No. Early Career Award to AH; \
            contract No. DE-SC0012704; contract No. DE-AC02-06CH11357; \
            contract No. DE-AC02-76SF00515; contract No. DE-AC02-05CH11231); \
            Center for Advanced Mathematics in Energy Research Applications; \
            Light Source Directors Data Solution Task Force Pilot Project."""
        about_text = version_text + "<br><br>" + funding_text + "<br><hr>" + copyright_text
        about_box = QMessageBox(QMessageBox.NoIcon, about_title, about_text)
        about_box.setTextFormat(Qt.RichText)
        about_box.setWindowModality(Qt.NonModal)
        help.addAction("&About Xi-CAM", lambda: about_box.show())
        help.addSeparator()

        help.addAction(QWhatsThis.createAction(help))

        menubar.addMenu(help)

        # Initialize layout with first plugin
        self._currentGUIPlugin = None
        self.build_layout()

        # self._currentGUIPlugin = pluginmanager.getPluginsOfCategory("GUIPlugin")[0]
        self.populate_layout()

        # Make F key bindings
        fkeys = [
            Qt.Key_F1,
            Qt.Key_F2,
            Qt.Key_F3,
            Qt.Key_F4,
            Qt.Key_F5,
            Qt.Key_F6,
            Qt.Key_F7,
            Qt.Key_F8,
            Qt.Key_F9,
            Qt.Key_F10,
            Qt.Key_F11,
            Qt.Key_F12,
        ]
        self.Fshortcuts = [QShortcut(QKeySequence(key), self) for key in fkeys]
        for i in range(12):
            self.Fshortcuts[i].activated.connect(partial(self.setStage, i))

        self.readSettings()
        # Wireup default widgets
        get_default_stage()["left"].sigOpen.connect(self.open)
        get_default_stage()["left"].sigOpen.connect(print)
        get_default_stage()["left"].sigPreview.connect(
            get_default_stage()["lefttop"].preview)
 def __open_url(self, url: str) -> None:
     """Use to open link."""
     QDesktopServices.openUrl(QUrl(url))
     self.showMinimized()
Exemple #32
0
 def slotHelpHomePage(self):
     QDesktopServices.openUrl(
         QUrl("https://github.com/wudingcheng/tsanalyzer"))
Exemple #33
0
 def show_help():
     ''' Opens the user guide in a browser '''
     QDesktopServices.openUrl(
         QUrl('https://qvibe.readthedocs.io/en/latest'))
Exemple #34
0
 def slotHelpBugs(self):
     QDesktopServices.openUrl(
         QUrl("https://github.com/wudingcheng/TSAnalyzer/issues"))
Exemple #35
0
 def open_url(self, url):
     self.tracker.track_event('content', 'click', url)
     QDesktopServices.openUrl(QUrl(url))
Exemple #36
0
 def _link_activated(url):
     QDesktopServices.openUrl(QUrl(url))