Beispiel #1
0
    def on_edit(self, action):
        '''
        Open the template file in an editor
        '''
        edit_title = action.get_name()
        title = edit_title[4:]

        if title == 'Weekday':
            date = self.main_window.journal.date
            week_day_number = date.weekday() + 1
            title = str(week_day_number)

        filename = self.titles_to_files.get(title)
        filesystem.open_url(filename)
Beispiel #2
0
 def on_navigate(self, webview, frame, request):
     '''
     We want to load files and links externally
     '''
     if self.loading_html:
         # Keep processing
         return False
         
     uri = request.get_uri()
     logging.info('Clicked URI "%s"' % uri)
     filesystem.open_url(uri)
     
     # Stop processing that event
     return True
Beispiel #3
0
    def on_navigate(self, webview, frame, request):
        '''
        We want to load files and links externally
        '''
        if self.loading_html:
            # Keep processing
            return False

        uri = request.get_uri()
        logging.info('Clicked URI "%s"' % uri)
        filesystem.open_url(uri)

        # Stop processing that event
        return True
Beispiel #4
0
    def on_edit(self, action):
        '''
        Open the template file in an editor
        '''
        edit_title = action.get_name()
        title = edit_title[4:]

        if title == 'Weekday':
            date = self.main_window.journal.date
            week_day_number = date.weekday() + 1
            title = str(week_day_number)

        filename = self.titles_to_files.get(title)
        filesystem.open_url(filename)
Beispiel #5
0
    def on_browser_decide_policy(self, webview, decision, decision_type):
        '''
        We want to load files and links externally.
        '''
        if decision_type == browser.WebKit2.PolicyDecisionType.NAVIGATION_ACTION:
            action = decision.get_navigation_action()
            if action.is_user_gesture():
                uri = action.get_request().get_uri()
                logging.info('Clicked URI "%s"' % uri)
                filesystem.open_url(uri)

                decision.ignore()

        # Stop processing this event.
        return True
Beispiel #6
0
    def on_browser_decide_policy(self, webview, decision, decision_type):
        '''
        We want to load files and links externally.
        '''
        if decision_type == browser.WebKit2.PolicyDecisionType.NAVIGATION_ACTION:
            action = decision.get_navigation_action()
            if action.is_user_gesture():
                uri = action.get_request().get_uri()
                logging.info('Clicked URI "%s"' % uri)
                filesystem.open_url(uri)

                decision.ignore()

        # Stop processing this event.
        return True
Beispiel #7
0
	def on_new_template(self, action):
		dialog = gtk.Dialog(_('Choose Template Name'))
		dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
		dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
		
		entry = gtk.Entry()
		entry.set_size_request(300, -1)
		dialog.get_content_area().pack_start(entry)
		dialog.show_all()
		response = dialog.run()
		dialog.hide()		
		
		if response == gtk.RESPONSE_OK:
			title = entry.get_text()
			if not title.lower().endswith('.txt'):
				title += '.txt'
			filename = os.path.join(self.dirs.template_dir, title)
			
			filesystem.make_file(filename, example_text)
			
			filesystem.open_url(filename)
Beispiel #8
0
    def on_new_template(self, action):
        dialog = gtk.Dialog(_('Choose Template Name'))
        dialog.set_transient_for(self.main_window.main_frame)
        dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
        dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)

        entry = gtk.Entry()
        entry.set_size_request(300, -1)
        dialog.get_content_area().pack_start(entry)
        dialog.show_all()
        response = dialog.run()
        dialog.hide()

        if response == gtk.RESPONSE_OK:
            title = entry.get_text()
            if not title.lower().endswith('.txt'):
                title += '.txt'
            filename = os.path.join(self.dirs.template_dir, title)

            filesystem.make_file(filename, example_text)

            filesystem.open_url(filename)
Beispiel #9
0
 def on_open_template_dir(self):
     filesystem.open_url(self.dirs.template_dir)
Beispiel #10
0
 def _on_child_activated(self, textview, child):
     if isinstance(child, RichTextImage):
         filesystem.open_url(child.get_filename())
Beispiel #11
0
    def _on_visit_url(self, textview, url):
        logging.info('clicked %s' % url)

        filesystem.open_url(url)
Beispiel #12
0
 def _on_child_activated(self, textview, child):
     if isinstance(child, RichTextImage):
         filesystem.open_url(child.get_filename())
Beispiel #13
0
    def _on_visit_url(self, textview, url):
        logging.info('clicked %s' % url)

        filesystem.open_url(url)
Beispiel #14
0
 def on_open_template_dir(self):
     filesystem.open_url(self.dirs.template_dir)