Esempio n. 1
0
def test():
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication(test_time=5)
    w = FileExplorerTest()
    w.resize(640, 480)
    w.show()
    app.exec_()
Esempio n. 2
0
def local_test():  # pragma: no cover
    """Run local test."""
    app = qapplication()
    w = LicenseManagerDialog()
    w.update_style_sheet()
    w.show()
    app.exec_()
Esempio n. 3
0
def test():
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication()
    dlg = AboutDialog(parent=None)
    dlg.setStyleSheet(load_style_sheet())
    dlg.show()
    app.exec_()
Esempio n. 4
0
def local_test():  # pragma: no cover
    """Run local test."""
    import tempfile
    from anaconda_navigator.utils.qthelpers import qapplication
    from anaconda_navigator.utils.logs import setup_logger

    log_folder = tempfile.mkdtemp()
    log_filename = 'testlog.log'
    setup_logger(log_folder=log_folder, log_filename=log_filename)
    log_path = os.path.join(log_folder, log_filename)

    app = qapplication()
    widget_development = test_json_endpoint(dev=True)
    widget_development.show()

    widget_production = test_json_endpoint(dev=False)
    widget_production.show()

    ex = app.exec_()

    with open(log_path) as f:
        text = f.read()

    if "No JSON object could be decoded" in text:
        sys.exit(1)
    sys.exit(ex)
Esempio n. 5
0
def test():
    from anaconda_navigator.utils.qthelpers import qapplication
    from anaconda_navigator.config import get_home_dir
    app = qapplication()

    w1 = EditableLineEdit('Project name', 'my-project',
                          regex='[A-Za-z0-9_\- ]{1,20}')
    w1.show()

    w2 = EditablePathEdit('Icon', '',
                          basedir=get_home_dir(),
                          fileselect=True,
                          caption='Select icon file',
                          filters="Image files (*.png *.jpg)")
    w2.show()

    w3 = MessageCheckBox.warning(
        None,
        'Delete project',
        'Do you really want to delete project {0}?'.format(''),
        checkbox_text='Delete project files',
        buttons=MessageCheckBox.Yes | MessageCheckBox.No,
        )
    reply = w3.exec_()
    print(reply, w3.is_checked())
    app.exec_()
Esempio n. 6
0
def local_test():  # pragma: no cover
    """Main local testing."""
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication()
    widget = PreferencesDialog(parent=None)
    widget.show()
    app.exec_()
Esempio n. 7
0
def local_test():  # pragma: no cover
    """Main local test."""
    from anaconda_navigator.utils.qthelpers import qapplication
    urls = [
        'https://repo.continuum.io/pkgs/free/linux-64/repodata.json.bz2',
        'https://repo.continuum.io/pkgs/free/linux-64/repodata.json.bz2',
        'https://conda.anaconda.org/anaconda/linux-64/repodata.json.bz2',
        'https://conda.anaconda.org/asmeurer/linux-64/repodata.json.bz2',
        'https://conda.anaconda.org/conda-forge/linux-64/repodata.json.bz2',
    ]
    path = os.sep.join([os.path.expanduser('~'), 'testing-download'])

    app = qapplication()
    api = DownloadAPI()
    urls += ['asdasdasdad']
    for i, url in enumerate(urls):
        worker = api.is_valid_url(url)
        worker.url = url
        worker.sig_finished.connect(ready_print)
        filepath = os.path.join(path, str(i) + '.json.bz2')
        worker = api.download(url, path=filepath, force=True)
        worker.sig_finished.connect(ready_print)

    api = DownloadAPI()
    print(api._is_valid_api_url('https://api.anaconda.org'))
    print(api._is_valid_api_url('https://conda.anaconda.org'))
    print(api._is_valid_channel('https://google.com'))
    print(api._is_valid_channel('https://conda.anaconda.org/continuumcrew'))
    print(api.get_api_info('https://api.anaconda.org'))
    sys.exit(app.exec_())
Esempio n. 8
0
def local_test():  # pragma: no cover
    """Main local test."""
    from anaconda_navigator.utils.qthelpers import qapplication

    app = qapplication()
    api = AnacondaAPI()
    #    worker = api.load_repodata()
    # api.sig_repodata_updated.connect(repodata_updated)
    data_directory = METADATA_PATH
    api.set_data_directory(data_directory)
    worker = api.update_index_and_metadata()
    worker.start_time = time.time()
    worker.sig_chain_finished.connect(finished)
    # worker = api.update_metadata()
    # worker.sig_chain_finished.connect(finished)
    # worker = api.load_repodata()
    # worker.sig_chain_finished.connect(finished)
    # worker = api.update_index()
    # worker.sig_finished.connect(finished)
    # worker = api.update_metadata()
    # worker.sig_download_finished.connect(download_finished)
    # api.update_repodata()
    #    lic = api.get_package_license('anaconda-fusion')
    #    print(lic)
    app.exec_()
Esempio n. 9
0
def local_test():  # pragma: no cover
    """Run local tests."""
    from anaconda_navigator.utils.qthelpers import qapplication

    app = qapplication()
    #    widget_create = CreateDialog(
    #        parent=None, projects=['project1', 'project2']
    #    )
    #    widget_create.show()
    #
    #    widget_import = ImportDialog(
    #        parent=None, projects=['project1', 'project2']
    #    )
    #    widget_import.show()
    #
    #    widget_remove = RemoveDialog(parent=None, project='Test')
    #    widget_remove.show()
    #
    #    problems = ['problem \n\n as ' + str(i) for i in range(100)]
    #    dlg = DialogProblems(parent=None, problems=problems)
    #    dlg.exec_()

    widget_projects_folder = ProjectsPathDialog(parent=None)
    widget_projects_folder.show()

    sys.exit(app.exec_())
Esempio n. 10
0
def local_test():  # pragma: no cover
    """Run local test."""
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication()

    widget = LogViewerDialog()
    widget.show()
    sys.exit(app.exec_())
Esempio n. 11
0
def test():
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication()
    dlg = QuitApplicationDialog(parent=None)
#    dlg = ClosePackageManagerDialog(parent=None)
    reply = dlg.exec_()
    print(dlg.checkbox.checkState() == Qt.Checked)
    print(reply)
Esempio n. 12
0
def local_test():  # pragma: no cover
    """Run conda packages widget test."""
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication()
    widget = CondaPackagesWidget(parent=None)
    widget.update_style_sheet()
    widget.show()
    sys.exit(app.exec_())
Esempio n. 13
0
def test():
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication(test_time=3)
    dialog = DialogUpdateApplication(version='1.2.0')
    dialog.update_style_sheet()
    if dialog.exec_():
        print('token', dialog.token)
    app.exec_()
Esempio n. 14
0
def local_test():  # pragma: no cover
    """Run loca tests."""
    from anaconda_navigator.utils.qthelpers import qapplication

    app = qapplication()
    widget = LineEditSearch()
    widget.show()
    app.exec_()
Esempio n. 15
0
def test():
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication(test_time=3)
    dialog = AuthenticationDialog(AnacondaAPI())
    dialog.update_style_sheet()
    if dialog.exec_():
        print('token', dialog.token)
    app.exec_()
Esempio n. 16
0
def local_test():  # pragma: no cover
    """Run local test."""
    from anaconda_navigator.utils.qthelpers import qapplication

    app = qapplication()
    widget = TableCondaPackages(None)
    widget.show()
    app.exec_()
Esempio n. 17
0
def local_test():  # pragma: no cover
    """Run local test for project tab."""
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication()
    w = ProjectsTab()
    w.update_style_sheet()
    w.showMaximized()
    app.exec_()
Esempio n. 18
0
def local_test():
    """Run local test for project widget."""
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication()
    w = ProjectsWidget()
    w.showMaximized()
    w.ordered_widgets()
    app.exec_()
Esempio n. 19
0
def local_test():  # pragma: no cover
    """Run local test."""
    from anaconda_navigator.utils.qthelpers import qapplication

    app = qapplication()
    widget = AboutDialog(parent=None)
    widget.setStyleSheet(load_style_sheet())
    widget.show()
    app.exec_()
Esempio n. 20
0
def local_test():  # pragma: no cover
    """Run local tests."""
    from anaconda_navigator.utils.qthelpers import qapplication

    app = qapplication(test_time=3)
    widget = DialogOfflineMode()
    widget.update_style_sheet()
    widget.show()
    app.exec_()
Esempio n. 21
0
def local_test():  # pragma: no cover
    """Run loca tests."""
    from anaconda_navigator.utils.qthelpers import qapplication

    app = qapplication()
    widget = PasswordEdit()
    widget.update_style_sheet(style_sheet=load_style_sheet())
    widget.show()
    app.exec_()
Esempio n. 22
0
def local_test():  # pragma: no cover
    """Run local test."""
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication(test_time=3)
    load_fonts(app)
    widget = AuthenticationDialog(AnacondaAPI())
    widget.update_style_sheet()
    widget.show()
    app.exec_()
Esempio n. 23
0
def local_test():  # pragma: no cover
    """Run local tests."""
    from anaconda_navigator.utils.qthelpers import qapplication

    app = qapplication(test_time=3)
    widget = DialogUpdateApplication(version='1.5.0', startup=True)
    widget.update_style_sheet()
    widget.show()
    app.exec_()
Esempio n. 24
0
def test():
    app = qapplication()
    w1 = SplashScreen()
    w1.show_message('Initializing...')
    w1.show()
    w2 = FirstSplash()
    w2.show()
    w2.update_style_sheet()
    app.exec_()
Esempio n. 25
0
def local_test():  # pragma: no cover
    """Run local test."""
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication()
    widget_quit = QuitApplicationDialog(parent=None)
    widget_quit.show()
    runp = [{'package': 'anaconda-fusion'}, {'package': 'qtconsole'}]
    widget = QuitRunningAppsDialog(parent=None, running_processes=runp)
    widget.show()
    app.exec_()
Esempio n. 26
0
def local_test():  # pragma: no cover
    """Run local test."""
    from anaconda_navigator.utils.qthelpers import qapplication
    from anaconda_navigator.utils.styles import load_style_sheet

    app = qapplication()
    widget = EnvironmentsTab()
    widget.setStyleSheet(load_style_sheet())
    # widget.setup()
    widget.show()
    app.exec_()
Esempio n. 27
0
def local_test():  # pragma: no cover
    """Main local test."""
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication()
    tracker = GATracker()
    worker = tracker.track_page('/home')
    worker.sig_finished.connect(print_test)
    print(worker)
    print(tracker.get_screen_resolution())
    print(tracker.get_language())
    app.exec_()
def start_app(options):  # pragma: no cover
    """Main application entry point."""
    # Setup logger
    setup_logger(options.log_level)

    # Monkey patching sys.excepthook to avoid crashes in PyQt 5.5+
    if PYQT5:
        sys.excepthook = except_hook

    # Clean old style logs
    clean_logs()

    global app
    app = qapplication(test_time=60)
    set_application_icon()
    load_fonts(app)
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    # Create file lock
    lock = filelock.FileLock(LOCKFILE)
    try:
        load_pid = misc.load_pid()

        # This means a PSutil Access Denied error was raised
        if load_pid is False:
            msgbox = MessageBoxInformation(
                title="Anaconda Navigator Startup Error",
                text=(
                    "Navigator failed to start due to an incorrect shutdown. "
                    "<br><br>"
                    "We were unable to remove the pid & lock files. "
                    "Please manually remove the following files and restart "
                    "Anaconda Navigator:<br><ul>"
                    "<li><pre>{}</pre></li><li><pre>{}</pre></li></ul>"
                    "".format(LOCKFILE, PIDFILE)))
            sys.exit(msgbox.exec_())
        elif load_pid is None:  # A stale lock might be around
            misc.remove_lock()

        with lock.acquire(timeout=3.0):  # timeout in seconds
            misc.save_pid()
            splash = SplashScreen()
            splash.show_message("Initializing...")
            window = run_app(splash)
            app.window = window
            event_eater = EventEater(app)
            app.installEventFilter(event_eater)
            sys.exit(app.exec_())
    except filelock.Timeout:
        msgbox = MessageBoxInformation(title="Anaconda Navigator Information",
                                       text=("There is an instance of "
                                             "Anaconda Navigator already "
                                             "running."))
        sys.exit(msgbox.exec_())
Esempio n. 29
0
def test():
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication()
    tracker = GATracker()
    worker = tracker.track_page('/home')
    worker.sig_finished.connect(print_test)
    print(worker)
    print(tracker.get_ip())
    print(tracker.get_screen_resolution())
    print(tracker.get_language())
    app.exec_()
Esempio n. 30
0
def test():
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication()
    VIDEOS_URL = "http://content.continuum.io/api/videos"
    EVENTS_URL = "http://content.continuum.io/api/events"
    WEBINARS_URL = "http://content.continuum.io/api/webinars"
    w = CommunityTab(content_urls=[EVENTS_URL, VIDEOS_URL, WEBINARS_URL])
    w.update_style_sheet(load_style_sheet())
    w.setup_tab()
    w.showMaximized()
    sys.exit(app.exec_())
Esempio n. 31
0
def test():
    from anaconda_navigator.utils.qthelpers import qapplication
    app = qapplication()
    api = ClientAPI()
#    api.login('goanpeca', 'asdasd', 'baby', '')
#    api.login('bruce', 'asdasd', 'baby', '')
#    api.login('asdkljasdh', 'asdasd', 'baby', '')
#    api.login('asdkljasdh', 'asdasd', 'baby', '')
#    api.login('asdkljasdh', 'asdasd', 'baby', '')
#    api.login('asdkljasdh', 'asdasd', 'baby', '')
#    api.login('asdkljasdh', 'asdasd', 'baby', '')
#    api.login('asdkljasdh', 'asdasd', 'baby', '')
#    api.login('asdkljasdh', 'asdasd', 'baby', '')

    api.set_domain(domain='https://api.beta.anaconda.org')
    worker = api.multi_packages(logins=['goanpeca'])
    worker.sig_finished.connect(print_output)
    worker = api.organizations(login='******')

    app.exec_()