Changeset 11765:1546cd04481b in orange


Ignore:
Timestamp:
11/14/13 15:43:58 (5 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fixed widget layouts.

Location:
Orange/OrangeWidgets
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeWidgets/Classify/OWCN2.py

    r11287 r11765  
    6565    callbackDeposit=[] 
    6666    def __init__(self, parent=None, signalManager=None): 
    67         OWWidget.__init__(self,parent,signalManager,"CN2", wantMainArea = 0, resizingEnabled = 0) 
     67        OWWidget.__init__(self, parent, signalManager,"CN2", 
     68                          wantMainArea=False, resizingEnabled=False) 
    6869 
    6970        self.inputs = [("Data", ExampleTable, self.dataset), ("Preprocess", PreprocessedLearner, self.setPreprocessor)] 
     
    104105        self.coveringAlgBG.buttons = [] 
    105106 
    106         """ 
    107         self.ruleQualityBG=OWGUI.radioButtonsInBox(self.ruleQualityGroup, self, "QualityButton", 
    108                             btnLabels=["Laplace","m-estimate","WRACC"], 
    109                             box="Rule quality", callback=self.qualityButtonPressed, 
    110                             tooltips=["Laplace rule evaluator", "m-estimate rule evaluator", 
    111                             "WRACC rule evaluator"]) 
    112         self.mSpin=Spin=OWGUI.spin(self.ruleQualityGroup, self, "m", 0, 100, label="m", 
    113                 orientation="horizontal", labelWidth=labelWidth-100, tooltip="m value for m estimate rule evaluator") 
    114         """ 
    115  
    116         b1 = QRadioButton("Laplace", self.ruleQualityBG); self.ruleQualityBG.layout().addWidget(b1) 
    117         g = OWGUI.widgetBox(self.ruleQualityBG, orientation = "horizontal"); 
     107        b1 = QRadioButton("Laplace", self.ruleQualityBG) 
     108        self.ruleQualityBG.layout().addWidget(b1) 
     109        g = OWGUI.widgetBox(self.ruleQualityBG, orientation="horizontal") 
    118110        b2 = QRadioButton("m-estimate", g) 
    119111        g.layout().addWidget(b2) 
     
    128120            self.connect(button, SIGNAL("clicked()"), lambda v=i: self.qualityButtonPressed(v)) 
    129121 
    130         OWGUI.doubleSpin(self.ruleValidationGroup, self, "Alpha", 0, 1,0.001, label="Alpha (vs. default rule)", 
    131                 orientation="horizontal", labelWidth=labelWidth, 
    132                 tooltip="Required significance of the difference between the class distribution on all example and covered examples") 
    133         OWGUI.doubleSpin(self.ruleValidationGroup, self, "stepAlpha", 0, 1,0.001, label="Stopping Alpha (vs. parent rule)", 
    134                 orientation="horizontal", labelWidth=labelWidth, 
    135                 tooltip="Required significance of each specialization of a rule.") 
    136         OWGUI.spin(self.ruleValidationGroup, self, "MinCoverage", 0, 100,label="Minimum coverage", 
    137                 orientation="horizontal", labelWidth=labelWidth, tooltip= 
    138                 "Minimum number of examples a rule must\ncover (use 0 for not setting the limit)") 
    139         OWGUI.checkWithSpin(self.ruleValidationGroup, self, "Maximal rule length", 0, 100, "useMaxRuleLength", "MaxRuleLength", labelWidth=labelWidth, 
    140                             tooltip="Maximal number of conditions in the left\npart of the rule (use 0 for don't care)") 
    141  
    142         """ 
    143         self.coveringAlgBG=OWGUI.radioButtonsInBox(self.coveringAlgGroup, self, "CoveringButton", 
    144                             btnLabels=["Exclusive covering ","Weighted Covering"], 
    145                             tooltips=["Each example will only be used once\n for the construction of a rule", 
    146                                       "Examples can take part in the construction\n of many rules(CN2-SD Algorithm)"], 
    147                             box="Covering algorithm", callback=self.coveringAlgButtonPressed) 
    148         self.weightSpin=OWGUI.doubleSpin(self.coveringAlgGroup, self, "Weight",0, 0.95,0.05,label= "Weight", 
    149                 orientation="horizontal", labelWidth=labelWidth, tooltip= 
    150                 "Multiplication constant by which the weight of\nthe example will be reduced") 
    151         """ 
    152  
    153         B1 = QRadioButton("Exclusive covering", self.coveringAlgBG); self.coveringAlgBG.layout().addWidget(B1) 
    154         g = OWGUI.widgetBox(self.coveringAlgBG, orientation = "horizontal") 
    155         B2 = QRadioButton("Weighted covering", g); g.layout().addWidget(B2) 
     122        form = QFormLayout( 
     123            labelAlignment=Qt.AlignLeft, formAlignment=Qt.AlignLeft, 
     124            fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow 
     125        ) 
     126 
     127        self.ruleValidationGroup.layout().addLayout(form) 
     128 
     129        alpha_spin = OWGUI.doubleSpin( 
     130            self.ruleValidationGroup, self, "Alpha", 0, 1, 0.001, 
     131            tooltip="Required significance of the difference between the " + 
     132                    "class distribution on all examples and covered examples") 
     133 
     134        step_alpha_spin = OWGUI.doubleSpin( 
     135            self.ruleValidationGroup, self, "stepAlpha", 0, 1, 0.001, 
     136            tooltip="Required significance of each specialization of a rule.") 
     137 
     138        min_coverage_spin = OWGUI.spin( 
     139            self.ruleValidationGroup, self, "MinCoverage", 0, 100, 
     140            tooltip="Minimum number of examples a rule must cover " + 
     141                    "(use 0 for not setting the limit)") 
     142 
     143        min_coverage_spin.setSpecialValueText("Unlimited") 
     144 
     145        # Check box needs to be in alayout for the form layout to center it 
     146        # in the vertical direction. 
     147        max_rule_box = OWGUI.widgetBox(self.ruleValidationGroup, "") 
     148        max_rule_cb = OWGUI.checkBox( 
     149            max_rule_box, self, "useMaxRuleLength", "Maximal rule length") 
     150 
     151        max_rule_spin = OWGUI.spin( 
     152            self.ruleValidationGroup, self, "MaxRuleLength", 0, 100, 
     153            tooltip="Maximal number of conditions in the left\n" + 
     154                    "part of the rule (use 0 for don't care)") 
     155        max_rule_spin.setSpecialValueText("Unlimited") 
     156        max_rule_cb.disables += [max_rule_spin] 
     157        max_rule_cb.makeConsistent() 
     158 
     159        form.addRow("Alpha (vs. default rule)", alpha_spin) 
     160        form.addRow("Stopping Alpha (vs. parent rule)", step_alpha_spin) 
     161        form.addRow("Minimum coverage", min_coverage_spin) 
     162        form.addRow(max_rule_box, max_rule_spin) 
     163 
     164        B1 = QRadioButton("Exclusive covering", self.coveringAlgBG) 
     165        self.coveringAlgBG.layout().addWidget(B1) 
     166        g = OWGUI.widgetBox(self.coveringAlgBG, orientation="horizontal") 
     167        B2 = QRadioButton("Weighted covering", g) 
     168        g.layout().addWidget(B2) 
    156169        self.coveringAlgBG.buttons = [B1, B2] 
    157170        self.weightSpin=OWGUI.doubleSpin(g,self,"Weight",0,0.95,0.05) 
  • Orange/OrangeWidgets/Classify/OWEnsemble.py

    r11096 r11765  
    2626     
    2727    def __init__(self, parent=None, signalManager=None, name="Ensemble"): 
    28         OWWidget.__init__(self, parent, signalManager, name, wantMainArea=False) 
     28        OWWidget.__init__(self, parent, signalManager, name, 
     29                          wantMainArea=False, resizingEnabled=False) 
    2930         
    3031        self.inputs = [("Learner", orange.Learner, self.setLearner), ("Data", ExampleTable, self.setData)] 
  • Orange/OrangeWidgets/Classify/OWLoadClassifier.py

    r11217 r11765  
    1616     
    1717    def __init__(self, parent=None, signalManager=None, name="Load Classifier"): 
    18         OWWidget.__init__(self, parent, signalManager, name, wantMainArea=False) 
     18        OWWidget.__init__(self, parent, signalManager, name, 
     19                          wantMainArea=False, resizingEnabled=False) 
    1920         
    2021        self.outputs = [("Classifier", orange.Classifier, Dynamic)] 
     
    3738                                         tooltip="Select a recent file",  
    3839                                         callback=self.onRecentSelection) 
    39          
     40        self.filesCombo.setMinimumWidth(200) 
     41 
    4042        self.browseButton = OWGUI.button(box, self, "...", callback=self.browse, 
    4143                                         tooltip = "Browse file system") 
  • Orange/OrangeWidgets/Classify/OWLogisticRegression.py

    r11096 r11765  
    5050        stepwiseCb = OWGUI.checkBox(box, self, "stepwiseLR", "Stepwise attribute selection") 
    5151        ibox = OWGUI.indentedBox(box, sep=OWGUI.checkButtonOffsetHint(stepwiseCb)) 
    52         addCritSpin = OWGUI.spin(ibox, self, "addCrit", 1, 50, label="Add threshold [%]", labelWidth=155, tooltip="Requested significance for adding an attribute") 
    53         remCritSpin = OWGUI.spin(ibox, self, "removeCrit", 1, 50, label="Remove threshold [%]", labelWidth=155, tooltip="Requested significance for removing an attribute") 
    54         limitAttSpin = OWGUI.checkWithSpin(ibox, self, "Limit number of attributes to ", 1, 100, "limitNumAttr", "numAttr", step=1, labelWidth=155, tooltip="Maximum number of attributes. Algorithm stops when it selects specified number of attributes.") 
    55         stepwiseCb.disables += [addCritSpin, remCritSpin, limitAttSpin] 
     52        form = QFormLayout( 
     53            spacing=8, fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow, 
     54            labelAlignment=Qt.AlignLeft, formAlignment=Qt.AlignLeft 
     55        ) 
     56        ibox.layout().addLayout(form) 
     57 
     58        addCritSpin = OWGUI.spin( 
     59            ibox, self, "addCrit", 1, 50, 
     60            tooltip="Requested significance for adding an attribute" 
     61        ) 
     62 
     63        addCritSpin.setSuffix(" %") 
     64 
     65        form.addRow("Add threshold", addCritSpin) 
     66 
     67        remCritSpin = OWGUI.spin( 
     68            ibox, self, "removeCrit", 1, 50, 
     69            tooltip="Requested significance for removing an attribute" 
     70        ) 
     71        remCritSpin.setSuffix(" %") 
     72 
     73        form.addRow("Remove threshold", remCritSpin) 
     74 
     75        # Need to wrap the check box in a layout to force vertical centering 
     76        limitBox = OWGUI.widgetBox(ibox, "") 
     77        limitCb = OWGUI.checkBox( 
     78            limitBox, self, "limitNumAttr", "Limit number of attributes to", 
     79        ) 
     80 
     81        limitAttSpin = OWGUI.spin( 
     82            ibox, self, "numAttr", 1, 100, 
     83            tooltip="Maximum number of attributes. Algorithm stops when it " + 
     84                    "selects specified number of attributes." 
     85        ) 
     86 
     87        limitCb.disables += [limitAttSpin] 
     88        limitCb.makeConsistent() 
     89 
     90        form.addRow(limitBox, limitAttSpin) 
     91 
     92        stepwiseCb.disables += [ibox] 
    5693        stepwiseCb.makeConsistent() 
    57          
     94 
    5895        OWGUI.separator(self.controlArea) 
    5996 
  • Orange/OrangeWidgets/Classify/OWNeuralNetwork.py

    r11560 r11765  
    22<name>Neural Network</name> 
    33<description>Neural network learner.</description> 
    4 <priority>20<priority> 
     4<priority>20</priority> 
    55<icon>icons/NeuralNetwork.svg</icon> 
    66 
     
    1919                 title="Neural Network"): 
    2020        OWWidget.__init__(self, parent, signalManager, title, 
    21                           wantMainArea=False) 
     21                          wantMainArea=False, resizingEnabled=False) 
    2222 
    2323        self.inputs = [("Data", Orange.data.Table, self.set_data), 
     
    4040        OWGUI.lineEdit(box, self, "name") 
    4141 
    42         box = OWGUI.widgetBox(self.controlArea, "Settings", addSpace=True) 
    43         OWGUI.spin(box, self, "n_mid", 2, 10000, 1, 
    44                    label="Hidden layer neurons", 
    45                    tooltip="Number of neurons in the hidden layer." 
    46                    ) 
     42        box = OWGUI.widgetBox(self.controlArea, "Settings", 
     43                              addSpace=True) 
    4744 
    48         OWGUI.doubleSpin(box, self, "reg_fact", 0.1, 10.0, 0.1, 
    49                          label="Regularization factor", 
    50                          ) 
     45        form = QFormLayout( 
     46            spacing=8, formAlignment=Qt.AlignLeft, labelAlignment=Qt.AlignLeft, 
     47            fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow 
     48        ) 
     49        box.layout().addLayout(form) 
    5150 
    52         OWGUI.spin(box, self, "max_iter", 100, 10000, 1, 
    53                    label="Max iterations", 
    54                    tooltip="Maximal number of optimization iterations." 
    55                    ) 
     51        form.addRow( 
     52            "Hidden layer neurons", 
     53            OWGUI.spin(box, self, "n_mid", 2, 10000, 1, 
     54                       tooltip="Number of neurons in the hidden layer.", 
     55                       addToLayout=False) 
     56        ) 
     57 
     58        form.addRow( 
     59            "Regularization factor", 
     60            OWGUI.doubleSpin(box, self, "reg_fact", 0.1, 10.0, 0.1, 
     61                             addToLayout=False) 
     62        ) 
     63 
     64        form.addRow( 
     65            "Max iterations", 
     66            OWGUI.spin(box, self, "max_iter", 100, 10000, 1, 
     67                       tooltip="Maximal number of optimization iterations.", 
     68                       addToLayout=False) 
     69        ) 
     70 
     71        OWGUI.checkBox(box, self, 'normalize', 'Normalize the data') 
    5672 
    5773        OWGUI.button(self.controlArea, self, "&Apply", 
    5874                     callback=self.apply, 
    5975                     tooltip="Create the learner and apply it on input data.", 
    60                      autoDefault=True 
    61                      ) 
    62  
    63         OWGUI.checkBox(box, self, 'normalize', 'Normalize the data') 
     76                     autoDefault=True) 
    6477 
    6578        self.data = None 
  • Orange/OrangeWidgets/Classify/OWSaveClassifier.py

    r11096 r11765  
    1515    settingsList = ["lastSaveFile", "filenameHistory"] 
    1616    def __init__(self, parent=None, signalManager=None, name="Save Classifier"): 
    17         OWWidget.__init__(self, parent, signalManager, name, wantMainArea=False) 
     17        OWWidget.__init__(self, parent, signalManager, name, 
     18                          wantMainArea=False, resizingEnabled=False) 
    1819         
    1920        self.inputs = [("Classifier", orange.Classifier, self.setClassifier)] 
     
    3637                                         tooltip="Select a recently saved file", 
    3738                                         callback=self.onRecentSelection) 
    38          
     39        self.filesCombo.setMinimumWidth(200) 
     40 
    3941        self.browseButton = OWGUI.button(box, self, "...", 
    4042                                         tooltip="Browse local file system", 
  • Orange/OrangeWidgets/Regression/OWLinearRegression.py

    r11096 r11765  
    2525                 title="Linear Regression"): 
    2626        OWWidget.__init__(self, parent, signalManager, title, 
    27                           wantMainArea=False) 
     27                          wantMainArea=False, resizingEnabled=False) 
    2828 
    2929        self.inputs = [("Data", Orange.data.Table, self.set_data), 
  • Orange/OrangeWidgets/Regression/OWMean.py

    r11096 r11765  
    1313class OWMean(OWMajority): 
    1414    def __init__(self, parent=None, signalManager=None, title="Mean"): 
    15         OWWidget.__init__(self, parent, signalManager, title, wantMainArea=False) 
     15        OWWidget.__init__(self, parent, signalManager, title, 
     16                          wantMainArea=False, resizingEnabled=False) 
    1617 
    1718        self.inputs = [("Data", ExampleTable, self.setData), 
  • Orange/OrangeWidgets/Regression/OWPLS.py

    r11380 r11765  
    2020     
    2121    def __init__(self, parent=None, signalManager=None, title="PLS Regression"): 
    22         OWWidget.__init__(self, parent, signalManager, title, wantMainArea=False) 
     22        OWWidget.__init__(self, parent, signalManager, title, 
     23                          wantMainArea=False, resizingEnabled=False) 
    2324         
    2425        self.inputs = [("Data", Orange.data.Table, self.set_data), 
  • Orange/OrangeWidgets/Regression/OWSVMRegression.py

    r11096 r11765  
    2121 
    2222    def __init__(self, parent=None, signalManager=None, title="SVM Regression"): 
    23         OWWidget.__init__(self, parent, signalManager, title, wantMainArea=False) 
     23        OWWidget.__init__(self, parent, signalManager, title, 
     24                          wantMainArea=False, resizingEnabled=False) 
    2425 
    2526        self.inputs=[("Data", Orange.data.Table, self.setData),  
  • Orange/OrangeWidgets/Unsupervised/OWDistanceFilter.py

    r9671 r11765  
    1717     
    1818    def __init__(self, parent=None, signalManager = None, name='Distance Matrix Filter'): 
    19         OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0) 
     19        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0) 
    2020         
    2121        self.inputs = [("Distances", orange.SymMatrix, self.setSymMatrix, Default), ("Data Subset", ExampleTable, self.setExampleSubset)] 
Note: See TracChangeset for help on using the changeset viewer.