Skip to content

Commit

Permalink
Open and Export hotkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
sam210723 committed May 5, 2024
1 parent 0b993af commit 063bd9f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wavebin/interface/toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ def __init__(self, app: QApplication) -> None:
super(MainToolBar, self).__init__()

# Parent application instance
self.app = app
self.app: QApplication = app

# Set tool bar properties
self.setMovable(False)
self.setFloatable(False)
self.setContextMenuPolicy(Qt.ContextMenuPolicy.PreventContextMenu)
self.setFixedHeight(40)
self.setFixedHeight(50)
self.setStyleSheet(
"""
QToolBar {
Expand All @@ -53,7 +53,7 @@ def __init__(self, app: QApplication) -> None:
QToolButton {
color: #FFF;
margin: 5px;
padding: 4px;
padding: 6px;
}
"""
)
Expand Down Expand Up @@ -201,6 +201,7 @@ def button_about(self) -> bool:
"""

print("ABOUT")
return False


def set_info(self, sr: str, dur: str) -> None:
Expand Down
19 changes: 19 additions & 0 deletions wavebin/interface/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ def button_open(self) -> bool:
initial = Path.home()

# Show open file dialog
self.open_dialog.setFileMode(QFileDialog.ExistingFile)
file_path = self.open_dialog.getOpenFileName(
self.widget,
"Open waveform",
Expand Down Expand Up @@ -382,6 +383,16 @@ def event_keypress(self, event: QKeyEvent) -> None:
Handle keyboard hotkey events
"""

"""
Hotkey Summary
- Alt Toggle menu bar visibility
- F1 Show about dialog
- Ctrl + O Show open waveform dialog
- Ctrl + E Show export waveform dialog
- F Fill area under traces
- I Show waveform properties dialog
"""

# Ignore key repeats
if event.isAutoRepeat(): return

Expand All @@ -403,6 +414,14 @@ def event_keypress(self, event: QKeyEvent) -> None:
# Show wavebin About dialog
self.menu_bar.menu_help_about()

elif mod == Qt.KeyboardModifier.ControlModifier and key == Qt.Key.Key_O:
# Show open file dialog
self.button_open()

elif mod == Qt.KeyboardModifier.ControlModifier and key == Qt.Key.Key_E:
# Show export file dialog
if config.file: self.menu_bar.menu_file_export()

elif mod == None and key == Qt.Key.Key_F:
# Toggle filled area under waveform traces
if config.file: self.plot.toggle_trace_fill()
Expand Down

0 comments on commit 063bd9f

Please sign in to comment.