Exemple #1
0
def recursive_list_dir(cwd):
    all_files = []

    for root, dirs, files in os.walk(cwd):
        all_files.extend(util.list_of_tuples(files, root))

    return all_files
Exemple #2
0
def list_files(is_flat_directory_view, cwd):
    files = []

    if is_flat_directory_view:
        files = recursive_list_dir(cwd)
    else:
        files = util.list_of_tuples(os.listdir(cwd), cwd)

    return files
Exemple #3
0
    def testAtoH(self):
        lst = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
        data.list_files = lambda a, b: util.list_of_tuples(lst, b)
        # Constrain the size, to feed the test data in a controlled manner
        self.panel.initialize_view_settings(3, 4)
        self.panel.model.fill_list_by_working_dir('.')

        self.panel.move_selection_left()
        self.assertEquals(self.panel.selected_item, 7)
Exemple #4
0
 def setUp(self):
     # By default, all tests in this case will have this layout of items:
     # two columns, three rows, all full of items ('a' being '..')
     # +-
     # | a d
     # | b e
     # | c f
     # +-
     lst = ['a', 'b', 'c', 'd', 'e']
     data.list_files = lambda a, b: util.list_of_tuples(lst, b)
     self.panel = theFrame.p1
     self.panel.initialize_view_settings(3, 3)
     self.panel.model.fill_list_by_working_dir('.')
     self.panel.move_selection_zero()
Exemple #5
0
    def testGtoD(self):
        lst = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
        data.list_files = lambda a, b: util.list_of_tuples(lst, b)
        # Constrain the size, to feed the test data in a controlled manner
        self.panel.initialize_view_settings(3, 4)
        self.panel.model.fill_list_by_working_dir('.')

        # A rather lengthy way to position ourselves on 'g':
        self.panel.move_selection_down()
        self.panel.move_selection_down()
        self.panel.move_selection_down()
        self.panel.move_selection_down()
        self.panel.move_selection_down()
        self.panel.move_selection_down()

        self.panel.move_selection_right()
        self.assertEquals(self.panel.selected_item, 3)