Skip to content

Commit

Permalink
Merge pull request #113 from libyui/keyboard_shortcuts
Browse files Browse the repository at this point in the history
Keyboard shortcuts
  • Loading branch information
lslezak committed Feb 11, 2021
2 parents f130284 + 7044e01 commit aed75b1
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 9 deletions.
2 changes: 1 addition & 1 deletion VERSION.cmake
@@ -1,6 +1,6 @@
SET( VERSION_MAJOR "4")
SET( VERSION_MINOR "0" )
SET( VERSION_PATCH "1" )
SET( VERSION_PATCH "2" )
SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )

SET( SONAME_MAJOR "15" )
Expand Down
45 changes: 45 additions & 0 deletions doc/keyboard_shortcuts.md
@@ -0,0 +1,45 @@
# Libyui-ncurses Keyboard Shortcuts

The libyui-ncurses interface implements several keyboard shortcuts.

## Widget Shortcuts

Some widgets use special keyboard shortcuts. Make sure that the respective
widget is active (the cursor is placed there).

### Table

- `Ctrl+O` - Change the ordering. After pressing it a list with the column
names is displayed. Select which column should be used for ordering, to
change the direction (ascending/descending) select the same column again.

## Global Shortcuts

These shortcuts can be used anytime, it does not matter which widget is active
(or if any widget is active at all).

- `Shift+F1` - Display a hot key help.

- `Ctrl+L` - Redraw the current screen. If for whatever reason the screen
content it not displayed properly you can force redrawing the whole screen.

- `Shift+F4` - Change the color style. This cycles over the built-in color styles.

- `Shift+F6` - Ask for widget ID. Enter the ID of the button which should be
activated. This is intended for automated tests.

- `Ctrl+D Shift+D` - Dump the current dialog into the log. It dumps the screenshot
and also the logical structure of the dialog (the widget tree).

- `Ctrl+D Shift+Y` - Start the widget inspector. Displays a special dialog which
can navigate in the widget tree and display detailed widget properties. It can
also change some widget properties and even delete or add new widgets.

- `Ctrl+D Shift+G` - Send a debug event. This should start the debugger in the
running application.

- `Ctrl+D Shift+C` - Send a configuration event. This should display a special
dialog for configuring the application.

- `Ctrl+D Shift+S` (only when `Y2NCDBG` environment variable is set) - Display
a special style testing dialog.
2 changes: 1 addition & 1 deletion package/libyui-ncurses-doc.spec
Expand Up @@ -22,7 +22,7 @@
Name: %{parent}-doc

# DO NOT manually bump the version here; instead, use rake version:bump
Version: 4.0.1
Version: 4.0.2
Release: 0
BuildArch: noarch

Expand Down
11 changes: 11 additions & 0 deletions package/libyui-ncurses.changes
@@ -1,3 +1,14 @@
-------------------------------------------------------------------
Thu Feb 11 13:34:20 UTC 2021 - Ladislav Slezák <lslezak@suse.cz>

- Added keyboard shortcuts:
Ctrl-D Shift-G - start the debugger
Ctrl-D Shift-C - start the configuration console
(jsc#PM-1895, jsc#SLE-16263)
- CMake fix: do not create the include/yui symlink if it already
exists
- 4.0.2

-------------------------------------------------------------------
Thu Feb 4 10:19:11 UTC 2021 - Stefan Hundhammer <shundhammer@suse.com>

Expand Down
4 changes: 2 additions & 2 deletions package/libyui-ncurses.spec
Expand Up @@ -20,11 +20,11 @@
Name: libyui-ncurses

# DO NOT manually bump the version here; instead, use rake version:bump
Version: 4.0.1
Version: 4.0.2
Release: 0

%define so_version 15
%define libyui_devel_version libyui-devel >= 3.10.0
%define libyui_devel_version libyui-devel >= 4.0.1
%define bin_name %{name}%{so_version}

BuildRequires: cmake >= 3.10
Expand Down
10 changes: 7 additions & 3 deletions src/CMakeLists.txt
Expand Up @@ -217,9 +217,13 @@ set( LOCAL_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include )
# Symlink ../../libyui/src to build/src/include/yui
# so the headers there can be included as <yui/YFoo.h>
add_custom_target( local-include-dir
COMMAND rm -rf ${LOCAL_INCLUDE_DIR}
COMMAND mkdir ${LOCAL_INCLUDE_DIR}
COMMAND ln -s ${CMAKE_CURRENT_SOURCE_DIR}/../../libyui/src ${LOCAL_INCLUDE_DIR}/yui )
# check if the symlink already exists
COMMAND if [ ! -L "${LOCAL_INCLUDE_DIR}/yui" ]\; then
rm -rf ${LOCAL_INCLUDE_DIR}\;
mkdir ${LOCAL_INCLUDE_DIR}\;
ln -s ${CMAKE_CURRENT_SOURCE_DIR}/../../libyui/src ${LOCAL_INCLUDE_DIR}/yui\;
fi
)

add_dependencies( ${TARGETLIB} local-include-dir )
target_include_directories( ${TARGETLIB} BEFORE PUBLIC ${LOCAL_INCLUDE_DIR} )
Expand Down
12 changes: 11 additions & 1 deletion src/NCDialog.cc
Expand Up @@ -1160,6 +1160,13 @@ void NCDialog::processInput( int timeout_millisec )
YDialogSpy::showDialogSpy();
break;

case 'C':
pendingEvent = NCursesEvent::special_key_config;
break;

case 'G':
pendingEvent = NCursesEvent::debug;
break;
}

break;
Expand Down Expand Up @@ -1386,10 +1393,13 @@ void NCDialog::showHotkeyHelp()
"<p><b>Shift-F4</b> Change color schema.</p>"
"<p><b>Ctrl-\\</b> Quit the application.</p>"
"<p><b>Ctrl-L</b> Refresh screen.</p>"
"<p><b>Ctrl-O</b> Change table ordering, selecting the same column again changes the direction.</p>"
"<p><b>Ctrl-D F1</b> Show a list of advanced hotkeys.</p>"
"<p><b>Ctrl-D Shift-D</b> Dump dialog to the log file as a screen shot.</p>"
"<p><b>Ctrl-D Shift-Y</b> Open YDialogSpy to see the widget hierarchy.</p>"
"<p>Depending on your desktop environment some of these key combinations <br/>might not work.</p>" ),
"<p><b>Ctrl-D Shift-G</b> Send a debug event, start the debugger.</p>"
"<p><b>Ctrl-D Shift-C</b> Send a config event, display special configuration options.</p>"
"<p>Depending on your desktop environment some of these key combinations might not work.</p>" ),
true );

// restore former text domain
Expand Down
6 changes: 6 additions & 0 deletions src/NCtoY2Event.cc
Expand Up @@ -76,6 +76,12 @@ NCtoY2Event::propagate()
case cancel:
return new YCancelEvent();

case debug:
return new YDebugEvent();

case special_key_config:
return new YSpecialKeyEvent("config");

case timeout:
return new YTimeoutEvent();

Expand Down
2 changes: 2 additions & 0 deletions src/NCurses.cc
Expand Up @@ -115,6 +115,8 @@ std::ostream & operator<<( std::ostream & str, const NCursesEvent & obj )
ENUM_OUT( menu );
ENUM_OUT( timeout );
ENUM_OUT( key );
ENUM_OUT( debug );
ENUM_OUT( special_key_config );
}

#undef ENUM_OUT
Expand Down
4 changes: 3 additions & 1 deletion src/NCurses.h
Expand Up @@ -82,7 +82,9 @@ class NCursesEvent
timeout,
button,
menu,
key
key,
debug,
special_key_config
};

enum DETAIL
Expand Down

0 comments on commit aed75b1

Please sign in to comment.