Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: make main window menubar action for 'Enter Fullscreen' toggle to 'Exit Fullscreen' when in fullscreen view. #1128

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pydm/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from os import path

from qtpy.QtWidgets import QApplication, QMainWindow, QFileDialog, QAction, QMessageBox
from qtpy.QtCore import Qt, QTimer, Slot, QSize, QLibraryInfo
from qtpy.QtCore import Qt, QTimer, Slot, QSize, QLibraryInfo, QCoreApplication
from qtpy.QtGui import QKeySequence
from .utilities import IconFont, find_file, establish_widget_connections, close_widget_connections
from .pydm_ui import Ui_MainWindow
Expand Down Expand Up @@ -479,10 +479,14 @@ def set_font_size(self, old, new):

@Slot(bool)
def enter_fullscreen(self, checked=False):
# for supporting localization (the main window menu-items all support this)
_translate = QCoreApplication.translate
if self.isFullScreen():
self.showNormal()
self.ui.actionEnter_Fullscreen.setText(_translate("MainWindow", "Enter Fullscreen"))
else:
self.showFullScreen()
self.ui.actionEnter_Fullscreen.setText(_translate("MainWindow", "Exit Fullscreen"))

@Slot(bool)
def show_connections(self, checked):
Expand Down
17 changes: 17 additions & 0 deletions pydm/tests/test_main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,20 @@ def test_reload_display(wrapped_compile_ui: MagicMock, qapp: PyDMApplication) ->
assert wrapped_compile_ui.call_count == 2
finally:
clear_compiled_ui_file_cache()


def test_menubar_text(qapp: PyDMApplication) -> None:
"""Verify main-window displays expected text in its menubar dropdown items"""
# only testing text update of "Enter/Exit Fullscreen" menu-item for now, this can be expanded later
display = Display(parent=None)

qapp.make_main_window()
qapp.main_window.set_display_widget(display)

action = qapp.main_window.ui.actionEnter_Fullscreen
# make sure we start in not fullscreen view
qapp.main_window.showNormal()
assert action.text() == "Enter Fullscreen"
# click the menu-item to go into fullscreen view
action.trigger()
assert action.text() == "Exit Fullscreen"
Loading