Changeset 3508:9a1ce332b1e1 in orange


Ignore:
Timestamp:
04/06/07 12:15:22 (7 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
2dc4ec3176e9d435abc034bcaeb0e409848e282e
Message:
  • fixed drawing icons of new categories
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeCanvas/orngTabs.py

    r3443 r3508  
    9191    def getFullIconName(self): 
    9292        name = self.getIconName() 
    93         if os.path.exists(os.path.join(self.canvasDlg.picsDir, name)): 
    94             return os.path.join(self.canvasDlg.picsDir, name) 
    95         elif os.path.exists(os.path.join(self.canvasDlg.widgetDir, name)): 
    96             return os.path.join(self.canvasDlg.widgetDir, name) 
    97         elif os.path.exists(name): 
    98             return name 
    99         else: 
    100             return self.canvasDlg.defaultPic 
     93        widgetDir = str(self.widgetTabs.widgetInfo[self.nameKey]["directory"])#os.path.split(self.getFileName())[0] 
     94         
     95        for paths in [(self.canvasDlg.picsDir, name), 
     96                      (self.canvasDlg.widgetDir, name), 
     97                      (name,), 
     98                      (widgetDir, name), 
     99                      (widgetDir, "icons", name)]: 
     100            fname = os.path.join(*paths) 
     101            if os.path.exists(fname): 
     102                return fname 
     103             
     104        return self.canvasDlg.defaultPic 
    101105         
    102106    def getIconName(self): 
     
    335339 
    336340        tab.builtIn = not category.hasAttribute("directory") 
     341        directory = not tab.builtIn and str(category.getAttribute("directory")) 
    337342         
    338343        priorityList = [] 
     
    387392        for i in range(len(priorityList)):             
    388393            button = WidgetButton(tab) 
    389             self.widgetInfo[strCategory + " - " + nameList[i]] = {"fileName": fileNameList[i], "iconName": iconNameList[i], "author" : authorList[i], "description":descriptionList[i], "priority":priorityList, "inputs": inputList[i], "outputs" : outputList[i], "button": button} 
     394            self.widgetInfo[strCategory + " - " + nameList[i]] = {"fileName": fileNameList[i], "iconName": iconNameList[i], "author" : authorList[i], "description":descriptionList[i], "priority":priorityList, "inputs": inputList[i], "outputs" : outputList[i], "button": button, "directory": directory} 
    390395            button.setValue(nameList[i], strCategory + " - " + nameList[i], self, self.canvasDlg, self.useLargeIcons) 
    391396            self.connect( button, SIGNAL( 'clicked()' ), button.clicked) 
Note: See TracChangeset for help on using the changeset viewer.