def browse(self): """ desc: Opens the pool folder in the file manager in an OS specific way. """ misc.open_url(self.experiment.pool.folder())
def _export_html(self): path, ipynb_path = self._export(dialog_title=_(u'Export to HTML'), dialog_filter=u'html (*.html)', ext='.html') if path is None: return html_path = self._to_html(ipynb_path) misc.open_url(html_path)
def event_after_experiment_open_logfile_folder(self): """ desc: Opens the logfile folder. """ if self.logfile() is None: return misc.open_url(os.path.dirname(self.logfile()))
def open_file(self, path): """ Open a file in a platform specific way Arguments: path -- the full path to the file to be opened """ misc.open_url(path)
def event_after_experiment_open_logfile(self): """ desc: Opens the logfile. """ if self.logfile() is None: return misc.open_url(self.logfile())
def _export_docx(self): path, ipynb_path = self._export(dialog_title=_(u'Export to .docx'), dialog_filter=u'docx (*.docx)', ext='.docx') if path is None: return html_path = self._to_html(ipynb_path) self._run('pandoc "{}" -o "{}"'.format(html_path, path)) misc.open_url(path)
def activate(self): """ desc: Opens the autosave folder. """ if os.name == u"nt": os.startfile(self.autosave_folder) elif os.name == u"posix": misc.open_url(self.autosave_folder)
def open_file(self, path): """ desc: Opens a file in a platform specific way. arguments: path: desc: The file to be opened. type: [unicode, str] """ misc.open_url(self.pool[path])
def browse(self): """Open the pool folder in the file manager in an OS specific way""" misc.open_url(self.main_window.experiment.pool_folder)
def _open_folder(self): """Opens the folder that contains the image annotations.""" misc.open_url(self._image_folder)
def _open_annotation(self, path): """Opens a single annotation image.""" misc.open_url(path)
def open_facebook(self, dummy=None): """Open Facebook page""" misc.open_url(cfg.url_facebook)
def open_website(self, dummy=None): """Open the main website""" misc.open_url(cfg.url_website)
def open_twitter(self, dummy=None): """Open Twitter page""" misc.open_url(config.get_config("url_twitter"))
def open_twitter(self, dummy=None): """Open Twitter page""" misc.open_url(cfg.url_twitter)
def open_website(self, dummy=None): """Open the main website""" misc.open_url(config.get_config("url_website"))
def open_facebook(self, dummy=None): """Open Facebook page""" misc.open_url(config.get_config("url_facebook"))
def acceptNavigationRequest(self, *args): """ desc: Handles navigation requests to the browser, which can originate from link clicks, or other sources. the arguments and their order differ with the web browser backend being used, which can be QtWebKit or the newer QtWebEngine. Arguments (when used by QtWebKit): frame: desc: The frame that has to be changed depending on the request type: QtWebKit.QWebFrame request: desc: request containing information about the navigation request, among which the url to change the frame to. type: QtWebKit.QNetworkRequest navtype: desc: type of request has been received (such as link clicked, form submitted) type: QtWebKit.NavigationType Arguments (when used by QtWebEngine): url: desc: url to navigate to type: QtCore.QUrl navtype: desc: type of request has been received (such as link clicked, form submitted) type: QtWebEngine.NavigationType isMainFrame: desc: indicating whether the request corresponds to the main frame or a child frame. type: boolean """ # Check if the first argument is a QUrl. If so, then # QWebEngine is used, if not, then QWebKit must be used. This way, the order # of received arguments can be determined. if isinstance(args[0], QtCore.QUrl): url, navtype, isMainFrame = args else: frame, request, navtype = args url = request.url() if navtype == self.NavigationTypeLinkClicked: url = url.toString() if url.startswith(u'opensesame://'): self.parent().command(url) return False if url.startswith(u'new:'): self.parent().main_window.tabwidget.open_browser(url[4:]) return False for internal_url in INTERNAL_URLS: if url.startswith(internal_url): self.parent().load(url) return False misc.open_url(url) return False return super(small_webpage, self).acceptNavigationRequest(*args)