Example #1
0
    def update(self):
        self._groups = edje.file_collection_list(self.file)
        if self._groups:
            self._groups.sort(key=str.lower)

        self.clear()
        if not self._groups:
            self._selection = ""
            return
        self._groups_items = {}

        for group in self._groups:
            item = self.item_append(group, None, None, self._select, group)
            self._groups_items[group] = item

        # TODO: make a way to let items highlighted but not actually
        # select()-ed, in the sense of selection callbacks

        # item = self._groups_items.get(self._selection)
        # if item:
        #     item.selected_set(True)
        # else:
        #     self._groups_items[self._groups[0]].selected_set(True)

        self.go()
Example #2
0
    def group_del(self, grp_name):
        dummy_grp = None
        all_grps = edje.file_collection_list(self._swapfile.workfile)
        for g in all_grps:
            if g != grp_name:
                dummy_grp = g
                break

        if not dummy_grp:
            self.error = "Can not delete the only group in file"
            return False

        if not self.__edje or self._group == grp_name:
            self.group = ""

            dummy_edje = EdjeEdit(
                self._canvas, file=self._swapfile.workfile, group=dummy_grp)
            r = dummy_edje.group_del(grp_name)
            self.error = dummy_edje.error
            dummy_edje.delete()

            return r

        r = self.__edje.group_del(grp_name)
        self.error = self.__edje.error
        return r
Example #3
0
    def group_del(self, grp_name):
        dummy_grp = None
        all_grps = edje.file_collection_list(self._swapfile.workfile)
        for g in all_grps:
            if g != grp_name:
                dummy_grp = g
                break

        if not dummy_grp:
            self.error = "Can not delete the only group in file"
            return False

        if not self.__edje or self._group == grp_name:
            self.group = ""

            dummy_edje = EdjeEdit(self._canvas,
                                  file=self._swapfile.workfile,
                                  group=dummy_grp)
            r = dummy_edje.group_del(grp_name)
            self.error = dummy_edje.error
            dummy_edje.delete()

            return r

        r = self.__edje.group_del(grp_name)
        self.error = self.__edje.error
        return r
Example #4
0
    def update(self):
        self._groups = edje.file_collection_list(self.file)
        if self._groups:
            self._groups.sort(key=str.lower)

        self.clear()
        if not self._groups:
            self._selection = ""
            return
        self._groups_items = {}

        for group in self._groups:
            item = self.item_append(group, None, None, self._select, group)
            self._groups_items[group] = item

        # TODO: make a way to let items highlighted but not actually
        # select()-ed, in the sense of selection callbacks

        # item = self._groups_items.get(self._selection)
        # if item:
        #     item.selected_set(True)
        # else:
        #     self._groups_items[self._groups[0]].selected_set(True)

        self.go()
Example #5
0
    def group_exists(self, grp_name):
        if not self.__edje:
            self.__edje = EdjeEdit(
                self._canvas, file=self._swapfile.workfile,
                group=edje.file_collection_list(self._swapfile.workfile)[0])
            self.event_emit("group.changed", self.group)

        return self.__edje.group_exist(grp_name)
Example #6
0
    def group_exists(self, grp_name):
        if not self.__edje:
            self.__edje = EdjeEdit(self._canvas,
                                   file=self._swapfile.workfile,
                                   group=edje.file_collection_list(
                                       self._swapfile.workfile)[0])
            self.event_emit("group.changed", self.group)

        return self.__edje.group_exist(grp_name)
Example #7
0
    def test_group_add(self):
        self.assertTrue(self.edj.group_add("new"))
        self.assertFalse(self.edj.group_add("main"))
        self.assertFalse(self.edj.group_add("g1"))
        self.assertFalse(self.edj.group_add("new"))
        new = edje.edit.EdjeEdit(self.canvas.evas, file="test.edj", group="new")
        new.save()
	new.delete()
        self.assertTrue("new" in edje.file_collection_list("test.edj"))
        self.assertTrue(self.edj.group_add("new2"))
        self.assertTrue(self.edj.group_add(""))
Example #8
0
 def export_get_groups(self):
     return edje.file_collection_list(self._edit_grp.workfile)
Example #9
0
 def test_rename(self):
     self.assertFalse(self.group.rename("g1"))
     self.assertTrue(self.group.rename("main"))
     self.assertTrue(self.group.rename("gNewName"))
     self.edj.save()
     self.assertTrue("gNewName" in edje.file_collection_list("test.edj"))
Example #10
0
 def _groups_get(self):
     return edje.file_collection_list(self._swapfile.workfile)
Example #11
0
 def _groups_get(self):
     return edje.file_collection_list(self._swapfile.workfile)
Example #12
0
 def export_get_groups(self):
     return edje.file_collection_list(self._edit_grp.workfile)
Example #13
0
 def test_rename(self):
     self.assertFalse(self.group.rename("g1"))
     self.assertTrue(self.group.rename("main"))
     self.assertTrue(self.group.rename("gNewName"))
     self.edj.save()
     self.assertTrue("gNewName" in edje.file_collection_list("test.edj"))