Skip to content

Commit

Permalink
Fix #995. Add preliminary support for handling DPI changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeyer committed Dec 15, 2023
1 parent 48c8239 commit 721eaf2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nion/swift/Panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def create_dock_widget(self, title: str, positions: typing.Sequence[str], positi
self.dock_widget.on_size_changed = self.size_changed
self.dock_widget.on_focus_changed = self.focus_changed
self.dock_widget.on_ui_activity = self.document_controller._register_ui_activity
self.dock_widget.on_physical_dpi_changed = self.__physical_dpi_changed

@property
def document_controller(self) -> DocumentController.DocumentController:
Expand Down Expand Up @@ -117,6 +118,10 @@ def focus_changed(self, focused: bool) -> None:
if focused:
self.document_controller.request_refocus()

def __physical_dpi_changed(self, physical_dpi: float) -> None:
if self.dock_widget and self.dock_widget.widget:
self.dock_widget.widget.redraw()

def __str__(self) -> str:
return self.display_name

Expand Down
4 changes: 4 additions & 0 deletions nion/swift/resources/changes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
{
"version": "Unreleased",
"notes": [
{
"issues": ["https://github.com/nion-software/nionswift/issues/995"],
"summary": "Fix crash when screen properties change. Also respond better to DPI changes."
},
{
"issues": ["https://github.com/nion-software/nionswift/issues/992"],
"summary": "Add scroll bar to activity panel to prevent it growing beyond its available height."
Expand Down

0 comments on commit 721eaf2

Please sign in to comment.