Commits

Anonymous committed 6918475

More code cleaning (look and feel, corrections of types).

Comments (0)

Files changed (10)

orange/OrangeCanvas/orngCanvas.pyw

         self.menuOptions.insertItem( "&Rebuild Widget Registry",  self.menuItemRebuildWidgetRegistry)
         self.menuOptions.insertItem( "&Customize Shortcuts",  self.menuItemEditWidgetShortcuts)
         self.menuOptions.insertSeparator()
-        self.menuOptions.insertItem( "Canvas &Options...",  self.menuItemCanvasOptions)
+        if sys.platform == "darwin":
+            self.menuOptions.insertItem("&Preferences...", self.menuItemCanvasOptions)
+        else:
+            self.menuOptions.insertItem( "Canvas &Options...",  self.menuItemCanvasOptions)
 
         self.menuWindow = QPopupMenu( self )
         self.menuWindow.insertItem("&Cascade", self.workspace.cascade)

orange/OrangeCanvas/orngDlgs.py

     def __init__(self, canvasDlg, *args):
         apply(QDialog.__init__,(self,) + args)
         self.canvasDlg = canvasDlg
-        self.setCaption("Qt Canvas Options")
+        if sys.platform == "darwin":
+            self.setCaption("Qt Preferences")
+        else:
+            self.setCaption("Qt Canvas Options")
         #self.controlArea = QVBoxLayout (self)
         self.topLayout = QVBoxLayout( self, 10 )
         self.resize(500,450)
             hbox.layout().setSpacing(6)
             hbox.layout().setMargin(0)
         sep = QWidget(hbox)
-        sep.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, 0))
+        sep.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
 
         self.okButton = QPushButton("OK", hbox)
         self.cancelButton = QPushButton("Cancel", hbox)
             hbox.layout().setMargin(0)
 
         sep = QWidget(hbox)
-        sep.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, 0))
+        sep.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
 
         self.okButton = QPushButton("OK", hbox)
         self.okButton.setFixedWidth(110)

orange/OrangeCanvas/orngRegistry.py

         outputDir = os.path.join(applicationDir, "Orange")                  # directory for saving settings and stuff
     elif sys.platform == "darwin":
         applicationDir = os.path.join(user.home, "Library")
-        applicationDir = os.path.join(user.home, "Application Support")
+        applicationDir = os.path.join(applicationDir, "Application Support")
         outputDir = os.path.join(applicationDir, "Orange")
     else:
         outputDir = os.path.join(user.home, "Orange")                  # directory for saving settings and stuff
 
     registryFileName = os.path.join(outputDir, "widgetregistry.xml")
     if not os.path.exists(registryFileName):
-        WidgetsToXML().ParseWidgetRoot(widgetDir, canvasDir)
+        WidgetsToXML().ParseWidgetRoot(widgetDir, outputDir)
 
     return dict([(name, vars()[name]) for name in ["canvasDir", "orangeDir", "widgetDir", "reportsDir", "picsDir", "outputDir", "registryFileName"]])
 

orange/OrangeWidgets/Data/OWFile.py

 #
 
 from OWWidget import *
-import OWGUI, string, os.path
+import OWGUI, string, os.path, user, sys
 
 class OWSubFile(OWWidget):
     settingsList=["recentFiles"]
                 return
         else:
             if len(self.recentFiles) == 0 or self.recentFiles[0] == "(none)":
-                startfile="."
+                if sys.platform == "darwin":
+                    startfile = user.home
+                else:
+                    startfile="."
             else:
                 startfile=self.recentFiles[0]
 

orange/OrangeWidgets/Data/OWSave.py

 
 from OWWidget import *
 import OWGUI
-import re, os.path
+import re, os.path, user, sys
 from exceptions import Exception
 
 class OWSave(OWWidget):
         if self.recentFiles:
             startfile = self.recentFiles[0]
         else:
-            startfile = "."
+            if sys.platform == "darwin":
+                startfile = user.home
+            else:
+                startfile = "."
 
         dlg = QFileDialog(startfile,
                           'Tab-delimited files (*.tab)\nHeaderless tab-delimited (*.txt)\nComma separated (*.csv)\nC4.5 files (*.data)\nRetis files (*.rda *.rdo)\nAll files(*.*)', #\nAssistant files (*.dat)

orange/OrangeWidgets/OWBaseWidget.py

             if not os.path.exists(os.path.join(user.home, "Application Data")):
                 os.mkdir(os.path.join(user.home, "Application Data"))
             self.outputDir = os.path.join(os.path.join(user.home, "Application Data"), "Orange")                  # directory for saving settings and stuff
+        elif sys.platform == "darwin":
+            self.outputDir = os.path.join(user.home, "Library")
+            self.outputDir = os.path.join(self.outputDir, "Application Support")
+            self.outputDir = os.path.join(self.outputDir, "Orange")
         else:
             self.outputDir = os.path.join(user.home, "Orange")                  # directory for saving settings and stuff
         if not os.path.exists(self.outputDir):

orange/OrangeWidgets/OWWidget.py

         self._warningWidget, self._warningPixmap = self.createPixmapWidget(self.statusBarIconArea, self.widgetDir + "icons/triangle-orange.png")
         self._errorWidget, self._errorPixmap = self.createPixmapWidget(self.statusBarIconArea, self.widgetDir + "icons/triangle-red.png")
 ##        spacer = QWidget(self.statusBarIconArea)
-##        spacer.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, 0))
+##        spacer.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
 
         if wantStatusBar == 0:
             self.widgetStatusArea.hide()

orange/OrangeWidgets/OWkNNOptimization.py

 from OWBaseWidget import *
 from OWWidget import OWWidget
-import OWGUI, OWDlgs, OWGraphTools, numpy
+import OWGUI, OWDlgs, OWGraphTools, numpy, user, sys
 from OWGraph import *
 from orngVizRank import *
 from orngScaleData import getVariableValuesSorted
     def browseGeneFile(self):
         d = os.getcwd()
         if len(self.recentGeneSets) == 0 or self.recentGeneSets[0] == "(none)":
-            startfile = "."
+            if sys.platform == "darwin":
+                startfile = user.home
+            else:
+                startfile = "."
         else:
             startfile = self.recentGeneSets[0]
         filename = str(QFileDialog.getOpenFileName(startfile, 'Gene set files (*.gmt)\nAll files(*.*)', None,'Open Gene Set File'))

orange/OrangeWidgets/Prototypes/OWNetworkFile.py

 #
 
 from OWWidget import *
-import OWGUI, string, os.path
+import OWGUI, string, os.path, user, sys
 from orange import Graph
 #from OWGraphDrawer import *
 
     def browseFile(self, inDemos=0):
         "Display a FileDialog and select a file"
         if len(self.recentFiles) == 0 or self.recentFiles[0] == "(none)":
-            startfile="."
+            if sys.platform == "darwin":
+                startfile = user.home
+            else:
+                startfile="."
         else:
             startfile=self.recentFiles[0]
                 

orange/updateOrange.py

         if not os.path.exists(self.foldersIcon): self.foldersIcon = defaultIcon
         if not os.path.exists(self.optionsIcon): self.optionsIcon = defaultIcon
         
-        self.toolUpdate  = QToolButton(QPixmap(self.updateIcon), "Update" , QString.null, self.executeUpdate, self.toolbar, 'Update Files')
+        self.toolUpdate  = QToolButton(QIconSet(QPixmap(self.updateIcon)), "Update" , QString.null, self.executeUpdate, self.toolbar, 'Update Files')
         self.toolUpdate.setUsesTextLabel (1)
         self.toolbar.addSeparator()
-        self.toolFolders = QToolButton(QPixmap(self.foldersIcon), "Folders" , QString.null, self.showFolders, self.toolbar, 'Show folders that will be updated')
+        self.toolFolders = QToolButton(QIconSet(QPixmap(self.foldersIcon)), "Folders" , QString.null, self.showFolders, self.toolbar, 'Show folders that will be updated')
         self.toolFolders.setUsesTextLabel (1)
-        self.toolOptions = QToolButton(QPixmap(self.optionsIcon), "Options" , QString.null, self.showOptions, self.toolbar, 'Show update options')
+        self.toolOptions = QToolButton(QIconSet(QPixmap(self.optionsIcon)), "Options" , QString.null, self.showOptions, self.toolbar, 'Show update options')
         self.toolOptions.setUsesTextLabel (1)
         self.setIcon(QPixmap(self.updateIcon))