Esempio n. 1
0
 def _show_page(self) -> 'IO':
     if not files.dir_not_empty(self._data):
         print('This is the last page!')
         self._data.page_num -= 1
         return False
     lscat.show_instant(self._tracker_class, self._data)
     self._print_page_info()
Esempio n. 2
0
 def show_func(self) -> 'IO':
     if self.scrollable:
         self.myslice = utils.slice_images(self.max_images,
                                           self.terminal_page)
         self.images = lscat.handle_scroll(self.tracker, self.data,
                                           self.myslice)
     else:
         lscat.show_instant(self.tracker, self.data)
Esempio n. 3
0
def test_TrackDownloadsUser_with_koneko_file(tmp_path, use_test_cfg_path):
    """Test with .koneko file"""
    data = FakeData(tmp_path)
    pics = ('004_祝!!!.jpg', '017_ミコニャン.jpg', '008_77803142_p0.png')
    for pic in pics:
        os.system(f'cp testing/files/{pic} {tmp_path}')

    invis_file = tmp_path / '.koneko'
    invis_file.touch()
    with open(invis_file, 'w') as f:
        f.write('3')

    lscat.show_instant(lscat.TrackDownloadsUsers, data)

    tracker = lscat.TrackDownloadsUsers(data)
    for pic in pics:
        tracker.update(pic)
Esempio n. 4
0
def test_show_instant(monkeypatch):
    showed = []

    class FakeTracker:
        def __init__(self, data):
            pass

        def update(self, new):
            showed.append(new)

    FakeData = namedtuple('data', ('download_path', ))

    monkeypatch.setattr('koneko.config.api.print_info', lambda: True)

    fakedata = FakeData(Path('testing/files/'))
    lscat.show_instant(FakeTracker, fakedata)
    assert set(showed) == {
        '004_祝!!!.jpg', 'mode3.json', 'mode1.json', 'not_an_image.txt',
        '008_77803142_p0.png', '017_ミコニャン.jpg', 'mode2.json'
    }
Esempio n. 5
0
 def _show_then_fetch(self):
     lscat.show_instant(self._tracker_class, self._data)
     self._request_then_save()
     #self._verify_up_to_date()
     self._print_page_info()
Esempio n. 6
0
 def _back(self) -> 'IO':
     """After user 'back's from image prompt or artist gallery, start mode again"""
     lscat.show_instant(self._tracker_class, self._data)
     self._print_page_info()
     prompt.gallery_like_prompt(self)
Esempio n. 7
0
def _display_core(tracker, data, max_images):
    if config.api.use_ueberzug() or not config.api.scroll_display():
        lscat_prompt.scroll_prompt(tracker, data, max_images)
        input()  # On program exit all images are cleared
    else:
        lscat.show_instant(tracker, data)
Esempio n. 8
0
 def scroll_or_show(self):
     if self.scrollable:
         self.handle_scroll()
     else:
         lscat.show_instant(self._tracker_class, self._data)