Esempio n. 1
0
    def myfun3(self, dirp, lock):
        import fnmatch, time

        index_count = 0
        lock.acquire()
        self.parent.parent.file_list = []
        self.parent.parent.file_size = []

        for root, dirs, files in os.walk(dirp):
            for filename in files:
                if fnmatch.fnmatch(filename, self.extension[0]):
                    sfilename = os.path.join(root, filename)
                    filesize = os.path.getsize(sfilename)
                    self.parent.parent.file_list.append(sfilename)
                    self.parent.parent.file_size.append(filesize)
                    self.parent.parent.file_line.append(
                        pub_editorviewer.create_publisher_editor_viewer_row(
                            self.parent.parent,
                            index=index_count,
                            size=filesize,
                            status_flg=1,
                            filename=sfilename))
                    index_count += 1

                    time.sleep(
                        0.1
                    )  # Must wait for the row to be generated before moving on.

                if self.stop_listing_flg == 1 and index_count > 0:
                    pub_busy.busyEnd(self.parent.parent)
                    self.parent.parent.pub_editorviewer.sf.configure(
                        hscrollmode='dynamic')
                    self.parent.parent.pub_editorviewer.sf.configure(
                        vscrollmode='dynamic')
                    self.parent.parent.file_counter = index_count
                    time.sleep(
                        0.1
                    )  # Must wait for the row to be generated before moving on.
                    self.parent.parent.log_output_window.appendtext(
                        "File list creation stopped. %s files in list.\n" %
                        index_count)
                    self.generating_file_list_flg = 0
                    thread.exit()
        lock.release()

        self.parent.parent.file_counter = index_count

        pub_busy.busyEnd(self.parent.parent)

        if index_count > 0:
            self.parent.parent.pub_editorviewer.sf.configure(
                hscrollmode='dynamic')
            self.parent.parent.pub_editorviewer.sf.configure(
                vscrollmode='dynamic')

        self.parent.parent.log_output_window.appendtext(
            "Finished creating the file list. %s files in list.\n" %
            index_count)
        self.generating_file_list_flg = 0
Esempio n. 2
0
    def open_text_file(self, dirfilename, lock):
        import time
        import gc

        index_count = 0
        lock.acquire()

        f = open(dirfilename, 'r')
        self.parent.parent.file_list = []
        self.parent.parent.file_size = []
        for dirfile in f:
            sfilename = dirfile[:-1]
            filesize = os.path.getsize(sfilename)
            self.parent.parent.file_list.append(sfilename)
            self.parent.parent.file_size.append(filesize)
            self.parent.parent.file_line.append(
                pub_editorviewer.create_publisher_editor_viewer_row(
                    self.parent.parent,
                    index=index_count,
                    size=filesize,
                    status_flg=0,
                    filename=sfilename))
            index_count += 1

            time.sleep(
                0.1)  # Must wait for the row to be generated before moving on.

            if self.stop_listing_flg == 1:
                pub_busy.busyEnd(self.parent.parent)
                self.parent.parent.pub_editorviewer.sf.configure(
                    hscrollmode='dynamic')
                self.parent.parent.pub_editorviewer.sf.configure(
                    vscrollmode='dynamic')
                self.parent.parent.file_counter = index_count
                time.sleep(
                    0.1
                )  # Must wait for the row to be generated before moving on.
                self.parent.parent.log_output_window.appendtext(
                    "File list creation stopped. %s files in list.\n" %
                    index_count)
                self.generating_file_list_flg = 0
                thread.exit()

        f.close()

        lock.release()

        self.parent.parent.file_counter = index_count

        pub_busy.busyEnd(self.parent.parent)
        self.parent.parent.pub_editorviewer.sf.configure(hscrollmode='dynamic')
        self.parent.parent.pub_editorviewer.sf.configure(vscrollmode='dynamic')

        self.parent.parent.log_output_window.appendtext(
            "Finished creating the file list. %s files in list.\n" %
            index_count)
        self.generating_file_list_flg = 0
    def open_text_file(self, dirfilename, lock):
        import time
        import gc

        index_count = 0
        lock.acquire()

        f = open(dirfilename, "r")
        self.parent.parent.file_list = []
        self.parent.parent.file_size = []
        for dirfile in f:
            sfilename = dirfile[:-1]
            filesize = os.path.getsize(sfilename)
            self.parent.parent.file_list.append(sfilename)
            self.parent.parent.file_size.append(filesize)
            self.parent.parent.file_line.append(
                pub_editorviewer.create_publisher_editor_viewer_row(
                    self.parent.parent, index=index_count, size=filesize, status_flg=0, filename=sfilename
                )
            )
            index_count += 1

            time.sleep(0.1)  # Must wait for the row to be generated before moving on.

            if self.stop_listing_flg == 1:
                pub_busy.busyEnd(self.parent.parent)
                self.parent.parent.pub_editorviewer.sf.configure(hscrollmode="dynamic")
                self.parent.parent.pub_editorviewer.sf.configure(vscrollmode="dynamic")
                self.parent.parent.file_counter = index_count
                time.sleep(0.1)  # Must wait for the row to be generated before moving on.
                self.parent.parent.log_output_window.appendtext(
                    "File list creation stopped. %s files in list.\n" % index_count
                )
                self.generating_file_list_flg = 0
                thread.exit()

        f.close()

        lock.release()

        self.parent.parent.file_counter = index_count

        pub_busy.busyEnd(self.parent.parent)
        self.parent.parent.pub_editorviewer.sf.configure(hscrollmode="dynamic")
        self.parent.parent.pub_editorviewer.sf.configure(vscrollmode="dynamic")

        self.parent.parent.log_output_window.appendtext(
            "Finished creating the file list. %s files in list.\n" % index_count
        )
        self.generating_file_list_flg = 0
    def myfun3(self, dirp, lock):
        import fnmatch, time

        index_count = 0
        lock.acquire()
        self.parent.parent.file_list = []
        self.parent.parent.file_size = []

        for root, dirs, files in os.walk(dirp):
            for filename in files:
                if fnmatch.fnmatch(filename, self.extension[0]):
                    sfilename = os.path.join(root, filename)
                    filesize = os.path.getsize(sfilename)
                    self.parent.parent.file_list.append(sfilename)
                    self.parent.parent.file_size.append(filesize)
                    self.parent.parent.file_line.append(
                        pub_editorviewer.create_publisher_editor_viewer_row(
                            self.parent.parent, index=index_count, size=filesize, status_flg=1, filename=sfilename
                        )
                    )
                    index_count += 1

                    time.sleep(0.1)  # Must wait for the row to be generated before moving on.

                if self.stop_listing_flg == 1 and index_count > 0:
                    pub_busy.busyEnd(self.parent.parent)
                    self.parent.parent.pub_editorviewer.sf.configure(hscrollmode="dynamic")
                    self.parent.parent.pub_editorviewer.sf.configure(vscrollmode="dynamic")
                    self.parent.parent.file_counter = index_count
                    time.sleep(0.1)  # Must wait for the row to be generated before moving on.
                    self.parent.parent.log_output_window.appendtext(
                        "File list creation stopped. %s files in list.\n" % index_count
                    )
                    self.generating_file_list_flg = 0
                    thread.exit()
        lock.release()

        self.parent.parent.file_counter = index_count

        pub_busy.busyEnd(self.parent.parent)

        if index_count > 0:
            self.parent.parent.pub_editorviewer.sf.configure(hscrollmode="dynamic")
            self.parent.parent.pub_editorviewer.sf.configure(vscrollmode="dynamic")

        self.parent.parent.log_output_window.appendtext(
            "Finished creating the file list. %s files in list.\n" % index_count
        )
        self.generating_file_list_flg = 0