Exemplo n.º 1
0
    def MyInsertItem(self, root, basename):
        """ Insert plug-in in list
		"""

        ### absolute name
        ext = 'py'
        absname = os.path.join(root, "%s.%s" % (basename, ext))

        ### try for pyc if py not exists
        if not os.path.exists(absname):
            ext = 'pyc'
            absname = os.path.join(root, "%s.%s" % (basename, ext))

        if os.path.exists(absname):
            ### file size
            size = FormatSizeFile(os.path.getsize(absname))

            ### date manager
            date = datetime.datetime.fromtimestamp(os.path.getmtime(absname))
            if hasattr(self.mainW, 'language') and self.mainW.language == 'fr':
                date = date.strftime("%d/%m/%y")
            else:
                date = str(date.date())

            # add to the CheckListCtrl
            index = self.InsertItem(100000000, basename)
            self.SetItem(index, 1, size)
            self.SetItem(index, 2, date)
            self.SetItem(index, 3, ext)

            return index
        else:
            sys.stderr.write(
                _("The format of the Plugin file is not .py or .pyc!"))
            return None
Exemplo n.º 2
0
    def InsertItem(self, root, basename):
        """ Insert plug-in in list
		"""

        ### absolute name
        absname = os.path.join(root, "%s.py" % basename)

        ### file size
        size = FormatSizeFile(os.path.getsize(absname))

        ### date manager
        date = datetime.datetime.fromtimestamp(os.path.getmtime(absname))
        if hasattr(self.mainW, 'language') and self.mainW.language == 'fr':
            date = date.strftime("%d/%m/%y")
        else:
            date = str(date.date())

        # add to the CheckListCtrl
        index = self.InsertStringItem(sys.maxint, basename)
        self.SetStringItem(index, 1, size)
        self.SetStringItem(index, 2, date)

        return index