Skip to content

Commit

Permalink
python3 sys.platform returns linux
Browse files Browse the repository at this point in the history
  • Loading branch information
tfmoraes committed Jun 4, 2018
1 parent cfd1904 commit 6b54118
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
from wx.lib.pubsub import pub as Publisher

#import wx.lib.agw.advancedsplash as agw
#if sys.platform == 'linux2':
#if sys.platform.startswith('linux'):
# _SplashScreen = agw.AdvancedSplash
#else:
# if sys.platform != 'darwin':
Expand Down Expand Up @@ -80,7 +80,7 @@

# ------------------------------------------------------------------

if sys.platform in ('linux2', 'win32'):
if sys.platform in ('linux2', 'linux', 'win32'):
try:
tmp_var = wx.GetXDisplay
except AttributeError:
Expand Down
2 changes: 1 addition & 1 deletion invesalius/data/viewer_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ def SetSizeWECursor(self, pusub_evt):
self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_SIZEWE))

def SetSizeNWSECursor(self, pubsub_evt):
if sys.platform == 'linux2':
if sys.platform.startswith('linux'):
self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_SIZENWSE))
else:
self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_SIZING))
Expand Down
2 changes: 1 addition & 1 deletion invesalius/gui/default_viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def __init__(self, parent):
self.button_view = button_view

# VOLUME COLOUR BUTTON
if sys.platform == 'linux2':
if sys.platform.startswith('linux'):
size = (32,32)
sp = 2
else:
Expand Down
6 changes: 3 additions & 3 deletions invesalius/gui/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def ShowOpenProjectDialog():
def ShowImportDirDialog(self):
current_dir = os.path.abspath(".")

if (sys.platform == 'win32') or (sys.platform == 'linux2'):
if sys.platform == 'win32' or sys.platform.startswith('linux'):
session = ses.Session()

if (session.GetLastDicomFolder()):
Expand Down Expand Up @@ -333,7 +333,7 @@ def ShowImportDirDialog(self):
def ShowImportBitmapDirDialog(self):
current_dir = os.path.abspath(".")

if (sys.platform == 'win32') or (sys.platform == 'linux2'):
if sys.platform == 'win32' or sys.platform.startswith('linux'):
session = ses.Session()

if (session.GetLastDicomFolder()):
Expand Down Expand Up @@ -1454,7 +1454,7 @@ def ExportPicture(type_=""):
project = proj.Project()

project_name = "%s_%s" % (project.name, type_)
if not sys.platform in ('win32', 'linux2'):
if not sys.platform in ('win32', 'linux2', 'linux'):
project_name += ".jpg"

dlg = wx.FileDialog(None,
Expand Down
10 changes: 5 additions & 5 deletions invesalius/gui/widgets/slice_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(self):


#------------ Sub menu of the pseudo colors ----------------
if sys.platform == 'linux2':
if sys.platform.startswith('linux'):
mkind = wx.ITEM_CHECK
else:
mkind = wx.ITEM_RADIO
Expand Down Expand Up @@ -166,7 +166,7 @@ def __init__(self):
# It doesn't work in Linux
self.Bind(wx.EVT_MENU, self.OnPopup)
# In Linux the bind must be putted in the submenu
if sys.platform == 'linux2' or sys.platform == 'darwin':
if sys.platform.startswith('linux') or sys.platform == 'darwin':
submenu_wl.Bind(wx.EVT_MENU, self.OnPopup)
submenu_pseudo_colours.Bind(wx.EVT_MENU, self.OnPopup)
submenu_image_tiling.Bind(wx.EVT_MENU, self.OnPopup)
Expand Down Expand Up @@ -226,7 +226,7 @@ def OnPopup(self, evt):
Publisher.sendMessage('Change colour table from background image', values)
Publisher.sendMessage('Update slice viewer')

if sys.platform == 'linux2':
if sys.platform.startswith('linux'):
for i in self.pseudo_color_items:
it = self.pseudo_color_items[i]
if it.IsChecked():
Expand All @@ -241,7 +241,7 @@ def OnPopup(self, evt):
Publisher.sendMessage('Change colour table from background image from plist', values)
Publisher.sendMessage('Update slice viewer')

if sys.platform == 'linux2':
if sys.platform.startswith('linux'):
for i in self.pseudo_color_items:
it = self.pseudo_color_items[i]
if it.IsChecked():
Expand Down Expand Up @@ -273,7 +273,7 @@ def OnPopup(self, evt):
else:
self.cdialog.Show(self._gen_event)

if sys.platform == 'linux2':
if sys.platform.startswith('linux'):
for i in self.pseudo_color_items:
it = self.pseudo_color_items[i]
if it.IsChecked():
Expand Down
6 changes: 3 additions & 3 deletions invesalius/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def calculate_resizing_tofitmemory(x_size,y_size,n_slices,byte):
if ram_total>1400000000:
ram_total=1400000000

if (sys.platform == 'linux2'):
if sys.platform.startswith('linux'):
if (platform.architecture()[0] == '32bit'):
if ram_free>3500000000:
ram_free=3500000000
Expand Down Expand Up @@ -313,7 +313,7 @@ def predict_memory(nfiles, x, y, p):

return (x/porcent, y/porcent)

elif(sys.platform == 'linux2'):
elif sys.platform.startswith('linux'):

if (platform.architecture()[0] == '32bit'):
# 839000000 = 800 MB
Expand Down Expand Up @@ -461,4 +461,4 @@ def encode(text, encoding, *args):
try:
return text.encode(encoding, *args)
except AttributeError:
return text
return text
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import numpy

if sys.platform == 'linux2':
if sys.platform.startswith('linux'):
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = cythonize([ Extension("invesalius.data.mips", ["invesalius/data/mips.pyx"],
Expand Down

0 comments on commit 6b54118

Please sign in to comment.