示例#1
0
文件: data.py 项目: rtfb/candy
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
示例#2
0
文件: data.py 项目: rtfb/candy
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
示例#3
0
文件: test_motion.py 项目: rtfb/candy
    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)
示例#4
0
文件: test_motion.py 项目: rtfb/candy
 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()
示例#5
0
文件: test_motion.py 项目: rtfb/candy
    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)