Пример #1
0
    def onDoubleClick(self):
        currentItem = self.getView().currentItem()

        if currentItem is None:
            return

        # We don't want to make an API request when we're
        # hiding a directory's contents
        if currentItem.isDirectory():
#            if currentItem.isExpanded():
#                #currentItem.setExpanded(False)
            mainView = AppController.getInstance().getMainView()
            mainView.statusBar().showMessage(i18n.LABEL_BLOOPTREE_STATUS_BAR_REQUESTING_FILES)

            #self.hireWorker(self.addItems,currentItem)
            self.addItems(currentItem)
            #mainView.showStatusBarDefaultText()            
            return
        
        if currentItem == self.getRootItem():
            from models.mbu_config import meta
            QDesktopServices.openUrl(QUrl("http://" + meta['SERVER'] + "/" + AppController.getInstance().getUserProfile().getUsername()))
            return
        
        data = currentItem.getItemData()

        # If it's the MyBloop root item, return none
        if data is None:
            return

        if data.has_key('fileURL') and data['fileURL'] is not None:
            QDesktopServices.openUrl(QUrl(data['fileURL']))
Пример #2
0
 def gotoTatoeba(self):
     stIndex = self.getSentenceIndex()
     if stIndex == None:
         return
     iid = stIndex.sibling(stIndex.row(), 6).data().toString()
     url = QtCore.QUrl("http://tatoeba.org/eng/sentences/show/" + iid)
     QDesktopServices.openUrl(url)
Пример #3
0
 def show_pos_pressed(self):
     if self.had_fix:
         google_str = self.last_ns + self.make_dd_dddddd(self.last_lat, True) + '+' + self.last_ew + self.make_dd_dddddd(self.last_long, True)
         QDesktopServices.openUrl(QUrl('https://maps.google.com/maps?q=' + google_str))
     else:
         # :-)
         QDesktopServices.openUrl(QUrl('http://www.google.com/moon/'))
 def _showHelp(self):
     help_path = os.path.join(
         PagLuxembourg.main.plugin_dir,
         'help',
         'user',
         'index.html')
     QDesktopServices.openUrl(QUrl('file:///' + help_path, QUrl.TolerantMode))
Пример #5
0
 def on_update_finished(self, ret):
     if ret:
         reply = QMessageBox.question(
             self, 'New Version Available', 'Do you want to download new version?',
             QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
         if reply == QMessageBox.Yes:
             QDesktopServices.openUrl(QUrl("http://crtaci.rs"))
Пример #6
0
    def linkClicked(self, qurl):
        '''three kinds of link:
            external uri: http/https
            page ref link:
            toc anchor link: #
        '''
        name = qurl.toString()
        http = re.compile('https?://')
        if http.match(name):                        # external uri
            QDesktopServices.openUrl(qurl)
            return

        self.load(qurl)
        name = name.replace('file://', '')
        name = name.replace(self.notePath, '').split('#')
        item = self.parent.notesTree.pageToItem(name[0])
        if not item or item == self.parent.notesTree.currentItem():
            return
        else:
            self.parent.notesTree.setCurrentItem(item)
            if len(name) > 1:
                link = "file://" + self.notePath + "/#" + name[1]
                self.load(QUrl(link))
            viewFrame = self.page().mainFrame()
            self.scrollPosition = viewFrame.scrollPosition()
 def show_help(self):
     """Display application help to the user."""
     help_file = 'file:///%s/help/index.html' % self.plugin_builder_path
     # For testing path:
     #QMessageBox.information(None, 'Help File', help_file)
     # noinspection PyCallByClass,PyTypeChecker
     QDesktopServices.openUrl(QUrl(help_file))
Пример #8
0
 def onHelp(self):
     helpPath = Utils.getHelpPath()
     if helpPath == '':
         url = QUrl("http://www.gdal.org/" + self.helpFileName)
     else:
         url = QUrl.fromLocalFile(helpPath + '/' + self.helpFileName)
     QDesktopServices.openUrl(url)
Пример #9
0
 def openLink(self, url):
     if url.toString() == "log":
         self.close()
         logDock =  iface.mainWindow().findChild(QDockWidget, 'MessageLog')
         logDock.show()
     else:
         QDesktopServices.openUrl(url)
Пример #10
0
    def showOnCuzk(self):
        x = self.vfkBrowser.currentDefinitionPoint().first.split(".")[0]
        y = self.vfkBrowser.currentDefinitionPoint().second.split(".")[0]

        url = "http://nahlizenidokn.cuzk.cz/MapaIdentifikace.aspx?&x=-{}&y=-{}".format(
            y, x)
        QDesktopServices.openUrl(QUrl(url, QUrl.TolerantMode))
Пример #11
0
 def open_map_features():
     """
     Open MapFeatures
     """
     desktop_service = QDesktopServices()
     desktop_service.openUrl(
         QUrl("http://wiki.openstreetmap.org/wiki/Mapfeatures"))
Пример #12
0
 def openformfolder(self, url):
     """
     Open the form folder using the OS file manager.
     :param url:
     :return:
     """
     QDesktopServices.openUrl(QUrl.fromLocalFile(self.form.folder))
Пример #13
0
    def onDictyExpressLink(self, link):
        if not self.data:
            return

        selectedIndexes = self.treeWidget.selectedIndexes()
        if not len(selectedIndexes):
            QMessageBox.information(
                self, "No gene ids selected",
                "Please select some genes and try again."
            )
            return
        model = self.treeWidget.model()
        mapToSource = model.mapToSource
        selectedRows = self.treeWidget.selectedIndexes()
        selectedRows = [mapToSource(index).row() for index in selectedRows]
        model = model.sourceModel()

        selectedGeneids = [self.row2geneinfo[row] for row in selectedRows]
        selectedIds = [self.geneinfo[i][0] for i in selectedGeneids]
        selectedIds = set(selectedIds)

        def fix(ddb):
            if ddb.startswith("DDB"):
                if not ddb.startswith("DDB_G"):
                    ddb = ddb.replace("DDB", "DDB_G")
                return ddb
            return None

        genes = [fix(gene) for gene in selectedIds if fix(gene)]
        url = str(link) % " ".join(genes)
        QDesktopServices.openUrl(QUrl(url))
Пример #14
0
 def on_player_finished(self, ret):
     if ret != 0:
         reply = QMessageBox.question(
             self, 'Player Crashed!', 'Open URL in browser?',
             QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
         if reply == QMessageBox.Yes:
             QDesktopServices.openUrl(QUrl(self.player.url))
Пример #15
0
 def open_doc_overpass():
     """
     Open Overpass's documentation
     """
     url = "http://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide"
     desktop_service = QDesktopServices()
     desktop_service.openUrl(QUrl(url))
Пример #16
0
 def send_email(self):
     url = u"mailto:%s?subject=%s&body=%s\n\n%s" % (
         settings.BUG_REPORT_EMAIL, 
         settings.BUG_REPORT_EMAIL_SUBJECT,
         unicode(self.report_text.toPlainText()),
         unicode(self.traceback_text.toPlainText()))
     QDesktopServices.openUrl(QUrl(url))
Пример #17
0
 def openScriptFileExtEditor(self):
     tabWidget = self.tabEditorWidget.currentWidget()
     path = tabWidget.path
     import subprocess
     try:
         subprocess.Popen([os.environ['EDITOR'], path])
     except KeyError:
         QDesktopServices.openUrl(QUrl.fromLocalFile(path))
Пример #18
0
def openFolder(path):
    import sys
    import subprocess
    
    if sys.platform == "win32":
        subprocess.Popen(["explorer", path.encode(sys.getfilesystemencoding())])
    else:
        QDesktopServices.openUrl(QUrl("file://" + path))
Пример #19
0
def onClick(url):
        String = unicode(url.toString())
	if String.startswith("py:"):
	        String = String[3:]
	        eval(String)
	else:
	        from PyQt4.QtGui import QDesktopServices
	        QDesktopServices.openUrl(QUrl(url))	
Пример #20
0
    def openURL(self, url):
        from PyQt4.QtGui import QDesktopServices
        from PyQt4.QtCore import QUrl
        from ubiquity.misc import drop_privileges_save, regain_privileges_save

        # this nonsense is needed because kde doesn't want to be root
        drop_privileges_save()
        QDesktopServices.openUrl(QUrl(url))
        regain_privileges_save()
Пример #21
0
 def _edit_ui_file(self):
     item = self.currentItem()
     if item.parent() is None:
         pathForFile = item.path
     else:
         pathForFile = os.path.join(item.path, item.text(0))
     pathForFile = "file://%s" % pathForFile
     #open the correct program to edit Qt UI files!
     QDesktopServices.openUrl(QUrl(pathForFile, QUrl.TolerantMode))
Пример #22
0
 def _examine_backup(self):
     error = None
     try:
         filename = get_rename_plan_backup_filename()
         QDesktopServices.openUrl(QUrl.fromLocalFile(filename))
     except Exception as err:
         error = err
     finally:
         self._show_backup_decision(error)
Пример #23
0
    def showhelp2(self):
		"""
        def showHTMLReport(title, html, data={}, parent=None):
            dialog = HtmlViewerDialog(title)
            dialog.showHTML(html, data)
            dialog.exec_()

        showHTMLReport("Help",contentHelp)"""
		QDesktopServices.openUrl(QUrl.fromLocalFile(self.pathHelp))
Пример #24
0
	def __Open_Repository_pushButton__clicked(self, checked):
		"""
		This method is triggered when **Open_Repository_pushButton** Widget is clicked.

		:param checked: Checked state. ( Boolean )
		"""

		LOGGER.debug("> Opening url: '{0}'.".format(self.__repositoryUrl))
		QDesktopServices.openUrl(QUrl(QString(self.__repositoryUrl)))
Пример #25
0
	def __Image_label__linkActivated(self, url):
		"""
		Defines the slot triggered by **Image_label** Widget when a link is clicked.

		:param url: Url to explore.
		:type url: QString
		"""

		QDesktopServices.openUrl(QUrl(url))
Пример #26
0
	def __Open_Repository_pushButton__clicked(self, checked):
		"""
		Defines the slot triggered by **Open_Repository_pushButton** Widget when clicked.

		:param checked: Checked state.
		:type checked: bool
		"""

		LOGGER.debug("> Opening url: '{0}'.".format(self.__repositoryUrl))
		QDesktopServices.openUrl(QUrl(QString(self.__repositoryUrl)))
Пример #27
0
def onClick(url):
        String = unicode(url.toString())
	if String.startswith("py:"):
	        String = String[3:]
	        from ui_menu import JxShowIn,JxShowOut
	        from export import JxAddo, JxDoNothing
	        eval(String)
	else:
	        from PyQt4.QtGui import QDesktopServices
	        QDesktopServices.openUrl(QUrl(url))
	def __makeDonationDisplayMiscAction__triggered(self, checked):
		"""
		This method is triggered by **'Actions|Umbra|ToolBar|Miscellaneous|Make A Donation ...'** action.

		:param checked: Checked state. ( Boolean )
		:return: Method success. ( Boolean )
		"""

		LOGGER.debug("> Opening url: '{0}'.".format(UiConstants.makeDonationFile))
		QDesktopServices.openUrl(QUrl(QString(UiConstants.makeDonationFile)))
		return True
Пример #29
0
	def intercept_link(self, url):
		"""Allows to open documents or scrolling to anchors when clicking links"""
		#reenable scrolling to anchor in document
		if url.hasFragment() and url.scheme() == 'about' and url.path() == 'blank':
			self.preview.page().currentFrame().scrollToAnchor(url.fragment())
		elif url.isRelative() and self.queryExit():
			#TODO: less hacky, extensions
			url = KUrl(self.editor.document().url().path() + url.path())
			self.editor.document().openUrl(url)
		else:
			QDesktopServices.openUrl(url)
Пример #30
0
    def run(field, value):
        """
        Run an action with only one value as parameter

        @param field:Type of the action
        @type field:str
        @param value:Value of the field for one entity
        @type value:str
        """

        if value == '':
            iface.messageBar().pushMessage(
                tr("OSMData",
                   u"Sorry man, this field is empty for this entity."),
                level=QgsMessageBar.WARNING, duration=7)
        else:
            field = unicode(field, "UTF-8")
            value = unicode(value, "UTF-8")

            if field in ["url", "website", "wikipedia"]:
                var = QDesktopServices()
                url = None

                if field == "url" or field == "website":
                    url = value

                if field == "ref_UAI":
                    url = "http://www.education.gouv.fr/pid24302/annuaire-" \
                          "resultat-recherche.html?lycee_name=" + value

                if field == "wikipedia":
                    url = "http://en.wikipedia.org/wiki/" + value

                var.openUrl(QUrl(url))

            elif field == "josm":
                import urllib2
                try:
                    url = "http://localhost:8111/load_object?objects=" + value
                    urllib2.urlopen(url).read()
                except urllib2.URLError:
                    iface.messageBar().pushMessage(
                        tr("OSMData",
                           u"The JOSM remote seems to be disabled."),
                        level=QgsMessageBar.CRITICAL,
                        duration=7)

            # NOT USED
            elif field == "rawedit":
                url = QUrl("http://rawedit.openstreetmap.fr/edit/" + value)
                web_browser = QWebView(None)
                web_browser.load(url)
                web_browser.show()
 def gotoLocalServer(self):
     """
     """
     url = QUrl('%s' %
                self.core().settings().config["jenkins-server"]["url"])
     QDesktopServices.openUrl(url)
Пример #32
0
 def open_overpass_turbo():
     """
     Open Overpass Turbo
     """
     desktop_service = QDesktopServices()
     desktop_service.openUrl(QUrl("http://overpass-turbo.eu/"))
Пример #33
0
 def on_docPushButton_clicked(self):
     #print "docPushButton pressed"
     QDesktopServices.openUrl(QUrl(QString("http://www.urbansim.org/docs/opus-userguide/")))
Пример #34
0
 def openDebugLogTriggered(self):
     debugLogPath = op.join(self.app.appdata, 'debug.log')
     url = QUrl.fromLocalFile(debugLogPath)
     QDesktopServices.openUrl(url)
Пример #35
0
def runImport(modelManager, importSettings):
    progress = ProgressTracker(os.path.join(mw.pluginsFolder(), "iknow-smartfm-log.txt"))
    try:
        importSettings.saveToConfig()
        iknow = SmartFMAPI()
        iknowList = iknow.list(importSettings.listId)
        try:
            if iknowList.language and iknowList.language == "ja":
                modelManager.tagModelsAsJapanese()
        except:
            progress.logMsg("Error trying to tag models as Japanese")
            progress.logMsg(traceback.format_exc())
            pass
        iknow.setCallback(progress.downloadCallback)
        items = iknow.listItems(importSettings.listId, (importSettings.importVocab or importSettings.includeItemMeaning), importSettings.importSentences)
        progress.preImportResetProgress(len(items))
        totalImported = 0
        totalDup = 0
        totalFormattingErrors = 0
        totalImportedByType = {"item" : 0, "sentence" : 0}
        for i, item in enumerate(items):
            if importSettings.maxItems > 0 and totalImported >= importSettings.maxItems:
                break
            if not importSettings.importSentences and item.type == "sentence":
                continue
            if not importSettings.importVocab and item.type == "item":
                continue
            if formatIknowItemPreImport(item, iknowList, importSettings, iknowList.isBilingual(), progress):
                progress.importCallback(i, item.expression)
                if importIknowItem(item, modelManager.sentenceModel, modelManager.vocabModel, importSettings, progress):
                    totalImported += 1
                    totalImportedByType[item.type] = totalImportedByType[item.type] + 1
                else:
                    totalDup += 1
            else:
                totalFormattingErrors += 1
        progress.dialog.cancel()
        progress.close()
        mw.deck.save()
        resultStr = "Import complete. Imported %s items, %s sentences, and skipped %s duplicates." % (totalImportedByType["item"], totalImportedByType["sentence"], totalDup)
        if totalFormattingErrors > 0:
            resultStr += " %s items were skipped because there was no translation available on smart.fm." % totalFormattingErrors
        QMessageBox.information(mw, "Summary", resultStr)
        mw.reset(mw.mainWin)
    except AudioDownloadError:
        progress.logMsg(traceback.format_exc())
        progress.dialog.cancel()
        progress.close()
        QMessageBox.warning(mw, "Warning", "Data for one item could not be retrieved even after several retries. This may be caused by a slower internet connection or smart.fm's (occasionally slow) servers. Please try your import again.")
        mw.reset(mw.mainWin)
    except AddMediaException:
        progress.logMsg(traceback.format_exc())
        progress.dialog.cancel()
        progress.close()
        QMessageBox.warning(mw, "Warning", "Anki was unable to add an audio file to your deck. This may be caused by a problem with Anki, the smart.fm! plugin, or both. Please inform the plugin developer.")
        mw.reset(mw.mainWin)
    except SmartFMDownloadError:
        progress.logMsg(traceback.format_exc())
        progress.dialog.cancel()
        progress.close()
        QMessageBox.warning(mw,"Warning","There was a problem retrieving data from Smart.fm. When you hit 'OK', a browser window will open to check that you can reach smart.fm.<br /><br />If this browser window shows an error, then please wait for smart.fm to be fixed, and try importing cards again. If there is no error in the browser window and you see some content relevant to your study list, please notify the plugin developer at http://github.com/ridisculous/anki-iknow-importer/issues")
        try:
            QDesktopServices.openUrl(QUrl(iknow.lastUrlFetched))
        except:
            pass
        mw.reset(mw.mainWin)
    except:
        progress.logMsg(traceback.format_exc())
        progress.dialog.cancel()
        progress.close()
        QMessageBox.warning(mw, "Warning", "There was an unknown error importing items. Please contact the plugin developer at http://github.com/ridisculous/anki-iknow-importer/issues<br /><br />Please be sure to include the file 'iknow-smartfm-log.txt' from your plugins directory with a description of what you tried to do before this error.")
        mw.reset(mw.mainWin)
Пример #36
0
 def openCacheDir(self):
     cache_dir = unicode(self.settings.cacheDirPath.text())
     if path.exists(cache_dir):
         QDesktopServices.openUrl(QUrl("file://%s" % cache_dir, QUrl.TolerantMode))
Пример #37
0
 def openURL(self, url):
     """start konqueror"""
     #need to run this else kdesu can't run Konqueror
     #subprocess.call(['su', 'ubuntu', 'xhost', '+localhost'])
     QDesktopServices.openUrl(QUrl(url))
Пример #38
0
 def openformfolder(self, url):
     QDesktopServices.openUrl(QUrl.fromLocalFile(self.form.folder))
    def saveProfile(self):
        """
        Write our file to nice outputs on the hard drive
        :param event:
        :return:
        """

        if len(self.treeFields.selectedIndexes()) == 0:
            self.treeFields.selectAll()

        cols = [
            str(idx.data(0, Qt.DisplayRole))
            for idx in self.treeFields.selectedItems()
        ]

        # Now write to CSV
        try:
            selectedLayer = self.cmbLayer.itemData(
                self.cmbLayer.currentIndex())
            rootdir = QtGui.QFileDialog.getExistingDirectory(
                self, "Specify output folder", "",
                QtGui.QFileDialog.ShowDirsOnly
                | QtGui.QFileDialog.DontResolveSymlinks)

            if rootdir == "" or not os.path.isdir(rootdir):
                return

            # - Details about when this was run. Inputs and outputs
            # - Details about the traversal.
            foldername = "Profile-{}-{}to{}".format(selectedLayer.name(),
                                                    self.appFromID,
                                                    self.appToID)
            outputdir = os.path.join(rootdir, foldername)
            csvpath = os.path.join(outputdir, "profile.csv")
            logpath = os.path.join(outputdir, "profile.log")
            plotspath = os.path.join(outputdir, "plots")

            # The plotspath is the deepest so it's the only mkdir I need to call for now
            if not os.path.isdir(plotspath):
                os.makedirs(plotspath)

            self.theProfile.generateCSV(cols)

            with open(csvpath, 'wb') as f:

                writer = csv.DictWriter(f, self.theProfile.csvkeys)
                writer.writeheader()
                writer.writerows(self.theProfile.results)

            debugPrint("Done Writing CSV")

            plots = Plots(self.theProfile, plotspath)
            plots.createPlots()

            # Write a file with some information about what just happened
            with open(logpath, 'w') as f:
                f.write(
                    "Inputs:\n==========================================\n\n")
                f.write(" DateTime: {}\n".format(
                    datetime.now().replace(microsecond=0).isoformat()))
                f.write("LayerName: {}\n".format(selectedLayer.name()))
                f.write("   FromID: {}\n".format(self.appFromID))
                f.write("     ToID: {}\n".format(self.appToID))
                listsep = "\n     - "
                f.write("   Fields: {}{}\n".format(listsep,
                                                   listsep.join(cols)))

                f.write(
                    "\n\nPath:\n==========================================\n\n"
                )
                f.writelines(self.theProfile.pathmsgs)

                f.write(
                    "\n\nProfile:\n==========================================\n\n"
                )
                f.writelines(self.theProfile.metalogs)

            if self.chkAddToMap.isChecked():
                addToMap(csvpath, selectedLayer)

            okDlg("Completed:",
                  infoText="CSV file written: {}".format(csvpath))

            qurl = QUrl.fromLocalFile(outputdir)
            QDesktopServices.openUrl(qurl)

        except Exception as e:
            traceback.print_exc()
            detailstxt = "LOG:\n=====================\n  {0}\n\nException:\n=====================\n{1}".format(
                "\n  ".join(self.theProfile.metalogs), str(e))
            okDlg("ERROR:",
                  infoText=str(e),
                  detailsTxt=detailstxt,
                  icon=QtGui.QMessageBox.Critical)
Пример #40
0
 def btnUpdateQA_clicked(self):
     path = define.appPath
     path = path + "/Resource/FasDataBlockHelp.html"
     # path = url_fix(path)
     # print path
     QDesktopServices.openUrl(QUrl.fromLocalFile(path))
Пример #41
0
 def open(self, fname):
     QDesktopServices.openUrl(QUrl('file:///' + fname))
Пример #42
0
 def on_webPushButton_clicked(self):
     #print "webPushButton pressed"
     QDesktopServices.openUrl(QUrl(QString("http://www.urbansim.org/")))
Пример #43
0
 def openHelpURL(self, q_string):
     url = QUrl(q_string)
     QDesktopServices.openUrl(url)
Пример #44
0
 def _open_config_folder(self):
     QDesktopServices.openUrl(
         QUrl("file:///" + QDir.toNativeSeparators(cfclient.config_path)))
 def label_clicked(self, link):
     QDesktopServices.openUrl(QUrl(link))
     self.mainwindow.ui.status_bar.removeWidget(self.label)
Пример #46
0
 def show_pos_clicked(self):
     if self.had_fix:
         google_str = self.last_ns + self.make_dd_dddddd(self.last_lat, True) + '+' + self.last_ew + self.make_dd_dddddd(self.last_long, True)
         QDesktopServices.openUrl(QUrl('https://maps.google.com/maps?q=' + google_str))
     else:
         QDesktopServices.openUrl(QUrl('http://www.google.com/moon/')) # :-)
Пример #47
0
 def slot_showWebsite(self):
     QDesktopServices.openUrl(QUrl("http://moddevices.com/"))
Пример #48
0
 def _open_config_folder(self):
     QDesktopServices.openUrl(
         QUrl("file:///" + QDir.toNativeSeparators(sys.path[1])))
Пример #49
0
def showHelp():
    try:
        QDesktopServices.openUrl(QUrl("http://wiki.github.com/ridisculous/anki-iknow-importer"))
    except:
        QMessageBox.information(mw, "Information", "Please see the smart.fm importer wiki at http://wiki.github.com/ridisculous/anki-iknow-importer.")
Пример #50
0
def openfolder(folder):
    """
    Open a folder using the OS
    :param folder: The path to the folder to open.
    """
    QDesktopServices.openUrl(QUrl.fromLocalFile(folder))
Пример #51
0
 def slot_showProject(self):
     QDesktopServices.openUrl(QUrl("https://github.com/moddevices/mod-app"))
Пример #52
0
 def _AH_LogsWindowActionTriggered(self, checked):
     directory = ApplicationData.get('logs')
     makedirs(directory)
     QDesktopServices.openUrl(QUrl.fromLocalFile(directory))
    def onClickRunButton(self):
        fList = self.fileTF.text().split(';')
        if len(fList) == 0:
            QMessageBox.warning(self, self.tr("Error"), self.tr("You must select one or more files to process."))
            return
        for fItem in fList:
            if os.path.exists(fItem) == False:
                QMessageBox.warning(self, self.tr("Error"), self.tr("Selected file does not exist: ")+fItem)
                return

        if self.outfileTF.text() == '': #no output file has been chosen
            if len(fList) == 1: #there is only one file to process, choose name automatically
                if self.resformat == 'linear':
                    self.foutName = fList[0].split('.txt')[0] + self.prm['pref']["general"]["sessSummResFileSuffix"] + ".txt"
                elif self.resformat == 'table':
                    self.foutName = fList[0].split('.csv')[0] + self.prm['pref']["general"]["sessSummResFileSuffix"] + '.csv'
            else: #there is more than one file to be processed, ask user the output file name
                self.onClickChooseOutFileButton()
            #self.outfileTF.setText(self.foutName)
            if len(self.foutName) < 1:
                print('No file was selected for saving the results. Skipping')
                return
        else: #file name has been chosen
            self.foutName = self.outfileTF.text()
                
        if self.processAllBlocksCheckBox.isChecked() == True:
            last = None; block_range = None
        elif self.processLastNBlocksCheckBox.isChecked() == True:
            if int(self.lastNBlocksTF.text()) < 1:
                QMessageBox.warning(self, self.tr("Error"), self.tr("Invalid number of blocks specified."))
                return
            else:   
                last = int(self.lastNBlocksTF.text()); block_range = None
        else:
            if len(self.fromTF.text()) == 0 or len(self.toTF.text()) == 0 or int(self.fromTF.text()) < 1 or int(self.fromTF.text()) > int(self.toTF.text()):
                QMessageBox.warning(self, self.tr("Error"), self.tr("Invalid number of blocks specified."))
                return
            else:
                    last = None; block_range=(int(self.fromTF.text()), int(self.toTF.text()))

        
        if self.resformat == 'linear':
            if self.paradigm == "adaptive":
                processResultsAdaptive(fList, self.foutName, last=last, block_range=block_range)
            elif self.paradigm == "adaptive_interleaved":
                processResultsAdaptiveInterleaved(fList, self.foutName, last=last, block_range=block_range)
            elif self.paradigm == "constantMIntervalsNAlternatives":
                processResultsConstantMIntervalsNAlternatives(fList, self.foutName, last=last, block_range=block_range)
            elif self.paradigm == "multipleConstantsMIntervalsNAlternatives":
                processResultsMultipleConstantsMIntervalsNAlternatives(fList, self.foutName, last=last, block_range=block_range)
            elif self.paradigm == "constant1Interval2Alternatives":
                processResultsConstant1Interval2Alternatives(fList, self.foutName, last=last, block_range=block_range, dprimeCorrection=self.dpCorrCheckBox.isChecked())
            elif self.paradigm == "multipleConstants1Interval2Alternatives":
                processResultsMultipleConstants1Interval2Alternatives(fList, self.foutName, last=last, block_range=block_range, dprimeCorrection=self.dpCorrCheckBox.isChecked())
            elif self.paradigm == "constant1PairSD":
                processResultsConstant1PairSameDifferent(fList, self.foutName, last=last, block_range=block_range, dprimeCorrection=self.dpCorrCheckBox.isChecked())

        elif self.resformat == 'table':
            self.separator = self.csvSeparatorTF.text()
            if self.paradigm == "adaptive":
                procResTableAdaptive(fList, self.foutName, self.separator, last=last, block_range=block_range)
            elif self.paradigm == "adaptive_interleaved":
                procResTableAdaptiveInterleaved(fList, self.foutName, self.separator, last=last, block_range=block_range)
            elif self.paradigm == "constantMIntervalsNAlternatives":
                procResTableConstantMIntNAlt(fList, self.foutName, self.separator, last=last, block_range=block_range)
            elif self.paradigm == "multipleConstantsMIntervalsNAlternatives":
                procResTableMultipleConstantsMIntNAlt(fList, self.foutName, self.separator, last=last, block_range=block_range)
            elif self.paradigm == "constant1Interval2Alternatives":
                procResTableConstant1Int2Alt(fList, self.foutName, self.separator, last=last, block_range=block_range, dprimeCorrection=self.dpCorrCheckBox.isChecked())
            elif self.paradigm == "multipleConstants1Interval2Alternatives":
                procResTableMultipleConstants1Int2Alt(fList, self.foutName, self.separator, last=last, block_range=block_range, dprimeCorrection=self.dpCorrCheckBox.isChecked())
            elif self.paradigm == "constant1PairSD":
                procResTableConstant1PairSameDifferent(fList, self.foutName, self.separator, last=last, block_range=block_range, dprimeCorrection=self.dpCorrCheckBox.isChecked())
            elif self.paradigm == "multipleConstants1PairSD":
                procResTableMultipleConstants1PairSameDifferent(fList, self.foutName, self.separator, last=last, block_range=block_range, dprimeCorrection=self.dpCorrCheckBox.isChecked())
            elif self.paradigm == "multipleConstantsABX":
                procResTableMultipleConstantsABX(fList, self.foutName, self.separator, last=last, block_range=block_range, dprimeCorrection=self.dpCorrCheckBox.isChecked())
            elif self.paradigm == "multipleConstantsOddOneOut":
                procResTableMultipleConstantsOddOneOut(fList, self.foutName, self.separator, last=last, block_range=block_range)


            if self.parent().prm['appData']['plotting_available'] == True and (self.plotCheckBox.isChecked() == True or self.pdfPlotCheckBox.isChecked() == True):
                self.plotResults(self.plotCheckBox.isChecked(), self.pdfPlotCheckBox.isChecked())
          
        if self.openResultsFile.isChecked() == True:
            if self.resformat == 'linear':
                QDesktopServices.openUrl(QtCore.QUrl.fromLocalFile(self.foutName))
            elif self.resformat == 'table':
                QDesktopServices.openUrl(QtCore.QUrl.fromLocalFile(self.foutName))
        if self.openResultsFolder.isChecked() == True:
            QDesktopServices.openUrl(QtCore.QUrl.fromLocalFile(os.path.dirname(self.foutName)))
Пример #54
0
 def on_licensePushButton_clicked(self):
     #print "licensePushButton pressed"
     QDesktopServices.openUrl(QUrl(QString("http://www.gnu.org/copyleft/gpl.html")))
Пример #55
0
 def on_anchor_clicked(self, url):
     QDesktopServices.openUrl(url)
Пример #56
0
 def accept(self):
     text = self.errorTextEdit.toPlainText()
     url = QUrl(
         "mailto:[email protected]?SUBJECT=Error Report&BODY=%s" % text)
     QDesktopServices.openUrl(url)
     QDialog.accept(self)
Пример #57
0
def openfolder(folder):
    QDesktopServices.openUrl(QUrl.fromLocalFile(folder))
Пример #58
0
 def _SH_ScreenshotsFolderActionTriggered(self, pos):
     settings = BlinkSettings()
     QDesktopServices.openUrl(
         QUrl.fromLocalFile(settings.screenshots_directory.normalized))
Пример #59
0
def simple_link_handler(url):
    u"""Play the file."""
    if url.startswith("ankiplay"):
        play(url[8:])
    else:
        QDesktopServices.openUrl(QUrl(url))
Пример #60
0
 def link_clicked(self, link):
     if self.open_link_in_external_browser():
         QDesktopServices.openUrl(link)
     else:
         self.load(link)