Let the focused pane be resized to the full screen.

This commit is contained in:
Andrew Hamilton 2016-10-29 14:07:17 +02:00
parent b079ce61c9
commit 2ff166cdd4
2 changed files with 13 additions and 4 deletions

View file

@ -26,6 +26,7 @@
│ (Bp(B - Pause workers. (toggle) │ │ (Bp(B - Pause workers. (toggle) │
│ (Bo(B - Order files by type, or by directory location. (toggle) │ │ (Bo(B - Order files by type, or by directory location. (toggle) │
│ (Br(B - Refresh the currently selected report. │ │ (Br(B - Refresh the currently selected report. │
│ (Bf(B - Resize the focused pane to the full screen. (toggle) │
│ │ │ │
│Statuses: │ │Statuses: │
│ (B (B Normal │ │ (B (B Normal │
@ -56,5 +57,4 @@
│ │ │ │
│ │ │ │
│ │ │ │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘(B └──────────────────────────────────────────────────────────────────────────────────────────────────┘(B

15
vigil
View file

@ -79,6 +79,7 @@ KEYS_DOC = """Keys:
*p - Pause workers. (toggle) *p - Pause workers. (toggle)
*o - Order files by type, or by directory location. (toggle) *o - Order files by type, or by directory location. (toggle)
*r - Refresh the currently selected report. *r - Refresh the currently selected report.
*f - Resize the focused pane to the full screen. (toggle)
""" """
@ -551,6 +552,7 @@ class Screen:
self._is_log_visible = True self._is_log_visible = True
self._is_help_visible = False self._is_help_visible = False
self._is_paused = False self._is_paused = False
self._is_fullscreen = False
self._make_widgets() self._make_widgets()
self._key_map = make_key_map(Screen._KEY_DATA) self._key_map = make_key_map(Screen._KEY_DATA)
@ -746,6 +748,9 @@ class Screen:
self._is_summary_focused = not self._is_summary_focused self._is_summary_focused = not self._is_summary_focused
self._set_focus() self._set_focus()
def toggle_fullscreen(self):
self._is_fullscreen = not self._is_fullscreen
def _on_mouse_event(self, event): def _on_mouse_event(self, event):
if event[0] not in ["mouse press", "mouse drag"]: if event[0] not in ["mouse press", "mouse drag"]:
return return
@ -797,7 +802,7 @@ class Screen:
_STATUS_BAR = highlight_chars( _STATUS_BAR = highlight_chars(
" *help *quit *t*a*b:focus *turn *log *edit *next *pause *order" " *help *quit *t*a*b:focus *turn *log *edit *next *pause *order"
" *refresh", Log._GREEN_STYLE) " *refresh *fullscreen", Log._GREEN_STYLE)
@functools.lru_cache(maxsize=2) @functools.lru_cache(maxsize=2)
def _get_status_bar_appearance(self, width, is_directory_sort, is_paused, def _get_status_bar_appearance(self, width, is_directory_sort, is_paused,
@ -813,9 +818,11 @@ class Screen:
return [bar[:progress_bar_size].underline() + bar[progress_bar_size:]] return [bar[:progress_bar_size].underline() + bar[progress_bar_size:]]
def appearance(self, dimensions): def appearance(self, dimensions):
width, height = max(dimensions[0], 10), max(dimensions[1], 20) if self._is_fullscreen and self._is_summary_focused:
return self._summary_border.appearance(dimensions)
if self._is_help_visible: if self._is_help_visible:
return self._help_widget.appearance(dimensions) return self._help_widget.appearance(dimensions)
width, height = max(dimensions[0], 10), max(dimensions[1], 20)
widget = self._summary.get_selection() widget = self._summary.get_selection()
view = self._listing.widget.view view = self._listing.widget.view
view.position = widget.scroll_position view.position = widget.scroll_position
@ -825,6 +832,8 @@ class Screen:
self._listing.title = ( self._listing.title = (
tools.path_colored(widget.path) + divider + tool_name + " " + tools.path_colored(widget.path) + divider + tool_name + " " +
tools.status_to_str(widget.status)) tools.status_to_str(widget.status))
if self._is_fullscreen:
return self._listing.appearance(dimensions)
incomplete = self._summary.result_total - self._summary.completed_total incomplete = self._summary.result_total - self._summary.completed_total
progress_bar_size = max(0, width * incomplete // progress_bar_size = max(0, width * incomplete //
self._summary.result_total) self._summary.result_total)
@ -848,7 +857,7 @@ class Screen:
({"end", "ctrl e"}, cursor_page_right), ({"n"}, move_to_next_issue), ({"end", "ctrl e"}, cursor_page_right), ({"n"}, move_to_next_issue),
({"N"}, move_to_next_issue_of_tool), ({"e"}, edit_file), ({"N"}, move_to_next_issue_of_tool), ({"e"}, edit_file),
({"q"}, quit_), ({"p"}, toggle_pause), ({"r"}, refresh), ({"q"}, quit_), ({"p"}, toggle_pause), ({"r"}, refresh),
({"tab"}, toggle_focus)] ({"tab"}, toggle_focus), ({"f"}, toggle_fullscreen)]
def add_watch_manager_to_mainloop(root_path, mainloop, on_filesystem_change, def add_watch_manager_to_mainloop(root_path, mainloop, on_filesystem_change,