Example #1
0
def testConfiguration():
    """
    Checks, whether configuration can be loaded from PISI core.
    
    If not possible, an error message is printed and False will be returned.
    @return: False, if an Error occurs when loading the configration from core; otherwise True
    """
    try:
        pisi.getConfiguration()
        return True
    except ValueError:
        print ("PISI configuration not found")
        print ("For running PISI you must have a configuration file located in '/home/root/.pisi/conf'.\n\nWith the package a well-documented sample was placed at '/usr/share/doc/pisi/conf.example'. You may rename this for a starting point - then edit this file in order to configure your PIM synchronization data sources.")
        return False
Example #2
0
def testConfiguration():
    """
    Checks, whether configuration can be loaded from PISI core.
    
    If not possible, an error message is visualized in a GTK dialog.
    @return: False, if an Error occurs when loading the configration from core; otherwise True
    """
    try:
        pisi.getConfiguration()
        return True
    except ValueError:
        dialog = gtk.MessageDialog(None, buttons=gtk.BUTTONS_OK,  message_format = "PISI configuration not found",  type = gtk.MESSAGE_ERROR)
        configfile = pisi.getConfigLocation()
        dialog.format_secondary_markup("For running PISI you must have a configuration file located at\n '%s'.\n\nWith the package a well-documented sample was placed at '/usr/share/doc/pisi/conf.example'. You may move this for a starting point - then edit this file in order to configure your PIM synchronization data sources." %(configfile))
        ret = dialog.run()
        dialog.destroy()
        return False
Example #3
0
def list_configurations():
    """
    Prints available configurations for data sources
    
    Parses the configuration file for PISI and prints all available data sources to the console.
    """
    config = pisi.getConfiguration()
    print 'You have these configurations:'
    print '  [1] Contacts sources'
    for con in config.sections():
        if config.get(con,'module').startswith('contacts'):
            print ('\t-%s which uses module <%s>: %s'  %(con, config.get(con,'module'),  config.get(con,'description')))
    print '  [2] Calendar sources'
    for con in config.sections():
        if config.get(con,'module').startswith('calendar'):
            print ('\t-%s which uses module <%s>: %s'  %(con, config.get(con,'module'),  config.get(con,'description')))
    sys.exit(0)
Example #4
0
    def __init__(self):
        """
        Constructor - the whole assembling of the window is performed in here
        """
        pisiprogress.AbstractCallback.__init__(self)
        config = pisi.getConfiguration()
        self.sources = {}
        self.sourcesContacts = []
        self.sourcesCalendar = []
        for con in config.sections():
            self.sources[config.get(con,'description')] = [con, config.get(con,'module') ]
            if config.get(con,'module').startswith('calendar'):
                self.sourcesCalendar.append(config.get(con,'description'))
            elif config.get(con,'module').startswith('contacts'):
                self.sourcesContacts.append(config.get(con,'description'))
        
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("delete_event", self.delete_event)
        self.window.connect("destroy", self.destroy)
        self.window.set_border_width(10)

        box = gtk.VBox(False, 5)
        
        labelTitle= gtk.Label("PISI Synchronization")
        box.pack_start(labelTitle, False, False, 0)
        labelTitle.show()

        contactsPanel = self._createContactsPanel(self.sourcesContacts)
        paddingBox1 = gtk.HBox(False, 5)
        paddingBox1.pack_start(contactsPanel, False, True, 5)
        paddingBox1.show()
        calendarPanel = self._createCalendarPanel(self.sourcesCalendar)
        paddingBox2 = gtk.HBox(False, 5)
        paddingBox2.pack_start(calendarPanel, False, True, 5)
        paddingBox2.show()
        self.notebook = gtk.Notebook()
        self.notebook.append_page(paddingBox1, gtk.Label('Contacts'))
        self.notebook.append_page(paddingBox2, gtk.Label('Calendar'))
        self.notebook.show()

        box.pack_start(self.notebook, False, True, 5)

        separator = gtk.HSeparator()
        box.pack_start(separator, False, True, 5)
        separator.show()
        
        labelProgress = gtk.Label("Progress")
        labelProgress.set_alignment(0, 0)
        box.pack_start(labelProgress, False, False, 0)
        labelProgress.show()
        self.progressbar = gtk.ProgressBar(adjustment=None)
        self.progressbar.set_text("idle")
        self.progressbar.set_fraction(0)
        box.pack_start(self.progressbar, False, False, 0)
        self.progressbar.show()

        separator = gtk.HSeparator()
        box.pack_start(separator, False, True, 5)
        separator.show()

        boxButtons = gtk.HBox(False, 5)
        bAbout = gtk.Button('About')
        bAbout.connect('clicked', self.showAbout)
        boxButtons.pack_start(bAbout,  True,  False,  0)
        bAbout.show()

        bStart = gtk.Button('Start')
        bStart.connect('clicked', self.startSync)
        boxButtons.pack_start(bStart,  True,  False,  0)
        bStart.show()

        bQuit = gtk.Button('Quit')
        bQuit.connect_object("clicked", gtk.Widget.destroy, self.window)
        boxButtons.pack_start(bQuit,  True,  False,  0)
        bQuit.show()

        boxButtons.show()
        box.pack_start(boxButtons,  False,  False, 0)

        box.show()
        self.window.add(box)
        self.window.show()