Commit 6b54118d86ec281fd556610a383b77e7fb4734f5
1 parent
cfd19045
Exists in
master
python3 sys.platform returns linux
Showing
7 changed files
with
16 additions
and
16 deletions
Show diff stats
app.py
| @@ -50,7 +50,7 @@ from wx.lib.pubsub import setuparg1# as psv1 | @@ -50,7 +50,7 @@ from wx.lib.pubsub import setuparg1# as psv1 | ||
| 50 | from wx.lib.pubsub import pub as Publisher | 50 | from wx.lib.pubsub import pub as Publisher |
| 51 | 51 | ||
| 52 | #import wx.lib.agw.advancedsplash as agw | 52 | #import wx.lib.agw.advancedsplash as agw |
| 53 | -#if sys.platform == 'linux2': | 53 | +#if sys.platform.startswith('linux'): |
| 54 | # _SplashScreen = agw.AdvancedSplash | 54 | # _SplashScreen = agw.AdvancedSplash |
| 55 | #else: | 55 | #else: |
| 56 | # if sys.platform != 'darwin': | 56 | # if sys.platform != 'darwin': |
| @@ -80,7 +80,7 @@ USER_LOG_DIR = os.path.join(USER_INV_DIR, u'logs') | @@ -80,7 +80,7 @@ USER_LOG_DIR = os.path.join(USER_INV_DIR, u'logs') | ||
| 80 | 80 | ||
| 81 | # ------------------------------------------------------------------ | 81 | # ------------------------------------------------------------------ |
| 82 | 82 | ||
| 83 | -if sys.platform in ('linux2', 'win32'): | 83 | +if sys.platform in ('linux2', 'linux', 'win32'): |
| 84 | try: | 84 | try: |
| 85 | tmp_var = wx.GetXDisplay | 85 | tmp_var = wx.GetXDisplay |
| 86 | except AttributeError: | 86 | except AttributeError: |
invesalius/data/viewer_slice.py
| @@ -1264,7 +1264,7 @@ class Viewer(wx.Panel): | @@ -1264,7 +1264,7 @@ class Viewer(wx.Panel): | ||
| 1264 | self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_SIZEWE)) | 1264 | self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_SIZEWE)) |
| 1265 | 1265 | ||
| 1266 | def SetSizeNWSECursor(self, pubsub_evt): | 1266 | def SetSizeNWSECursor(self, pubsub_evt): |
| 1267 | - if sys.platform == 'linux2': | 1267 | + if sys.platform.startswith('linux'): |
| 1268 | self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_SIZENWSE)) | 1268 | self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_SIZENWSE)) |
| 1269 | else: | 1269 | else: |
| 1270 | self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_SIZING)) | 1270 | self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_SIZING)) |
invesalius/gui/default_viewers.py
| @@ -379,7 +379,7 @@ class VolumeToolPanel(wx.Panel): | @@ -379,7 +379,7 @@ class VolumeToolPanel(wx.Panel): | ||
| 379 | self.button_view = button_view | 379 | self.button_view = button_view |
| 380 | 380 | ||
| 381 | # VOLUME COLOUR BUTTON | 381 | # VOLUME COLOUR BUTTON |
| 382 | - if sys.platform == 'linux2': | 382 | + if sys.platform.startswith('linux'): |
| 383 | size = (32,32) | 383 | size = (32,32) |
| 384 | sp = 2 | 384 | sp = 2 |
| 385 | else: | 385 | else: |
invesalius/gui/dialogs.py
| @@ -292,7 +292,7 @@ def ShowOpenProjectDialog(): | @@ -292,7 +292,7 @@ def ShowOpenProjectDialog(): | ||
| 292 | def ShowImportDirDialog(self): | 292 | def ShowImportDirDialog(self): |
| 293 | current_dir = os.path.abspath(".") | 293 | current_dir = os.path.abspath(".") |
| 294 | 294 | ||
| 295 | - if (sys.platform == 'win32') or (sys.platform == 'linux2'): | 295 | + if sys.platform == 'win32' or sys.platform.startswith('linux'): |
| 296 | session = ses.Session() | 296 | session = ses.Session() |
| 297 | 297 | ||
| 298 | if (session.GetLastDicomFolder()): | 298 | if (session.GetLastDicomFolder()): |
| @@ -333,7 +333,7 @@ def ShowImportDirDialog(self): | @@ -333,7 +333,7 @@ def ShowImportDirDialog(self): | ||
| 333 | def ShowImportBitmapDirDialog(self): | 333 | def ShowImportBitmapDirDialog(self): |
| 334 | current_dir = os.path.abspath(".") | 334 | current_dir = os.path.abspath(".") |
| 335 | 335 | ||
| 336 | - if (sys.platform == 'win32') or (sys.platform == 'linux2'): | 336 | + if sys.platform == 'win32' or sys.platform.startswith('linux'): |
| 337 | session = ses.Session() | 337 | session = ses.Session() |
| 338 | 338 | ||
| 339 | if (session.GetLastDicomFolder()): | 339 | if (session.GetLastDicomFolder()): |
| @@ -1454,7 +1454,7 @@ def ExportPicture(type_=""): | @@ -1454,7 +1454,7 @@ def ExportPicture(type_=""): | ||
| 1454 | project = proj.Project() | 1454 | project = proj.Project() |
| 1455 | 1455 | ||
| 1456 | project_name = "%s_%s" % (project.name, type_) | 1456 | project_name = "%s_%s" % (project.name, type_) |
| 1457 | - if not sys.platform in ('win32', 'linux2'): | 1457 | + if not sys.platform in ('win32', 'linux2', 'linux'): |
| 1458 | project_name += ".jpg" | 1458 | project_name += ".jpg" |
| 1459 | 1459 | ||
| 1460 | dlg = wx.FileDialog(None, | 1460 | dlg = wx.FileDialog(None, |
invesalius/gui/widgets/slice_menu.py
| @@ -90,7 +90,7 @@ class SliceMenu(wx.Menu): | @@ -90,7 +90,7 @@ class SliceMenu(wx.Menu): | ||
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | #------------ Sub menu of the pseudo colors ---------------- | 92 | #------------ Sub menu of the pseudo colors ---------------- |
| 93 | - if sys.platform == 'linux2': | 93 | + if sys.platform.startswith('linux'): |
| 94 | mkind = wx.ITEM_CHECK | 94 | mkind = wx.ITEM_CHECK |
| 95 | else: | 95 | else: |
| 96 | mkind = wx.ITEM_RADIO | 96 | mkind = wx.ITEM_RADIO |
| @@ -166,7 +166,7 @@ class SliceMenu(wx.Menu): | @@ -166,7 +166,7 @@ class SliceMenu(wx.Menu): | ||
| 166 | # It doesn't work in Linux | 166 | # It doesn't work in Linux |
| 167 | self.Bind(wx.EVT_MENU, self.OnPopup) | 167 | self.Bind(wx.EVT_MENU, self.OnPopup) |
| 168 | # In Linux the bind must be putted in the submenu | 168 | # In Linux the bind must be putted in the submenu |
| 169 | - if sys.platform == 'linux2' or sys.platform == 'darwin': | 169 | + if sys.platform.startswith('linux') or sys.platform == 'darwin': |
| 170 | submenu_wl.Bind(wx.EVT_MENU, self.OnPopup) | 170 | submenu_wl.Bind(wx.EVT_MENU, self.OnPopup) |
| 171 | submenu_pseudo_colours.Bind(wx.EVT_MENU, self.OnPopup) | 171 | submenu_pseudo_colours.Bind(wx.EVT_MENU, self.OnPopup) |
| 172 | submenu_image_tiling.Bind(wx.EVT_MENU, self.OnPopup) | 172 | submenu_image_tiling.Bind(wx.EVT_MENU, self.OnPopup) |
| @@ -226,7 +226,7 @@ class SliceMenu(wx.Menu): | @@ -226,7 +226,7 @@ class SliceMenu(wx.Menu): | ||
| 226 | Publisher.sendMessage('Change colour table from background image', values) | 226 | Publisher.sendMessage('Change colour table from background image', values) |
| 227 | Publisher.sendMessage('Update slice viewer') | 227 | Publisher.sendMessage('Update slice viewer') |
| 228 | 228 | ||
| 229 | - if sys.platform == 'linux2': | 229 | + if sys.platform.startswith('linux'): |
| 230 | for i in self.pseudo_color_items: | 230 | for i in self.pseudo_color_items: |
| 231 | it = self.pseudo_color_items[i] | 231 | it = self.pseudo_color_items[i] |
| 232 | if it.IsChecked(): | 232 | if it.IsChecked(): |
| @@ -241,7 +241,7 @@ class SliceMenu(wx.Menu): | @@ -241,7 +241,7 @@ class SliceMenu(wx.Menu): | ||
| 241 | Publisher.sendMessage('Change colour table from background image from plist', values) | 241 | Publisher.sendMessage('Change colour table from background image from plist', values) |
| 242 | Publisher.sendMessage('Update slice viewer') | 242 | Publisher.sendMessage('Update slice viewer') |
| 243 | 243 | ||
| 244 | - if sys.platform == 'linux2': | 244 | + if sys.platform.startswith('linux'): |
| 245 | for i in self.pseudo_color_items: | 245 | for i in self.pseudo_color_items: |
| 246 | it = self.pseudo_color_items[i] | 246 | it = self.pseudo_color_items[i] |
| 247 | if it.IsChecked(): | 247 | if it.IsChecked(): |
| @@ -273,7 +273,7 @@ class SliceMenu(wx.Menu): | @@ -273,7 +273,7 @@ class SliceMenu(wx.Menu): | ||
| 273 | else: | 273 | else: |
| 274 | self.cdialog.Show(self._gen_event) | 274 | self.cdialog.Show(self._gen_event) |
| 275 | 275 | ||
| 276 | - if sys.platform == 'linux2': | 276 | + if sys.platform.startswith('linux'): |
| 277 | for i in self.pseudo_color_items: | 277 | for i in self.pseudo_color_items: |
| 278 | it = self.pseudo_color_items[i] | 278 | it = self.pseudo_color_items[i] |
| 279 | if it.IsChecked(): | 279 | if it.IsChecked(): |
invesalius/utils.py
| @@ -254,7 +254,7 @@ def calculate_resizing_tofitmemory(x_size,y_size,n_slices,byte): | @@ -254,7 +254,7 @@ def calculate_resizing_tofitmemory(x_size,y_size,n_slices,byte): | ||
| 254 | if ram_total>1400000000: | 254 | if ram_total>1400000000: |
| 255 | ram_total=1400000000 | 255 | ram_total=1400000000 |
| 256 | 256 | ||
| 257 | - if (sys.platform == 'linux2'): | 257 | + if sys.platform.startswith('linux'): |
| 258 | if (platform.architecture()[0] == '32bit'): | 258 | if (platform.architecture()[0] == '32bit'): |
| 259 | if ram_free>3500000000: | 259 | if ram_free>3500000000: |
| 260 | ram_free=3500000000 | 260 | ram_free=3500000000 |
| @@ -313,7 +313,7 @@ def predict_memory(nfiles, x, y, p): | @@ -313,7 +313,7 @@ def predict_memory(nfiles, x, y, p): | ||
| 313 | 313 | ||
| 314 | return (x/porcent, y/porcent) | 314 | return (x/porcent, y/porcent) |
| 315 | 315 | ||
| 316 | - elif(sys.platform == 'linux2'): | 316 | + elif sys.platform.startswith('linux'): |
| 317 | 317 | ||
| 318 | if (platform.architecture()[0] == '32bit'): | 318 | if (platform.architecture()[0] == '32bit'): |
| 319 | # 839000000 = 800 MB | 319 | # 839000000 = 800 MB |
| @@ -461,4 +461,4 @@ def encode(text, encoding, *args): | @@ -461,4 +461,4 @@ def encode(text, encoding, *args): | ||
| 461 | try: | 461 | try: |
| 462 | return text.encode(encoding, *args) | 462 | return text.encode(encoding, *args) |
| 463 | except AttributeError: | 463 | except AttributeError: |
| 464 | - return text | ||
| 465 | \ No newline at end of file | 464 | \ No newline at end of file |
| 465 | + return text |
setup.py
| @@ -8,7 +8,7 @@ import sys | @@ -8,7 +8,7 @@ import sys | ||
| 8 | 8 | ||
| 9 | import numpy | 9 | import numpy |
| 10 | 10 | ||
| 11 | -if sys.platform == 'linux2': | 11 | +if sys.platform.startswith('linux'): |
| 12 | setup( | 12 | setup( |
| 13 | cmdclass = {'build_ext': build_ext}, | 13 | cmdclass = {'build_ext': build_ext}, |
| 14 | ext_modules = cythonize([ Extension("invesalius.data.mips", ["invesalius/data/mips.pyx"], | 14 | ext_modules = cythonize([ Extension("invesalius.data.mips", ["invesalius/data/mips.pyx"], |