Beispiel #1
0
    def show_help(self, page=None):
        '''Menu action to show the user manual. Will start a new zim
		instance showing the notebook with the manual.
		@param page: manual page to show (string)
		'''
        if page:
            ZIM_APPLICATION.run('--manual', page)
        else:
            ZIM_APPLICATION.run('--manual')
Beispiel #2
0
    def open_notebook(self, location, pagename=None):
        '''Open another notebook.
		@param location: notebook location as uri or object with "uri" attribute
		@param pagename: optional page name
		'''
        assert isinstance(location, str) or hasattr(location, 'uri')
        assert pagename is None or isinstance(pagename, str)

        uri = location.uri if hasattr(location, 'uri') else location
        if pagename:
            ZIM_APPLICATION.run('--gui', uri, pagename)
        else:
            ZIM_APPLICATION.run('--gui', uri)
Beispiel #3
0
def set_global_trayicon(classic=False):
    global GLOBAL_TRAYICON

    if appindicator and not classic:
        cls = AppIndicatorTrayIcon
    else:
        cls = StatusIconTrayIcon

    if GLOBAL_TRAYICON and isinstance(GLOBAL_TRAYICON, cls):
        pass
    else:
        new = cls()
        ZIM_APPLICATION.add_window(new)
        if GLOBAL_TRAYICON:
            GLOBAL_TRAYICON.destroy()
        GLOBAL_TRAYICON = new
Beispiel #4
0
    def do_response_ok(self):
        buffer = self.textview.get_buffer()
        start, end = buffer.get_bounds()
        text = start.get_text(end)

        # HACK: change "[]" at start of line into "[ ]" so checkboxes get inserted correctly
        text = re.sub(r'(?m)^(\s*)\[\](\s)', r'\1[ ]\2', text)
        # Specify "(?m)" instead of re.M since "flags" keyword is not
        # supported in python 2.6

        notebook = self._get_notebook()
        if notebook is None:
            return False

        if self.form['new_page']:
            if not self.form.widgets['namespace'].get_input_valid() \
            or not self.form['basename']:
                if not self.form['basename']:
                    entry = self.form.widgets['basename']
                    entry.set_input_valid(False, show_empty_invalid=True)
                return False

            path = self.form['namespace'] + self.form['basename']
            self.create_new_page(notebook, path, text)
        else:
            if not self.form.widgets['page'].get_input_valid() \
            or not self.form['page']:
                return False

            path = self.form['page']
            self.append_to_page(notebook, path, '\n------\n' + text)

        if self.attachments:
            self.import_attachments(notebook, path, self.attachments)

        if self.open_page_check.get_active():
            self.hide()
            ZIM_APPLICATION.present(notebook, path)

        return True
Beispiel #5
0
 def do_quick_note(self):
     '''Show the dialog from the quicknote plugin'''
     ZIM_APPLICATION.run('--plugin', 'quicknote')
Beispiel #6
0
 def do_activate_notebook(self, uri):
     '''Open a specific notebook.'''
     if not isinstance(uri, str):
         uri = uri.uri
     ZIM_APPLICATION.run('--gui', uri)
Beispiel #7
0
 def on_open_help(self, action):
     ''' Context menu: Open help '''
     ZIM_APPLICATION.run('--manual', 'Plugins:Table Editor')
Beispiel #8
0
	def do_activate_notebook(self, uri):
		'''Open a specific notebook.'''
		ZIM_APPLICATION.run('--gui', uri)
	def on_help_button_clicked(self, button):
		klass = self.plugins.get_plugin_class(self._current_plugin)
		page = klass.plugin_info['help']
		if page:
			ZIM_APPLICATION.run('--manual', page)
Beispiel #10
0
    def show_server_gui(self):
        '''Menu action to show the server interface from
		L{zim.gui.server}. Spawns a new zim instance for the server.
		'''
        ZIM_APPLICATION.run('--server', '--gui', self.notebook.uri)
Beispiel #11
0
 def open_page(self, notebook, path):
     ZIM_APPLICATION.run('--gui', notebook.uri, path.name)