Skip to content

Instantly share code, notes, and snippets.

@tfmoraes
Created November 9, 2022 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfmoraes/a2fa76426420044df6b4f01afd986d72 to your computer and use it in GitHub Desktop.
Save tfmoraes/a2fa76426420044df6b4f01afd986d72 to your computer and use it in GitHub Desktop.
diff --git a/invesalius/data/viewer_slice.py b/invesalius/data/viewer_slice.py
index ff6344ed..bba882b3 100644
--- a/invesalius/data/viewer_slice.py
+++ b/invesalius/data/viewer_slice.py
@@ -682,14 +682,14 @@ class Viewer(wx.Panel):
mposx, mposy = wx.GetMousePosition()
cposx, cposy = self.interactor.ScreenToClient((mposx, mposy))
mx, my = cposx, self.interactor.GetSize()[1] - cposy
- if sys.platform == 'darwin':
- # It's needed to mutiple by scale factor in HighDPI because of
- # https://docs.wxpython.org/wx.glcanvas.GLCanvas.html
- # For now we are doing this only on Mac but it may be needed on
- # Windows and Linux too.
- scale = self.interactor.GetContentScaleFactor()
- mx *= scale
- my *= scale
+ # if sys.platform == 'darwin':
+ # # It's needed to mutiple by scale factor in HighDPI because of
+ # # https://docs.wxpython.org/wx.glcanvas.GLCanvas.html
+ # # For now we are doing this only on Mac but it may be needed on
+ # # Windows and Linux too.
+ # scale = self.interactor.GetContentScaleFactor()
+ # mx *= scale
+ # my *= scale
return int(mx), int(my)
def get_coordinate_cursor(self, mx, my, picker=None):
diff --git a/invesalius/data/viewer_volume.py b/invesalius/data/viewer_volume.py
index 4ff4cde4..617b6598 100644
--- a/invesalius/data/viewer_volume.py
+++ b/invesalius/data/viewer_volume.py
@@ -177,9 +177,9 @@ class Viewer(wx.Panel):
self.text = vtku.TextZero()
self.text.SetValue("")
self.text.SetPosition(const.TEXT_POS_LEFT_UP)
- if sys.platform == 'darwin':
- font_size = const.TEXT_SIZE_LARGE * self.GetContentScaleFactor()
- self.text.SetSize(int(round(font_size, 0)))
+ # if sys.platform == 'darwin':
+ # font_size = const.TEXT_SIZE_LARGE * self.GetContentScaleFactor()
+ # self.text.SetSize(int(round(font_size, 0)))
self.ren.AddActor(self.text.actor)
# self.polygon = Polygon(None, is_3d=False)
@@ -403,14 +403,14 @@ class Viewer(wx.Panel):
mposx, mposy = wx.GetMousePosition()
cposx, cposy = self.interactor.ScreenToClient((mposx, mposy))
mx, my = cposx, self.interactor.GetSize()[1] - cposy
- if sys.platform == 'darwin':
- # It's needed to mutiple by scale factor in HighDPI because of
- # https://docs.wxpython.org/wx.glcanvas.GLCanvas.html
- # For now we are doing this only on Mac but it may be needed on
- # Windows and Linux too.
- scale = self.interactor.GetContentScaleFactor()
- mx *= scale
- my *= scale
+ # if sys.platform == 'darwin':
+ # # It's needed to mutiple by scale factor in HighDPI because of
+ # # https://docs.wxpython.org/wx.glcanvas.GLCanvas.html
+ # # For now we are doing this only on Mac but it may be needed on
+ # # Windows and Linux too.
+ # scale = self.interactor.GetContentScaleFactor()
+ # mx *= scale
+ # my *= scale
return int(mx), int(my)
def SetStereoMode(self, mode):
diff --git a/invesalius/data/vtk_utils.py b/invesalius/data/vtk_utils.py
index 03ec295a..f9fdf314 100644
--- a/invesalius/data/vtk_utils.py
+++ b/invesalius/data/vtk_utils.py
@@ -298,7 +298,7 @@ class TextZero(object):
x, y = coord.GetComputedDisplayValue(canvas.evt_renderer)
font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
font.SetSymbolicSize(self.symbolic_syze)
- font.Scale(canvas.viewer.GetContentScaleFactor())
+ # font.Scale(canvas.viewer.GetContentScaleFactor())
if self.bottom_pos or self.right_pos:
w, h = canvas.calc_text_size(self.text, font)
if self.right_pos:
diff --git a/invesalius/gui/widgets/canvas_renderer.py b/invesalius/gui/widgets/canvas_renderer.py
index 3b7a2e71..88cd95ba 100644
--- a/invesalius/gui/widgets/canvas_renderer.py
+++ b/invesalius/gui/widgets/canvas_renderer.py
@@ -625,7 +625,7 @@ class CanvasRendererCTX:
if font is None:
font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
- font.Scale(self.viewer.GetContentScaleFactor())
+ # font.Scale(self.viewer.GetContentScaleFactor())
_font = gc.CreateFont(font, txt_colour)
px, py = pos
@@ -659,7 +659,7 @@ class CanvasRendererCTX:
if font is None:
font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
- font.Scale(self.viewer.GetContentScaleFactor())
+ # font.Scale(self.viewer.GetContentScaleFactor())
_font = gc.CreateFont(font, txt_colour)
gc.SetFont(_font)
@@ -880,7 +880,8 @@ class CircleHandler(CanvasHandlerBase):
def draw_to_canvas(self, gc, canvas):
if self.visible:
viewer = canvas.viewer
- scale = viewer.GetContentScaleFactor()
+ # scale = viewer.GetContentScaleFactor()
+ scale = 1
if self.is_3d:
px, py = self._3d_to_2d(canvas.evt_renderer, self.position)
else:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment