Exemplo n.º 1
0
    def browse(self):
        """
		desc:
			Opens the pool folder in the file manager in an OS specific way.
		"""

        misc.open_url(self.experiment.pool.folder())
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
	def browse(self):

		"""
		desc:
			Opens the pool folder in the file manager in an OS specific way.
		"""

		misc.open_url(self.experiment.pool.folder())
Exemplo n.º 4
0
    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()))
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
    def event_after_experiment_open_logfile(self):
        """
		desc:
			Opens the logfile.
		"""

        if self.logfile() is None:
            return
        misc.open_url(self.logfile())
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
	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()))
Exemplo n.º 9
0
	def event_after_experiment_open_logfile(self):

		"""
		desc:
			Opens the logfile.
		"""

		if self.logfile() is None:
			return
		misc.open_url(self.logfile())
Exemplo n.º 10
0
    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)
Exemplo n.º 11
0
	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)
Exemplo n.º 12
0
	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)
Exemplo n.º 13
0
    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])
Exemplo n.º 14
0
	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])
Exemplo n.º 15
0
	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)
Exemplo n.º 16
0
 def _open_folder(self):
     """Opens the folder that contains the image annotations."""
     misc.open_url(self._image_folder)
Exemplo n.º 17
0
 def _open_annotation(self, path):
     """Opens a single annotation image."""
     misc.open_url(path)
Exemplo n.º 18
0
    def open_facebook(self, dummy=None):
        """Open Facebook page"""

        misc.open_url(cfg.url_facebook)
Exemplo n.º 19
0
    def open_website(self, dummy=None):
        """Open the main website"""

        misc.open_url(cfg.url_website)
Exemplo n.º 20
0
    def open_twitter(self, dummy=None):
        """Open Twitter page"""

        misc.open_url(config.get_config("url_twitter"))
Exemplo n.º 21
0
    def open_twitter(self, dummy=None):
        """Open Twitter page"""

        misc.open_url(cfg.url_twitter)
Exemplo n.º 22
0
    def open_website(self, dummy=None):
        """Open the main website"""

        misc.open_url(config.get_config("url_website"))
Exemplo n.º 23
0
    def open_facebook(self, dummy=None):
        """Open Facebook page"""

        misc.open_url(config.get_config("url_facebook"))
Exemplo n.º 24
0
	def open_twitter(self, dummy=None):
	
		"""Open Twitter page"""	
	
		misc.open_url(config.get_config("url_twitter"))
Exemplo n.º 25
0
	def open_facebook(self, dummy=None):
	
		"""Open Facebook page"""	

		misc.open_url(config.get_config("url_facebook"))
Exemplo n.º 26
0
	def open_website(self, dummy=None):
	
		"""Open the main website"""
		
		misc.open_url(config.get_config("url_website"))
Exemplo n.º 27
0
    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)
Exemplo n.º 28
0
	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)