Ejemplo n.º 1
0
    def initialize(self):
        if not IP.initialize(self):
            return False
        self.edit = False
        self.tempfiles = TempFileCleanup()

        # try requests cache if available
        try:
            import requests_cache
            requests_cache.install_cache('kodi_cache')
        except:
            pass

        return True
Ejemplo n.º 2
0
    def initialize(self):
        if not IP.initialize(self):
            return False
        # glade
        gf = os.path.join(self.locations['glade'], 'importcsv.glade')
        # try to open the glade file
        try:
            self.gtk = gtk.glade.XML(gf)
        except:
            log.info("Glade-file %s can not be loaded.", gf)
            return False
        # open gtk window
        self.gtk.get_widget('d_import').set_transient_for(self.widgets['window'])

        # simple string lists
        self.tv_csv = self.gtk.get_widget('tv_csv')
        self.tv_assigned = self.gtk.get_widget('tv_assigned')
        self.tv_griffith = self.gtk.get_widget('tv_griffith')

        # 1st list
        self.ls_csv = gtk.ListStore(str)
        self.tv_csv.set_model(self.ls_csv)
        renderer = gtk.CellRendererText()
        column = gtk.TreeViewColumn("none", renderer, text=0)
        self.tv_csv.append_column(column)

        # 2nd list
        self.ls_griffith = gtk.ListStore(str, str)
        self.tv_griffith.set_model(self.ls_griffith)
        renderer = gtk.CellRendererText()
        column = gtk.TreeViewColumn("none", renderer, text=0)
        column.set_visible(False)
        self.tv_griffith.append_column(column)
        column = gtk.TreeViewColumn("none", renderer, text=1)
        self.tv_griffith.append_column(column)
        self.set_griffith_fields()

        # 3rd list
        self.ls_assigned = gtk.ListStore(str, str, str)
        self.tv_assigned.set_model(self.ls_assigned)
        renderer = gtk.CellRendererText()
        column = gtk.TreeViewColumn("none", renderer, text=0)
        self.tv_assigned.append_column(column)
        # add the columns for internal information handling and hide them
        column = gtk.TreeViewColumn("none", renderer, text=1)
        column.set_visible(False)
        self.tv_assigned.append_column(column)
        column = gtk.TreeViewColumn("none", renderer, text=2)
        column.set_visible(False)
        self.tv_assigned.append_column(column)

        # hide tabs
        self.nb_pages = self.gtk.get_widget('nb_pages')
        self.nb_pages.get_nth_page(1).hide()
        self.nb_pages.connect("switch-page", self._on_page_changed)

        # Events
        # Buttons
        self.b_cancel = self.gtk.get_widget("b_cancel")
        self.b_cancel.connect("clicked", self._clicked)

        self.b_next = self.gtk.get_widget("b_next")
        self.b_next.connect("clicked", self._clicked)

        self.b_back = self.gtk.get_widget("b_back")
        self.b_back.connect("clicked", self._clicked)

        self.b_add = self.gtk.get_widget("b_add")
        self.b_add.connect("clicked", self._clicked)

        self.b_del = self.gtk.get_widget("b_del")
        self.b_del.connect("clicked", self._clicked)

        # Treeviews
        self.tv_griffith.connect("row_activated", self._on_row_activated)
        self.tv_griffith.connect("cursor_changed", self._on_cursor_changed)
        self.tv_csv.connect("row_activated", self._on_row_activated)
        self.tv_csv.connect("cursor_changed", self._on_cursor_changed)
        self.tv_assigned.connect("cursor_changed", self._on_cursor_changed)

        self.gtk.get_widget('e_lineterminator').set_active(0)

        self.selected_griffith = None
        self.selected_csv = None
        self.current_csv_row = 0
        self.csv_header = None
        return True
Ejemplo n.º 3
0
 def initialize(self):
     if not IP.initialize(self):
         return False
     self.edit = False
     return True
Ejemplo n.º 4
0
 def initialize(self):
     if not IP.initialize(self):
         return False
     self.edit = False
     return True
Ejemplo n.º 5
0
    def initialize(self):
        if not IP.initialize(self):
            return False
        # glade
        gf = os.path.join(self.locations['glade'], 'importcsv.glade')
        # try to open the glade file
        try:
            self.gtk = gtk.glade.XML(gf)
        except:
            log.info("Glade-file %s can not be loaded.", gf)
            return False
        # open gtk window
        self.gtk.get_widget('d_import').set_transient_for(
            self.widgets['window'])

        # simple string lists
        self.tv_csv = self.gtk.get_widget('tv_csv')
        self.tv_assigned = self.gtk.get_widget('tv_assigned')
        self.tv_griffith = self.gtk.get_widget('tv_griffith')

        # 1st list
        self.ls_csv = gtk.ListStore(str)
        self.tv_csv.set_model(self.ls_csv)
        renderer = gtk.CellRendererText()
        column = gtk.TreeViewColumn("none", renderer, text=0)
        self.tv_csv.append_column(column)

        # 2nd list
        self.ls_griffith = gtk.ListStore(str, str)
        self.tv_griffith.set_model(self.ls_griffith)
        renderer = gtk.CellRendererText()
        column = gtk.TreeViewColumn("none", renderer, text=0)
        column.set_visible(False)
        self.tv_griffith.append_column(column)
        column = gtk.TreeViewColumn("none", renderer, text=1)
        self.tv_griffith.append_column(column)
        self.set_griffith_fields()

        # 3rd list
        self.ls_assigned = gtk.ListStore(str, str, str)
        self.tv_assigned.set_model(self.ls_assigned)
        renderer = gtk.CellRendererText()
        column = gtk.TreeViewColumn("none", renderer, text=0)
        self.tv_assigned.append_column(column)
        # add the columns for internal information handling and hide them
        column = gtk.TreeViewColumn("none", renderer, text=1)
        column.set_visible(False)
        self.tv_assigned.append_column(column)
        column = gtk.TreeViewColumn("none", renderer, text=2)
        column.set_visible(False)
        self.tv_assigned.append_column(column)

        # hide tabs
        self.nb_pages = self.gtk.get_widget('nb_pages')
        self.nb_pages.get_nth_page(1).hide()
        self.nb_pages.connect("switch-page", self._on_page_changed)

        # Events
        # Buttons
        self.b_cancel = self.gtk.get_widget("b_cancel")
        self.b_cancel.connect("clicked", self._clicked)

        self.b_next = self.gtk.get_widget("b_next")
        self.b_next.connect("clicked", self._clicked)

        self.b_back = self.gtk.get_widget("b_back")
        self.b_back.connect("clicked", self._clicked)

        self.b_add = self.gtk.get_widget("b_add")
        self.b_add.connect("clicked", self._clicked)

        self.b_del = self.gtk.get_widget("b_del")
        self.b_del.connect("clicked", self._clicked)

        # Treeviews
        self.tv_griffith.connect("row_activated", self._on_row_activated)
        self.tv_griffith.connect("cursor_changed", self._on_cursor_changed)
        self.tv_csv.connect("row_activated", self._on_row_activated)
        self.tv_csv.connect("cursor_changed", self._on_cursor_changed)
        self.tv_assigned.connect("cursor_changed", self._on_cursor_changed)

        self.gtk.get_widget('e_lineterminator').set_active(0)

        self.selected_griffith = None
        self.selected_csv = None
        self.current_csv_row = 0
        self.csv_header = None
        return True