Ignore:
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • INSTALL.txt

    r11409 r10998  
    44 
    551. C++ tool-chain. Supported compilers are gcc (g++) for Linux and Mac OS X and Microsoft Visual 
    6 C++ on Windows (MinGW is not supported at this time). Clang also works for MAC OS. 
     6C++ on Windows (MinGW is not supported at this time). Clang also works for MAC OS, but see details below. 
    77[[BR]] 
    88 
     
    3939You will need to add the install dir to PYTHONSITEPACKAGES environment variable  
    4040(because Python needs to process Orange's .pth file) 
     41 
     42If clang is the default compiler it is necessary to add the `-Wno-address-of-temporary` 
     43flag to the CPPFLAGS environment variable before running setup.py: 
     44 
     45export CPPFLAGS=-Wno-address-of-temporary 
     46python setup.py build 
    4147 
    4248To install in development mode (http://packages.python.org/distribute/setuptools.html#development-mode) 
  • Orange/OrangeWidgets/Unsupervised/OWDistanceMap.py

    r11406 r11217  
    1515import OWColorPalette 
    1616import OWToolbars 
     17#from OWHierarchicalClustering import recursion_limit 
    1718 
    1819##################################################################### 
     
    305306 
    306307    def sendOutput(self): 
    307         items = getattr(self.matrix, "items", None) 
    308         if items is None or (not isinstance(items, orange.ExampleTable) and 
    309                              not all(isinstance(item, orange.Variable) 
    310                                      for item in items)): 
     308        if len(self.matrix.items)<1: 
    311309            return 
    312310 
     
    339337 
    340338            items = self.matrix.items 
    341             if all(isinstance(item, orange.Variable) for item in items): 
     339            if issubclass(orange.EnumVariable, type(items[0])): 
    342340                selected = orange.VarList() 
    343341                for i in selectedIndices: 
     
    345343                self.send("Features", selected) 
    346344 
    347             if all(isinstance(item, orange.Example) for item in items): 
     345 
     346            if isinstance(items[0], orange.Example): 
    348347                ex = [items[x] for x in selectedIndices] 
    349348                selected = orange.ExampleTable(items[0].domain, ex) 
     
    534533        if self.ShowLabels==1 and self.Merge<=1: 
    535534            # show labels, no merging (one item per line) 
    536             items = getattr(self.matrix, "items", range(self.matrix.dim)) 
    537             if isinstance(items, orange.ExampleTable): 
    538                 if any(ex.name for ex in items): 
    539                     # Use instance names if present 
    540                     items = [ex.name for ex in items] 
    541                 else: 
    542                     items = map(str, items) 
    543             elif isinstance(items, orange.VarList) or \ 
    544                     all(isinstance(item, orange.Variable) for item in items): 
    545                 items = [var.name for var in items] 
    546             else: 
    547                 items = map(str, items) 
    548  
     535            items = self.matrix.items 
    549536            if len(self.distanceMap.elementIndices)==0: 
    550537                tmp = [i for i in range(0, len(items))] 
     
    559546            maxHeight = 0 
    560547            maxWidth = 0 
    561  
     548            exampleTableHasNames = type(items) == orange.ExampleTable and any(ex.name for ex in items) 
    562549            for i in range(0, len(indices)): 
    563550                text = items[indices[i]] 
     551                 
     552                if type(text) not in [str, unicode]: 
     553                    if exampleTableHasNames or isinstance(text, orange.Variable):  
     554                        text = text.name 
     555                    else: 
     556                        text = repr(text) 
     557                         
    564558                if text != "": 
    565559                    tmpText = QCustomGraphicsText(text, self.scene, -90.0, font=fontcols) 
     
    722716            if self.ShowBalloon == 1: 
    723717 
    724                 items = getattr(self.matrix, "items", range(self.matrix.dim)) 
    725  
    726718                i = self.getItemFromPos(col) 
    727719                j = self.getItemFromPos(row) 
    728  
     720                 
    729721                head = str(self.matrix[i, j]) 
    730722 
    731                 if self.ShowItemsInBalloon == 1: 
    732                     namei, namej = items[i], items[j] 
    733                     if isinstance(namei, (orange.Example, orange.Variable)): 
     723                if (self.ShowItemsInBalloon == 1): 
     724                    namei, namej = self.matrix.items[i], self.matrix.items[j] 
     725                    if type(namei) not in [str, unicode]: 
    734726                        namei = namei.name 
    735                     else: 
    736                         namei = str(namei) 
    737                     if isinstance(namej, (orange.Example, orange.Variable)): 
     727                    if type(namej) not in [str, unicode]: 
    738728                        namej = namej.name 
    739                     else: 
    740                         namej = str(namej) 
    741729                    if namei or namej: 
    742730                        body = namei + "\n" + namej 
     
    806794    def sortRandom(self): 
    807795        import random 
    808         self.order = range(self.matrix.dim) 
     796        self.order = range(len(self.matrix.items)) 
    809797        random.shuffle(self.order) 
    810798        self.rootCluster = None 
  • Orange/OrangeWidgets/Unsupervised/OWMDS.py

    r11407 r11379  
    188188 
    189189        OWGUI.rubber(mds) 
    190         OWGUI.rubber(graph) 
    191190 
    192191        infoBox = OWGUI.widgetBox(mds, "Info") 
     
    210209        self.data = data = None 
    211210        if matrix: 
    212             self.data = data = getattr(matrix, "items", range(matrix.dim)) 
     211            self.data = data = getattr(matrix, "items") 
    213212            matrix.matrixType = orange.SymMatrix.Symmetric 
    214213 
     
    223222        elif isinstance(data, orange.VarList): 
    224223            self.setVarList(data) 
    225         elif data is not None: 
    226             self.setList(data) 
    227224 
    228225        if matrix: 
     
    378375        except Exception, val: 
    379376            print val 
    380  
    381     def setList(self, data): 
    382         self.colorCombo.clear() 
    383         self.sizeCombo.clear() 
    384         self.shapeCombo.clear() 
    385         self.nameCombo.clear() 
    386  
    387         for name in ["No name", "Item string"]: 
    388             self.nameCombo.addItem(name) 
    389  
    390         self.colors = [[Qt.black] for i in range(len(data))] 
    391         self.shapes = [[QwtSymbol.Ellipse] for i in range(len(data))] 
    392         self.sizes = [[5] for i in range(len(data))] 
    393         self.selectedInput = [False] * len(data) 
    394  
    395         self.names = [("", str(item)) for item in data] 
    396377 
    397378    def updateStressBySize(self, noRepaint=False): 
  • Orange/ensemble/forest.py

    r11403 r10967  
    250250              :class:`Orange.statistics.Distribution` or a tuple with both 
    251251        """ 
    252         instance = Orange.data.Instance(self.domain, instance) 
     252 
    253253        # get results to avoid multiple calls 
    254254        res_both = [c(instance, orange.GetBoth) for c in self.classifiers] 
  • Orange/utils/environ.py

    r11410 r11085  
    206206     
    207207    parser = ConfigParser.SafeConfigParser(defaults) 
    208     global_cfg = os.path.join(defaults["install_dir"], "orng", "orangerc.cfg") 
    209  
     208    global_cfg = os.path.join(defaults["install_dir"], "orangerc.cfg") 
    210209    if not parser.read([global_cfg]): 
    211210        pass 
  • docs/extend-widgets/rst/basics.rst

    r11408 r11050  
    110110set with 10% of the data instances. Not to mess with other widgets, we 
    111111will create a Test directory within OrangeWidgets directory, and write 
    112 the widget in a file called `OWDataSamplerA.py`: OW for Orange Widget, 
     112the widget in a file called `OWDataSamplerA <OWDataSamplerA.py>`: OW for Orange Widget, 
    113113DataSampler since this is what widget will be doing, and A since we 
    114114prototype a number of this widgets in our tutorial. 
     
    223223output channel. 
    224224 
    225 .. 
    226    Although our widget is now ready to test, for a final touch, let's 
    227    design an icon for our widget. As specified in the widget header, we 
    228    will call it :download:`DataSamplerA.png <DataSamplerA.png>` and will 
    229    put it in icons subdirectory of OrangeWidgets directory (together with 
    230    all other icons of other widgets). 
     225Although our widget is now ready to test, for a final touch, let's 
     226design an icon for our widget. As specified in the widget header, we 
     227will call it `DataSamplerA.png <DataSamplerA.png>`_ and will 
     228put it in icons subdirectory of OrangeWidgets directory (together with 
     229all other icons of other widgets). 
    231230 
    232231For a test, we now open Orange Canvas. There should be a new pane in a 
  • docs/extend-widgets/rst/channels.rst

    r11408 r11050  
    5151 
    5252    self.inputs = [("Data", ExampleTable, self.dataset), 
    53                    ("Learner", orange.Learner, self.learner, Multiple + Default)] 
     53               ("Learner", orange.Learner, self.learner, Multiple)] 
    5454 
    5555Notice that everything is pretty much the same as it was with 
     
    6363channel for its type (more on default channels later). 
    6464 
    65 .. note:: :obj:`Default` flag here is used for illustration. Since *Learner* 
    66           channel is the only channel for a :class:`orange.Learner` type 
    67           it is also the default. 
    68  
    6965How does the widget know from which widget did the token come from? 
    7066In Orange, tokens are sent around with an id of a widget that is 
    71 sending the token, and having a multi-input channel only tells Orange to 
     67sending the token (essentially, with a pointer to the corresponding 
     68widget object), and having a multi-input channel only tells Orange to 
    7269send a token together with sending widget id, the two arguments with 
    7370which the receiving function is called. For our :obj:`Learner` 
     
    149146all that is needed is the augmenting the list :: 
    150147 
    151     self.scoring = [("Classification Accuracy", orngStat.CA), 
    152                     ("AUC", orngStat.AUC), 
    153                     ("BrierScore", orngStat.BrierScore), 
    154                     ("Information Score", orngStat.IS), 
    155                     ("Sensitivity", orngStat.sens), 
    156                     ("Specificity", orngStat.spec)] 
     148    self.scoring = [("Classification Accuracy", orngStat.CA),\ 
     149                ("AUC", orngStat.AUC), \ 
     150                ("BrierScore", orngStat.BrierScore),\ 
     151                ("Information Score", orngStat.IS),\ 
     152                ("Sensitivity", orngStat.sens), \ 
     153                ("Specificity", orngStat.spec)] 
    157154 
    158155which is defined in the initialization part of the widget. The 
     
    163160essentially means that switching from one to another scoring function 
    164161(and displaying the result in the table) takes only a split of a 
    165 second. To see the rest of the widget, check out 
    166 :download:`its code <OWLearningCurveA.py>`. 
     162second. To see the rest of the widget, check out `its code <OWLearningCurveA.py>`_. 
    167163 
    168164***************************** 
     
    180176    self.outputs = [("Sampled Data", ExampleTable), ("Other Data", ExampleTable)] 
    181177 
    182 We used this in the third incarnation of :download:`data sampler widget <OWDataSamplerC.py>`, 
     178We used this in the third incarnation of `data sampler widget <OWDataSamplerC.py>`_, 
    183179with essentially the only other change in the code in the :obj:`selection` and 
    184180:obj:`commit` functions:: 
     
    225221When enlisting the input channel of the same type, the non-default 
    226222channels have a special flag in the channel specification list. So for 
    227 our new :download:`learning curve <OWLearningCurveB.py>` widget, the 
     223our new `learning curve <OWLearningCurveB.py>`_ widget, the 
    228224channel specification is:: 
    229225 
    230226    self.inputs = [("Train Data", ExampleTable, self.trainset, Default), 
    231                    ("Test Data", ExampleTable, self.testset), 
    232                    ("Learner", orange.Learner, self.learner, Multiple)] 
     227               ("Test Data", ExampleTable, self.testset), 
     228               ("Learner", orange.Learner, self.learner, Multiple)] 
    233229 
    234230That is, the :obj:`Train Data` channel is a single-token 
    235231channel which is a default one (third parameter). Note that the flags can 
    236 be added (or OR-d) together so :obj:`Default + Multiple` is a valid flag. 
     232be added (or OR-d) together so :obj:`Default + Multi` is a valid flag. 
    237233To test how this works, connect a file widget to a learning curve widget and 
    238234- nothing will really happen: 
  • docs/extend-widgets/rst/contextsettings.rst

    r11408 r11049  
    33########################## 
    44 
    5 You have already learned about :doc:`storing widget settings <settings>`. 
     5You have already learned about :obj:`storing widget settings <settings>`. 
    66But there's more: some settings are context 
    77dependent. Open Orange Canvas and observe the scatter plot - feed it 
     
    3131Here's the widget's :obj:`__init__` function. 
    3232 
    33 Part of :download:`OWAttributeSampler.py <OWAttributeSampler.py>`:: 
     33Part of `OWAttributeSampler.py <OWAttributeSampler.py>`_:: 
    3434 
    3535    def __init__(self, parent=None, signalManager=None): 
     
    6666called. 
    6767 
    68 Part of :download:`OWAttributeSampler.py`:: 
     68Part of `OWAttributeSampler.py <OWAttributeSampler.py>`_:: 
    6969 
    7070    def dataset(self, data): 
     
    168168                         selected="selectedAttributes")])} 
    169169 
     170(More about these shortcuts in the `technical information about settings <settings-technical.htm>`). 
     171 
    170172Why the dictionary and the empty string as the key? A widget can 
    171173have multiple contexts, depending, usually, on multiple input 
     
    186188function :obj:`dataset` 
    187189 
    188 Part of :download:`OWAttributeSampler.py`:: 
     190Part of `OWAttributeSampler.py <OWAttributeSampler.py>`:: 
    189191 
    190192    def dataset(self, data): 
     
    264266store is picklable and short enough, so you won't blow up the .ini 
    265267files that store these settings. 
     268 
     269For more information about context handling, see the `technical information about 
     270settings <settings-technical.htm>`_. 
  • docs/extend-widgets/rst/graphing.rst

    r11408 r11049  
    9696axis plot using the same color. Developers are thus advised to use 
    9797:obj:`ColorPaletteHSV`, which is provided as a method within 
    98 :mod:`OWWidget` module. :obj:`ColorPaletteHSV` takes an 
     98:obj:`OWWidget` class. :obj:`ColorPaletteHSV` takes an 
    9999integer as an attribute, and returns a list of corresponding number of 
    100100colors. In our learning curve widget, we use it within a function that 
     
    121121 
    122122    self.cbox = OWGUI.widgetBox(self.controlArea, "Learners") 
    123     self.llb = OWGUI.listBox(self.cbox, self, "selectedLearners", 
    124                              selectionMode=QListWidget.MultiSelection, 
    125                              callback=self.learnerSelectionChanged) 
     123    self.llb = OWGUI.listBox(self.cbox, self, "selectedLearners", selectionMode=QListWidget.MultiSelection, callback=self.learnerSelectionChanged) 
    126124 
    127125    self.llb.setMinimumHeight(50) 
     
    144142 
    145143    def learnerSelectionChanged(self): 
    146         if self.blockSelectionChanges: 
    147             return 
     144        if self.blockSelectionChanges: return 
    148145        for (i,lt) in enumerate(self.learners): 
    149146            l = lt[1] 
     
    156153            l.isSelected = i in self.selectedLearners 
    157154 
    158 The complete code of this widget is available :download:`here <OWLearningCurveC.py>`.  
     155The complete code of this widget is available `here <OWLearningCurveC.py>`_.  
    159156This is almost like a typical 
    160157widget that is include in a standard Orange distribution, with a 
  • docs/extend-widgets/rst/index.rst

    r11408 r11049  
    1717   plots 
    1818   contextsettings 
     19 
     20`Code and icons <code.zip>`_ from the tutorial. To learn where to put Python 
     21files and icons, read :doc:`Getting Started <basics>`. 
    1922 
    2023 
  • docs/extend-widgets/rst/owgui.rst

    r11408 r11049  
    1111synchronized with a Python object's attribute (which, by the way, gets 
    1212automatically saved and retrieved when the widgets is closed and reopened), 
    13 attaches a callback function to the control, make it disable or enable other 
    14 controls... 
     13attaches a callback function to the control, make it disable or enable other controls... 
    1514 
    1615***************** 
     
    2322presented here will only be described in cases where they have a different meaning. 
    2423 
    25 `widget` (required) 
    26    Widget on which control will be drawn - can be widget's :obj:`controlArea` 
    27    or another box. 
    28  
    29 `master` (required) 
    30    Object which includes an attribute that are used to store control's 
    31    state, most often the object which called the function that 
    32    initialized the control. 
    33  
    34 `value` (required) 
    35    String with the name of the master's attribute that synchronizes with the 
    36    state of the control (and vice-versa - when this attribute is changed, the control changes as well). This attribute should usually be also included the master's :obj:`settingsList`, so that it is automatically saved and retrieved. 
    37  
    38 `box` (default: None) 
    39    Indicates if there should be a box that is drawn around the control. If `box` is ``None``, no box is drawn; if it is a string, it is also used as box's name. If `box` is any other true value (such as ``True`` :), an unlabeled box is drawn. 
    40  
    41 `callback` (default: None) 
    42    A function to be called when the state of the control is changed. Can 
    43    include a single function, or a list of functions that will be called in 
    44    the order provided. If callback function changes the value of the controlled 
    45    attribute (the one given as the `value` argument described above) it may 
    46    trigger a cycle 
    47  
    48    .. 
    49       ; a simple trick to avoid this is shown in the description 
    50       of :func:`listBox` function. 
    51  
    52 `tooltip` (default: None) 
    53    A string that is displayed in a tooltip that appears when mouse is over the control. 
    54  
    55 `label` (default: None) 
    56    A string that is displayed as control's label. 
    57  
    58 `labelWidth` (default: None) 
    59    Sets the label's width. This is useful for aligning the controls. 
    60  
    61 `orientation` (default: "vertical") 
    62    When label is used, determines the relative placement of the label and the control. Label can be above the control, "vertical", or in the same line with control, "horizontal". Instead of "vertical" and "horizontal" you can also use ``True`` and ``False`` or 1 and 0, respectively. (Remember this as "vertical" being the usual order of controls in the widgets, so vertical is "true".) 
    63  
    64 `disabled` (default: False) 
    65    Tells whether the control be disabled upon the initialization. 
    66  
    67 `addSpace` (default: False) 
    68    If true, a space of 8 pixels is added after the widget by calling :func:`separator`. `addSpace` can also be an integer specifying the height of the added space. 
     24widget (required) 
     25Widget on which control will be drawn - can be widget's :obj:`controlArea` or another box. 
     26 
     27master (required) 
     28Object which includes an attribute that are used to store control's 
     29state, most often the object which called the function that 
     30initialized the control. 
     31 
     32value (required) 
     33String with the name of the master's attribute that synchronizes with the 
     34state of the control (and vice-versa - when this attribute is changed, the control changes as well). This attribute should usually be also included the master's :obj:`settingsList`, so that it is automatically saved and retrieved. 
     35 
     36box (default: None) 
     37Indicates if there should be a box that is drawn around the control. If :obj:`box` is :obj:`None`, no box is drawn; if it is a string, it is also used as box's name. If :obj:`box` is any other true value (such as :obj:`True` :), an unlabeled box is drawn. 
     38 
     39callback (default: None) 
     40A function to be called when the state of the control is changed. Can include a single function, or a list of functions that will be called in the order provided. If callback function changes the value of the controlled attribute (the one given as the :obj:`value` argument described above) it may trigger a cycle; a simple trick to avoid this is shown in the description of <a href="#listBox">listBox function</a>. 
     41 
     42tooltip (default: None) 
     43A string that is displayed in a tooltip that appears when mouse is over the control. 
     44 
     45label (default: None) 
     46A string that is displayed as control's label. 
     47 
     48labelWidth (default: None) 
     49Sets the label's width. This is useful for aligning the controls. 
     50 
     51orientation (default: "vertical") 
     52When label is used, determines the relative placement of the label and the control. Label can be above the control, "vertical", or in the same line with control, "horizontal". Instead of "vertical" and "horizontal" you can also use :obj:`True` and :obj:`False` or 1 and 0, respectively. (Remember this as "vertical" being the usual order of controls in the widgets, so vertical is "true".) 
     53 
     54disabled (default: False) 
     55Tells whether the control be disabled upon the initialization. 
     56 
     57addSpace (default: False) 
     58If true, a space of 8 pixels is added after the widget by calling :obj:`OWGUI.separator`. :obj:`addSpace` can also be an integer specifying the height of the added space. 
    6959 
    7060 
     
    8575and synchronization with the designated widget's attribute. 
    8676 
    87 .. function:: checkBox(widget, master, value, label[, box, tooltip, callback, disabled, labelWidth, disables]) 
    88  
    89    `disables` (default: []) 
    90       If the check box needs to disable some other controls they can be given in list  `disables`, e.g. ``disables=[someOtherCheckBox, someLineEdit]``. If the other control should be disabled when the checkbox is checked, do it like this: ``disables=[someOtherCheckBox, (-1, someLineEdit)]`` - now `someOtherCheckBox` will be enabled when this check box is checked, while `someLineEdit` will be enabled when the check box is unchecked. 
    91  
    92    `labelWidth` (default: None) 
    93       `labelWidth` can be used to align this widget with others. 
     77checkBox(widget, master, value, label[, box, tooltip, callback, disabled, labelWidth, disables]) 
     78 
     79disables (default: []) 
     80If the check box needs to disable some other controls they can be given in list  :obj:`disables`, e.g. :obj:`disables=[someOtherCheckBox, someLineEdit]`. If the other control should be disabled when the checkbox is checked, do it like this: :obj:`disables=[someOtherCheckBox, (-1, someLineEdit)]` - now :obj:`someOtherCheckBox` will be enabled when this check box is checked, while :obj:`someLineEdit` will be enabled when the check box is unchecked. 
     81 
     82labelWidth (default: None) 
     83:obj:`labelWidth` can be used to align this widget with others. 
    9484 
    9585 
     
    9989Edit box, a wrapper around QLineEdit. 
    10090 
    101 .. function:: lineEdit(widget, master, value[, label, labelWidth, orientation, box, tooltip, callback, valueType, validator, controlWidth]) 
    102  
    103    `valueType` (default: str) 
    104       A type into which the value is cast. 
    105  
    106    `validator` (default: None) 
    107       A standard Qt validator that can be associated with the control. 
     91lineEdit(widget, master, value[, label, labelWidth, orientation, box, tooltip, callback, valueType, validator, controlWidth]) 
     92 
     93 
     94valueType (default: str) 
     95A type into which the value is cast. 
     96 
     97validator (default: None) 
     98A standard Qt validator that can be associated with the control. 
    10899 
    109100 
     
    114105and its callback in a single line. 
    115106 
    116 .. function:: button(widget, master, label[, callback, disabled, tooltip]) 
     107button(widget, master, label[, callback, disabled, tooltip]) 
    117108 
    118109 
     
    120111************* 
    121112 
    122 OWGUI can create an individual radio button or a box of radio buttons or an 
    123 individual radio button. 
     113OWGUI can create an individual radio button or a box of radio buttons or an individual radio button. 
    124114 
    125115An individual radio button is created by :obj:`radioButton`. 
    126116 
    127 .. function:: radioButton(widget, master, value, label[, box, tooltip, callback, addSpace]) 
    128  
    129    The function provides the usual capabilities of OWGUI controls. It is though  
    130    your responsibility to put it in something like a :obj:`QVButtonGroup`. 
     117radioButton(widget, master, value, label[, box, tooltip, callback, addSpace]) 
     118 
     119The function provides the usual capabilities of OWGUI controls. It is though  
     120your responsibility to put it in something like a :obj:`QVButtonGroup`. 
    131121 
    132122A box of radio buttons is created by function :obj:`radioButtonsInBox`. 
    133123 
    134 .. function:: radioButtonsInBox(widget, master, value, btnLabels[, box, tooltips, callback) 
    135  
    136    `value` (required) 
    137       Synchronized with the index of the selected radio button. 
    138  
    139    `btnLabels` (required) 
    140       A list with labels for radio buttons. Labels can be strings or pixmaps. 
    141  
    142    `tooltips` (default: None) 
    143       A list of tooltips, one for each button. 
     124 
     125radioButtonsInBox(widget, master, value, btnLabels[, box, tooltips, callback) 
     126 
     127value (required) 
     128Synchronized with the index of the selected radio button. 
     129 
     130btnLabels (required) 
     131A list with labels for radio buttons. Labels can be strings or pixmaps. 
     132 
     133tooltips (default: None) 
     134A list of tooltips, one for each button. 
    144135 
    145136 
     
    149140A wrapper around QComboBox. 
    150141 
    151 .. function:: comboBox(widget, master, value[, box, label, labelWidth, orientation, items, tooltip, callback, sendSelectedValue, valueType, control2attributeDict, emptyString]) 
    152  
    153    `items` (default: []) 
    154       A list of combo box's items. Unlike most OWGUI, `items` have one Orange-specific quirk: its element can be either a string, in which case it is used as a label, or a tuple, where the first element is a label name and the last is the attribute type which is used to create an icon. Most attribute lists in Orange Widgets are constructed this way. 
    155  
    156    `sendSelectedValue` (default: 0) 
    157       If false, attribute `value` will be assigned the index of the selected item. Otherwise, it is assigned the currently selected item's label. 
    158  
    159    `control2attributeDict` (default: {}) 
    160       A dictionary for translating the item's label into `value`. It is used only is `sendSelectedValue` is true, and even then a label is translated only if an item with such a key is found in the dictionary; otherwise, label is written to `value` as it is.  
    161  
    162    `emptyString` (default: "") 
    163       Tells which combo box's item corresponds to an empty `value`. This is typically used when combo box's labels are attribute names and an item "(none)", which allows user to select no attribute. If we give ``emptyString="(none)"``, `value` will be an empty string when the user selects "(none)". This is equivalent to specifying ``control2attributeDict={"(none)": ""}`` (and is actually implemented like that), but far more convenient. 
    164  
    165    `valueType` (default: str or unicode) 
    166       A function through which the currently selected item's label is converted prior to looking into `control2attributeDict`. Needed to convert Qt's QString. 
     142comboBox(widget, master, value[, box, label, labelWidth, orientation, items, tooltip, callback, sendSelectedValue, valueType, control2attributeDict, emptyString]) 
     143 
     144<dl class="attributes"> 
     145items (default: []) 
     146A list of combo box's items. Unlike most OWGUI, :obj:`items` have one Orange-specific quirk: its element can be either a string, in which case it is used as a label, or a tuple, where the first element is a label name and the last is the attribute type which is used to create an icon. Most attribute lists in Orange Widgets are constructed this way. 
     147 
     148sendSelectedValue (default: 0) 
     149If false, attribute :obj:`value` will be assigned the index of the selected item. Otherwise, it is assigned the currently selected item's label. 
     150 
     151control2attributeDict (default: {}) 
     152A dictionary for translating the item's label into :obj:`value`. It is used only is :obj:`sendSelectedValue` is true, and even then a label is translated only if an item with such a key is found in the dictionary; otherwise, label is written to :obj:`value` as it is.  
     153 
     154emptyString (default: "") 
     155Tells which combo box's item corresponds to an empty :obj:`value`. This is typically used when combo box's labels are attribute names and an item "(none)", which allows user to select no attribute. If we give :obj:`emptyString="(none)"`, :obj:`value` will be an empty string when the user selects "(none)". This is equivalent to specifying :obj:`control2attributeDict = {"(none)": ""}` (and is actually implemented like that), but far more convenient. 
     156 
     157valueType (default: str or unicode) 
     158A function through which the currently selected item's label is converted prior to looking into :obj:`control2attributeDict`. Needed to convert Qt's QString. 
    167159 
    168160 
     
    174166 
    175167 
    176 .. function:: listBox(widget, master, value, labels[, box, tooltip, callback, selectionMode]) 
    177  
    178    `value` (required) 
    179       The name of master's attribute containing indices of all selected values. 
    180  
    181    `labels` (required) 
    182       The name of master's attribute containing the list box's labels. Similar to `items` in combo box, list `labels` have one Orange-specific quirk: its element can be either a string, in which case it is used as a label, or a tuple, where the first element is a label name and the second can be either an icon on an integer, representing the attribute type which is used to create an icon. Most attribute lists in Orange Widgets are constructed this way. 
    183  
    184    `selectionMode` (default: QListWidget.SingleSelection) 
    185       Tells whether the user can select a single item (:obj:`QListWidget.SingleSelection`), multiple items (:obj:`QListWidget.MultiSelection`, :obj:`QListWidget.ExtendedSelection`) or nothing (:obj:`QListWidget.NoSelection`). 
    186  
    187    `value` is automatically cast to :obj:`OWGUI.ControlledList` (this is needed because the list should report any changes to the control, the list box; :obj:`OWGUI.ControlledList` is like an ordinary Python :obj:`list` except that it triggers synchronization with the list box at every change). 
    188  
    189    `labels` is only partially synchronized with the list box: if a new list is assigning to `labels` attribute, the list will change. If elements of the existing list are changed or added, the list box won't budge. You should never change the list, but always assign a new list (or reassign the same after it's changed). If the labels are stored in ``self.listLabels`` and you write ``self.listLabels[1]="a new label"``, the list box won't change. To trigger the synchronization, you should continue by ``self.listLabels = self.listLabels``. This may seem awkward, but by our experience a list of selected items is seldom changed changed "per-item", so we were too lazy to write the annoyingly complex backward callbacks. 
    190  
     168listBox(widget, master, value, labels[, box, tooltip, callback, selectionMode]) 
     169 
     170<dl class="attributes"> 
     171value (required) 
     172The name of master's attribute containing indices of all selected values. 
     173 
     174labels (required) 
     175The name of master's attribute containing the list box's labels. Similar to :obj:`items` in combo box, list :obj:`labels` have one Orange-specific quirk: its element can be either a string, in which case it is used as a label, or a tuple, where the first element is a label name and the second can be either an icon on an integer, representing the attribute type which is used to create an icon. Most attribute lists in Orange Widgets are constructed this way. 
     176 
     177selectionMode (default: QListWidget.SingleSelection) 
     178Tells whether the user can select a single item (:obj:`QListWidget.SingleSelection`), multiple items (:obj:`QListWidget.MultiSelection`, :obj:`QListWidget.ExtendedSelection`) or nothing (:obj:`QListWidget.NoSelection`). 
     179 
     180 
     181:obj:`value` is automatically cast to :obj:`OWGUI.ControlledList` (this is needed because the list should report any changes to the control, the list box; :obj:`OWGUI.ControlledList` is like an ordinary Python :obj:`list` except that it triggers synchronization with the list box at every change). 
     182 
     183:obj:`labels` is only partially synchronized with the list box: if a new list is assigning to :obj:`labels` attribute, the list will change. If elements of the existing list are changed or added, the list box won't budge. You should never change the list, but always assign a new list (or reassign the same after it's changed). If the labels are stored in :obj:`self.listLabels` and you write :obj:`self.listLabels[1]="a new label"`, the list box won't change. To trigger the synchronization, you should continue by :obj:`self.listLabels = self.listLabels`. This may seem awkward, but by our experience a list of selected items is seldom changed changed "per-item", so we were too lazy to write the annoyingly complex backward callbacks. 
     184 
     185<span> 
     186<span onclick="toggleVisibility(this);" class="hideshow">Show Example</span> 
     187<span class="hideshow"><a href="gui_listbox.py">Download example (gui_listbox.py)</a></span> 
     188<span class="hideshow"><a href="gui_listbox_attr.py">Download example (gui_listbox_attr.py)</a></span> 
    191189 
    192190 
     
    196194Spin control, a wrapper around QSpinBox. 
    197195 
    198 .. function:: spin(widget, master, value, min, max[, step, box, label, labelWidth, orientation, tooltip, callback, controlWidth]) 
    199  
    200    `min`, `max`, `step=1` 
    201       Minimal and maximal value, and step. 
     196spin(widget, master, value, min, max[, step, box, label, labelWidth, orientation, tooltip, callback, controlWidth]) 
     197 
     198 
     199min, max, step=1 
     200Minimal and maximal value, and step. 
    202201 
    203202 
     
    207206A wrapper around QSlider that allows user setting a numerical value between the given bounds. 
    208207 
    209 .. function:: hSlider(widget, master, value[, box, minValue, maxValue, step, callback, labelFormat, ticks, divideFactor]) 
    210  
    211  
    212    `minValue` (default: 0), `maxValue` (default: 10), `step` (default: 1) 
    213       Minimal and maximal value for the spin control, and its step. 
    214  
    215    `ticks` (default: 0) 
    216       If non-zero, it gives the interval between two ticks. The ticks will appear below the groove. 
    217  
    218    `labelFormat` (default: " %d") 
    219       Defines the look of the label on the righthand side of the slider. It has to contain one format character (like %d in the default), but can contain other text as well. 
    220  
    221    `divideFactor` (default: 1.0) 
    222       The value printed in the label is divided by `divideFactor`. 
     208hSlider(widget, master, value[, box, minValue, maxValue, step, callback, labelFormat, ticks, divideFactor]) 
     209 
     210 
     211minValue (default: 0), maxValue (default: 10), step (default: 1) 
     212Minimal and maximal value for the spin control, and its step. 
     213 
     214ticks (default: 0) 
     215If non-zero, it gives the interval between two ticks. The ticks will appear below the groove. 
     216 
     217labelFormat (default: " %d") 
     218Defines the look of the label on the righthand side of the slider. It has to contain one format character (like %d in the default), but can contain other text as well. 
     219 
     220divideFactor (default: 1.0) 
     221The value printed in the label is divided by :obj:`divideFactor`. 
     222 
     223 
     224For an example of usage, see the second example in the description of <a href="#labels-example">labels</a>. 
    223225 
    224226 
     
    229231OWGUI.checkBox and OWGUI.spin. 
    230232 
    231 .. function:: checkWithSpin(widget, master, label, min, max, checked, value[, posttext, step, tooltip, checkCallback, spinCallback, labelWidth]) 
    232  
    233    `min`, `max`, `step` (required) 
    234       Minimal and maximal value for the spin control, and its step. 
    235  
    236    `checked` (required) 
    237       Master's attribute that is synchronized with the state of the check box. 
    238  
    239    `value` (required) 
    240       The attribute that is synchronized with the spin. 
    241  
    242    `posttext` (default: None) 
    243       Text which appears on the right-hand side of the control. 
    244  
    245    `checkCallback` (default: None), `spinCallback` (default: None) 
    246       Function that are called when the state of the check box or spin changes. 
     233checkWithSpin(widget, master, label, min, max, checked, value[, posttext, step, tooltip, checkCallback, spinCallback, labelWidth]) 
     234 
     235min, max, step (required) 
     236Minimal and maximal value for the spin control, and its step. 
     237 
     238checked (required) 
     239Master's attribute that is synchronized with the state of the check box. 
     240 
     241value (required) 
     242The attribute that is synchronized with the spin. 
     243 
     244posttext (default: None) 
     245Text which appears on the right-hand side of the control. 
     246 
     247checkCallback (default: None), spinCallback (default: None) 
     248Function that are called when the state of the check box or spin changes. 
    247249 
    248250 
     
    250252****** 
    251253 
    252 There are two functions for constructing labels. The first is a simple wrapper around QLabel which differs only in allowing to specify a fixed width without needing an extra line. Note that unlike most other OWGUI widgets, this one does not have the argument `master`. 
    253  
    254 .. function:: widgetLabel(widget, label[, labelWidth]) 
    255  
    256    The second is a label which can synchronize with values of master widget's attributes. 
    257  
    258 .. function:: label(widget, master, label[, labelWidth]) 
    259  
    260    `label` 
    261       `label` is a format string following Python's syntax (see the 
    262       corresponding Python documentation): the label's content is rendered as 
    263       ``label % master.__dict__``. 
     254There are two functions for constructing labels. The first is a simple wrapper around QLabel which differs only in allowing to specify a fixed width without needing an extra line. Note that unlike most other OWGUI widgets, this one does not have the argument :obj:`master`. 
     255 
     256widgetLabel(widget, label[, labelWidth]) 
     257 
     258The second is a label which can synchronize with values of master widget's attributes. 
     259 
     260label(widget, master, label[, labelWidth]) 
     261 
     262label 
     263:obj:`label` is a format string following Python's syntax (see the corresponding Python documentation): the label's content is rendered as :obj:`label % master.__dict__`. 
    264264 
    265265 
     
    272272 
    273273 
    274 .. function:: widgetBox(widget, box=None, orientation='vertical', addSpace=False) 
    275  
    276    Creates a box in which other widgets can be put. If `box` is given 
    277    and not false, the box will be framed. If `box` is a string, it will 
    278    be used for the box name (don't capitalize each word; spaces in front or 
    279    after the string will be trimmed and replaced with a single space). 
    280    Argument `orientation` can be ``"vertical"`` or ``"horizontal"`` 
    281    (or ``True`` and ``False``, or ``1`` and ``0``, respectively). 
     274widgetBox(widget, box=None, orientation='vertical', addSpace=False) 
     275Creates a box in which other widgets can be put. If :obj:`box` is given and not false, the box will be framed. If :obj:`box` is a string, it will be used for the box name (don't capitalize each word; spaces in front or after the string will be trimmed and replaced with a single space). Argument :obj:`orientation` can be :obj:`"vertical"` or :obj:`"horizontal"` (or :obj:`True` and :obj:`False`, or :obj:`1` and :obj:`0`, respectively). 
    282276 
    283277 
     
    286280 
    287281 
    288 .. function:: indentedBox(widget, sep=20) 
    289  
    290       Creates an indented box. Widgets which are subsequently put into 
    291       that box will be arranged vertically and aligned with an indentation 
    292       of `sep`. 
     282indentedBox(widget, sep=20) 
     283Creates an indented box. Widgets which are subsequently put into that box will be arranged vertically and aligned with an indentation of :obj:`sep`. 
    293284 
    294285 
     
    297288 
    298289Most widgets look better if we insert some vertical space between the controls 
    299 or groups of controls. A few functions have an optional argument `addSpace` 
     290or groups of controls. A few functions have an optional argument :obj:`addSpace` 
    300291by which we can request such space to be added. For other occasions, we can use 
    301292the following two functions. 
    302293 
    303 .. function:: separator(widget, width=0, height=8) 
    304  
    305    Function `separator` inserts a fixed amount of space into `widget`. 
    306    Although the caller can specify the amount, leaving the default will help the 
    307    widgets having uniform look. 
    308  
    309 .. function:: rubber(widget[, orientation="vertical"]) 
    310  
    311    Similar to separator, except that the size is (1, 1) and that it expands in the 
    312    specified direction if the widget is expanded. Most widgets should have rubber 
    313    somewhere in their :obj:`controlArea`. 
     294separator(widget, width=0, height=8) 
     295 
     296Function :obj:`separator` inserts a fixed amount of space into :obj:`widget`. 
     297Although the caller can specify the amount, leaving the default will help the 
     298widgets having uniform look. 
     299 
     300rubber(widget[, orientation="vertical"]) 
     301 
     302Similar to separator, except that the size is (1, 1) and that it expands in the 
     303specified direction if the widget is expanded. Most widgets should have rubber 
     304somewhere in their :obj:`controlArea`. 
    314305 
    315306Attribute Icons 
    316307*************** 
    317308 
    318 .. function:: getAttributeIcons() 
    319  
    320    Returns a dictionary with attribute types (:obj:`orange.VarTypes.Discrete`, 
    321    :obj:`orange.VarTypes.Continuous`, :obj:`orange.VarTypes.String`, -1) as keys 
    322    and colored pixmaps as values. The dictionary can be used in list and combo 
    323    boxes showing attributes for easier distinguishing between attributes of different types. 
     309getAttributeIcons() 
     310 
     311Returns a dictionary with attribute types (:obj:`orange.VarTypes.Discrete`, 
     312:obj:`orange.VarTypes.Continuous`, :obj:`orange.VarTypes.String`, -1) as keys 
     313and colored pixmaps as values. The dictionary can be used in list and combo 
     314boxes showing attributes for easier distinguishing between attributes of different types. 
    324315 
    325316Send automatically / Send 
     
    333324Programming this into every widget is annoying and error-prone; at the time when the function described here was written, not many widgets actually did this properly. 
    334325 
    335 .. function:: setStopper(master, sendButton, stopCheckbox, changedFlag, callback) 
    336  
    337    `sendButton` 
    338       The button that will be disabled when the check box is checked. 
    339  
    340    `stopCheckbox` 
    341       Check box that decides whether the changes are sent/commited/applied automatically. 
    342  
    343    `changedFlag` 
    344       The name of the `master`'s attribute which tells whether there is a change which has not been sent/applied yet. 
    345  
    346    `callback` 
    347       The function that sends the data or applies the changes. This is typically the function which is also used as the `sendButton`'s callback. 
    348  
    349  
    350 :obj:`setStopper` is a trivial three lines long function which connects a few signals. Its true importance is in enforcing the correct procedure for implementing such button-check box combinations. 
    351  
    352 .. 
    353    Make sure to carefully observe and follow the example provided below. 
    354  
    355    Missing, where did it go? 
    356  
     326setStopper(master, sendButton, stopCheckbox, changedFlag, callback) 
     327 
     328sendButton 
     329The button that will be disabled when the check box is checked. 
     330 
     331stopCheckbox 
     332Check box that decides whether the changes are sent/commited/applied automatically. 
     333 
     334changedFlag 
     335The name of the :obj:`master`'s attribute which tells whether there is a change which has not been sent/applied yet. 
     336 
     337callback 
     338The function that sends the data or applies the changes. This is typically the function which is also used as the :obj:`sendButton`'s callback. 
     339 
     340 
     341:obj:`setStopper` is a trivial three lines long function which connects a few signals. Its true importance is in enforcing the correct procedure for implementing such button-check box combinations. Make sure to carefully observe and follow the example provided below. 
     342 
  • docs/extend-widgets/rst/plots.rst

    r11408 r11049  
    8282the following subsection. 
    8383 
    84 ************************ 
    85 Colors in Orange Widgets 
    86 ************************ 
     84<h2>Colors in Orange Widgets</h2> 
    8785 
    8886Uniform assignment of colors across different widget is an 
     
    149147            l.isSelected = i in self.selectedLearners 
    150148 
    151 The complete code of this widget is available :download:`here <OWLearningCurve_plot.py>`. 
     149The complete code of this widget is available `here <OWLearningCurve_plot.py>`_. 
    152150This is almost like a typical 
    153151widget that is include in a standard Orange distribution, with a 
  • docs/extend-widgets/rst/plotsbasic.rst

    r11408 r11049  
    123123******************** 
    124124 
    125 You can find the full code for the example :download:`here <owplot_example.py>`. 
     125You can find the full code for the example `here <owplot_example.py>`_. 
    126126This particular example has a timer, so that :obj:`set_data` is called every 
    127127five seconds, and attributes are chosen at random each time, athough always  
  • docs/extend-widgets/rst/progressbar.rst

    r11408 r11049  
    2020widgets, has for this purpose a set of functions, which include: 
    2121 
    22 .. method:: progressBarInit() 
    23  
    24 .. method:: progressBarSet(value) 
    25  
    26 .. method:: progressBarFinished() 
    27  
     22<xmp class="code"> 
     23progressBarInit() 
     24progressBarSet(value) 
     25progressBarFinished() 
     26</xmp> 
    2827 
    2928where value is any number between 0 and 100. Sometimes, like it is 
  • docs/extend-widgets/rst/settings.rst

    r11408 r11049  
    154154            self.commit() 
    155155 
    156 You can now also inspect the :download:`complete code <OWDataSamplerB.py>` 
    157 of this widget. To distinguish it with a widget we have developed in the 
    158 previous section, we have designed a special 
    159 :download:`icon <DataSamplerB.png>` for it. If you wish to test is 
     156You can now also inspect the `complete code <OWDataSamplerB.py>`_ of this 
     157widget. To distinguish it with a widget we have developed in the 
     158previous section, we have designed a special `icon <DataSamplerB.png>`_ for it. If you wish to test is 
    160159widget in the Orange Canvas, put its code in the Test directory we 
    161160have created for the previous widget, update the Canvas registry, and 
     
    176175state so that when the user changes a check box, the attribute changes 
    177176and vice-versa. Although you can create such a link manually, you 
    178 should always use the module :doc:`OWGUI <owgui.rst>` instead; 
     177should always use the module <a href="owgui.htm">OWGUI</a> instead; 
    179178for instance, for a check box, use :obj:`OWGUI.checkBox` and not 
    180179simply the Qt's :obj:`QCheckBox`. 
     
    183182the data, while other are context-dependent. For the first to be saved 
    184183properly, you only need to list them in the :obj:`settingsList` 
    185 in the widget definition, as already described :doc:`elsewhere <settings.rst>` 
     184in the widget definition, as already described <a 
     185href="settings.htm">elsewhere</a>. 
    186186 
    187187************************** 
     
    286286comes the third data set, which only has attributes A, D and E. The 
    287287context now can't be reused since the attribute used for the 
    288 *required* :obj:`attrY` (the y axis) is missing. 
     288<em>required</em> :obj:`attrY` (the y axis) is missing. 
    289289 
    290290OK, now it is time to be a bit formal. As said, 
     
    347347 
    348348But the tuples are actually a shortcut for instances of 
    349 :obj:`ContextField`. When you say :obj:`"attrX"` this is actually 
    350 :obj:`ContextField("attrX", DomainContextHandler.Required)` (you should 
    351 appreciate the shortcurt, right?). But see this monster from widget "Select 
     349:obj:`ContextField`. When you say :obj:`"attrX"` this is 
     350actually :obj:`ContextField("attrX", 
     351DomainContextHandler.Required)` (you should appreciate the 
     352shortcurt, right?). But see this monster from widget "Select 
    352353Attributes" (file OWDataDomain.py):: 
    353354 
     
    365366 
    366367 
    367 :obj:`ContextField`'s constructor gets the name and flags and a list of 
    368 arguments that are written directly into the object instance. To follow the 
    369 example, recall what Select Attributes looks like: it allows you to select a 
    370 subset of attributes, the class attribute and the meta attributes that you 
    371 want to use; the attributes in the corresponding three list boxes are stored 
    372 in the widget's variables :obj:`chosenAttributes`, :obj:`classAttribute` 
    373 and :obj:`metaAttributes` respectively. When the user selects some attributes 
    374 in any of these boxes, the selection is stored in :obj:`selectedChosen`, 
    375 :obj:`selectedClass` and :obj:`selectedMeta`. The remaining attributes 
    376 - those that are not in any of these three list boxes - are in the leftover 
    377 listbox on the left-hand side of the widget, and the content of the box is 
    378 stored in the widget's variable :obj:`inputAttributes`. 
    379  
    380 The above definition tells that the context needs to store the contents of 
    381 the three list boxes by specifying the corresponding variables; the list of 
    382 attributes is given as the name of the field and the list of selected 
    383 attributes is in the optional named attribute :obj:`selected`. By 
    384 :obj:`reservoir` we told the context handler that the attributes are taken 
    385 from :obj:`inputAttributes`. So, when a context is retrieved, all the 
    386 attributes that are not in any of the three list boxes are put into 
    387 :obj:`inputAttributes`. 
    388  
    389 Why the mess? Couldn't we just store :obj:`inputAttributes` as the fourth 
    390 list box? Imagine that the user first loads the data with attributes A, B, 
    391 C, D, E and F, puts A, B, C in chosen and D in class. E and F are left in 
    392 :obj:`inputAttributes`. Now she loads another data which has attributes A, 
    393 B, C, D, E, and G. The contexts should match (the new data has all the 
    394 attributes we need), but :obj:`inputAttributes` should now contain E and 
    395 G, not E and F, since F doesn't exist any more, while G needs to be made 
    396 available. 
    397  
    398 You can use :obj:`ContextField` (instead of tuples and strings) for 
    399 declaring any fields, but you will usually need them only for lists or, 
    400 maybe, some complicated future controls. 
     368:obj:`ContextField`'s constructor gets the name and flags and a list of arguments that are written directly into the object instance. To follow the example, recall what Select Attributes looks like: it allows you to select a subset of attributes, the class attribute and the meta attributes that you want to use; the attributes in the corresponding three list boxes are stored in the widget's variables :obj:`chosenAttributes`, :obj:`classAttribute` and :obj:`metaAttributes` respectively. When the user selects some attributes in any of these boxes, the selection is stored in :obj:`selectedChosen`, :obj:`selectedClass` and <cose>selectedMeta</cose>. The remaining attributes - those that are not in any of these three list boxes - are in the leftover listbox on the left-hand side of the widget, and the content of the box is stored in the widget's variable :obj:`inputAttributes`. 
     369 
     370The above definition tells that the context needs to store the contents of the three list boxes by specifying the corresponding variables; the list of attributes is given as the name of the field and the list of selected attributes is in the optional named attribute :obj:`selected`. By :obj:`reservoir` we told the context handler that the attributes are taken from :obj:`inputAttributes`. So, when a context is retrieved, all the attributes that are not in any of the three list boxes are put into :obj:`inputAttributes`. 
     371 
     372Why the mess? Couldn't we just store :obj:`inputAttributes` as the fourth list box? Imagine that the user first loads the data with attributes A, B, C, D, E and F, puts A, B, C in chosen and D in class. E and F are left in :obj:`inputAttributes`. Now she loads another data which has attributes A, B, C, D, E, and G. The contexts should match (the new data has all the attributes we need), but :obj:`inputAttributes` should now contain E and G, not E and F, since F doesn't exist any more, while G needs to be made available. 
     373 
     374You can use :obj:`ContextField` (instead of tuples and strings) for declaring any fields, but you will usually need them only for lists or, maybe, some complicated future controls. 
    401375 
    402376 
  • docs/reference/rst/Orange.feature.selection.rst

    r11405 r10708  
    8181selects five best features from the data set before learning. 
    8282The new classifier is wrapped-up in a special class (see 
    83 :doc:`/tutorial/rst/python-learners` lesson in 
    84 :doc:`/tutorial/rst/index`). Th script compares this filtered learner with 
    85 one that uses a complete set of features. 
     83<a href="../ofb/c_pythonlearner.htm">Building your own learner</a> 
     84lesson in <a href="../ofb/default.htm">Orange for Beginners</a>). The 
     85script compares this filtered learner with one that uses a complete 
     86set of features. 
    8687 
    8788:download:`selection-bayes.py<code/selection-bayes.py>` 
     
    9899 
    99100We can do all of  he above by wrapping the learner using 
    100 :class:`~Orange.feature.selection.FilteredLearner`, thus 
     101<code>FilteredLearner</code>, thus 
    101102creating an object that is assembled from data filter and a base learner. When 
    102103given a data table, this learner uses attribute filter to construct a new 
    103104data set and base learner to construct a corresponding 
    104105classifier. Attribute filters should be of the type like 
    105 :class:`~Orange.feature.selection.FilterAboveThreshold` or 
    106 :class:`~Orange.feature.selection.FilterBestN` that can be initialized with 
    107 the arguments and later presented with a data, returning new reduced data 
     106<code>orngFSS.FilterAboveThresh</code> or 
     107<code>orngFSS.FilterBestN</code> that can be initialized with the 
     108arguments and later presented with a data, returning new reduced data 
    108109set. 
    109110 
     
    118119    :lines: 13-16 
    119120 
    120 Now, let's decide to retain three features and observe how many times 
     121Now, let's decide to retain three features (change the code in <a 
     122href="fss4.py">fss4.py</a> accordingly!), but observe how many times 
    121123an attribute was used. Remember, 10-fold cross validation constructs 
    122124ten instances for each classifier, and each time we run 
    123 :class:`~.FilteredLearner` a different set of features may be 
    124 selected. ``Orange.evaluation.testing.cross_validation`` stores classifiers in 
    125 ``results`` variable, and :class:`~.FilteredLearner` 
    126 returns a classifier that can tell which features it used, so the code 
    127 to do all this is quite short. 
     125FilteredLearner a different set of features may be 
     126selected. <code>orngEval.CrossValidation</code> stores classifiers in 
     127<code>results</code> variable, and <code>FilteredLearner</code> 
     128returns a classifier that can tell which features it used (how 
     129convenient!), so the code to do all this is quite short. 
    128130 
    129131.. literalinclude:: code/selection-filtered-learner.py 
    130132    :lines: 25- 
    131133 
    132 Running :download:`selection-filtered-learner.py <code/selection-filtered-learner.py>` 
    133 with three features selected each time a learner is run gives the 
    134 following result:: 
     134Running :download:`selection-filtered-learner.py <code/selection-filtered-learner.py>` with three features selected each 
     135time a learner is run gives the following result:: 
    135136 
    136137    Learner      CA 
     
    145146     4 x crime 
    146147 
     148Experiment yourself to see, if only one attribute is retained for 
     149classifier, which attribute was the one most frequently selected over 
     150all the ten cross-validation tests! 
    147151 
    148152========== 
  • docs/widgets/rst/associate/associationrulesexplorer.rst

    r11404 r11359  
    4848left-hand side conditions in a particular rule. Turned around, this 
    4949means that each rule appears in many places in the tree. As the completely 
    50 open tree below shows, the rule "age=adult & sex=male -> status=crew" 
     50open tree below shows, the rule :code:`age=adult & sex=male -> status=crew` 
    5151appears in two places (the seventh and the eleventh row). 
    5252 
  • docs/widgets/rst/classify/c45.rst

    r11404 r11359  
    3333 
    3434 
    35 :obj:`Classifier`, :obj:`C45 Tree` and :obj:`Classification Tree` are 
     35:code:`Classifier`, :code:`C45 Tree` and :code:`Classification Tree` are 
    3636available only if examples are present on the input. Which of the latter two 
    3737output signals is active is determined by setting 
     
    6565The next block of options deals with splitting. C4.5 uses gain ratio by 
    6666default; to override this, check :obj:`Use information gain instead of ratio`, 
    67 which is equivalent to C4.5's command line option ``-g``. If you enable 
    68 :obj:`Subsetting` (equivalent to ``-s``), C4.5 will merge values of 
     67which is equivalent to C4.5's command line option :code:`-g`. If you enable 
     68:obj:`subsetting` (equivalent to :code:`-s`), C4.5 will merge values of 
    6969multivalued discrete attributes instead of creating one branch for each node. 
    70 :obj:`Probabilistic threshold for continuous attributes` (``-p``) makes 
     70:obj:`Probabilistic threshold for continuous attributes` (:code:`-p`) makes 
    7171C4.5 compute the lower and upper boundaries for values of continuous attributes 
    7272for which the number of misclassified examples would be within one standard 
     
    8383 
    8484The resulting classifier can be left in the original Quinlan's structure, as 
    85 returned by his underlying code, or :obj:`Converted to orange the structure` 
     85returned by his underlying code, or :obj:`converted to orange the structure` 
    8686that is used by Orange's tree induction algorithm. This setting decides which 
    87 of the two signals that output the tree - :obj:`C45 Classifier` or 
    88 :obj:`Tree Classifier` will be active. As Orange's structure is more general 
     87of the two signals that output the tree - :code:`C45 Classifier` or 
     88:code:`Tree Classifier` will be active. As Orange's structure is more general 
    8989and can easily accommodate all the data that C4.5 tree needs for 
    9090classification, we believe that the converted tree behave exactly the same as 
  • docs/widgets/rst/classify/classificationtree.rst

    r11404 r11359  
    2828 
    2929 
    30 Signal :obj:`Classification Tree` sends data only if the learning data 
    31 (signal :obj:`Classified Examples`) is present. 
     30Signal :code:`Classification Tree` sends data only if the learning data 
     31(signal :code:`Classified Examples` is present. 
    3232 
    3333Description 
     
    5757:obj:`Number of neighbours` considered in the estimation. 
    5858 
    59 If :obj:`Binarization` is checked, the values of multivalued attributes 
     59If :code:`Binarization` is checked, the values of multivalued attributes 
    6060are split into two groups (based on the statistics in the particular node) 
    6161to yield a binary tree. Binarization gets rid of the usual measures' 
  • docs/widgets/rst/classify/classificationtreeviewer.rst

    r11404 r11359  
    2424 
    2525 
    26 Signal :obj:`Classified Examples` sends data only if some tree node is 
     26Signal :code:`Classified Examples` sends data only if some tree node is 
    2727selected and contains some examples. 
    2828 
  • docs/widgets/rst/classify/interactivetreebuilder.rst

    r11404 r11359  
    3434 
    3535 
    36 Signal :obj:`Examples` sends data only if some tree node is selected and 
     36Signal :code:`Examples` sends data only if some tree node is selected and 
    3737contains some examples. 
    3838 
     
    5656the animals that don't give milk and have no feathers (the pictures shows 
    5757a tree for the zoo data set) would be split according to whether they are 
    58 *aquatic* or not. In case of continuous attributes, a cut off point 
     58:code:`aquatic` or not. In case of continuous attributes, a cut off point 
    5959needs to be specified as well. 
    6060 
    6161If Split is used on a node which is not a leaf, the criterion at that node 
    62 is replaced. If we, for instance, selected the :obj:`<root>` node and pushed 
    63 :obj:`Split`, the criterion *milk* would be replaced with *aquatic* 
    64 and the nodes below (*feathers*) are removed. 
     62is replaced. If we, for instance, selected the &lt;root&gt; node and pushed 
     63Split, the criterion :code:`milk` would be replaced with :code:`aquatic` 
     64and the nodes below (:code:`feathers`) are removed. 
    6565 
    6666Button :obj:`Cut` cuts the tree at the selected node. If we pushed Cut 
    6767in the situation in the picture, nothing would happen since the selected 
    68 node (:obj:`feathers=0`) is already a leaf. If we selected :obj:`<root>` 
     68node (:code:`feathers=0`) is already a leaf. If we selected :code:`<root>` 
    6969and pushed Cut, the entire tree would be cut off. 
    7070 
    71 Cut is especially useful in combination with :obj:`Build` which builds 
     71Cut is especially useful in combination with :code:`Build` which builds 
    7272a subtree at the current node. So, if we push Build in the situation 
    7373depicted above, a subtree would be built for the milkless featherless 
  • docs/widgets/rst/classify/knearestneighbours.rst

    r11404 r11359  
    2727 
    2828 
    29 Signal :obj:`KNN Classifier` sends data only if the learning data (signal 
    30 :obj:`Examples` is present. 
     29Signal :code:`KNN Classifier` sends data only if the learning data (signal 
     30:code:`Examples` is present. 
    3131 
    3232Description 
  • docs/widgets/rst/classify/logisticregression.rst

    r11404 r11359  
    2828 
    2929 
    30 Signal :obj:`Logistic Regression Classifier` sends data only if the learning 
    31 data (signal :obj:`Examples` is present. 
     30Signal :code:`Logistic Regression Classifier` sends data only if the learning 
     31data (signal :code:`Examples` is present. 
    3232 
    3333Description 
  • docs/widgets/rst/classify/majority.rst

    r11404 r11359  
    2828 
    2929 
    30 Signal :obj:`Classifier` sends data only if the learning data (signal 
    31 :obj:`Examples`) is present. 
     30Signal :code:`Classifier` sends data only if the learning data (signal 
     31:code:`Examples`) is present. 
    3232 
    3333Description 
  • docs/widgets/rst/classify/naivebayes.rst

    r11404 r11359  
    2828 
    2929 
    30 Signal :obj:`Naive Bayesian Classifier` sends data only if the learning 
    31 data (signal :obj:`Examples` is present. 
     30Signal :code:`Naive Bayesian Classifier` sends data only if the learning 
     31data (signal :code:`Examples` is present. 
    3232 
    3333Description 
  • docs/widgets/rst/data/discretize.rst

    r11404 r11050  
    139139right-hand side of the graph. In case of discrete classes, the target class can be any 
    140140of the original classes, while for discretized attributes, it is one of the intervals 
    141 (*< 18545.33* in our case). :obj:`Show rug` adds small lines at the bottom 
     141(&lt;18545.33 in our case). :obj:`Show rug` adds small lines at the bottom 
    142142and the top of the graph, which represents histograms showing the number of examples in the 
    143143target class (top) and the other classes (bottom). On the snapshot, the examples of the 
    144 target class (*< 18545.33*) are concentrated at between 50 and 120, while the rarer examples 
     144target class (&lt;18545.33) are concentrated at between 50 and 120, while the rarer examples 
    145145of other classes are spread between 100 and 200, with an outlier at 250. Plotting the rug 
    146146can be slow if the number of examples is huge. 
  • docs/widgets/rst/data/rank.rst

    r11404 r11359  
    6969 
    7070The widget outputs two example tables. The one, whose corresponding signal 
    71 is named :obj:`ExampleTable Attributes` looks pretty much like the one 
     71is named :code:`ExampleTable Attributes` looks pretty much like the one 
    7272shown in the Rank widget, except that the second column is split into two 
    7373columns, one giving the attribute type (D for discrete and C for continuous), 
     
    110110The examples in the file are put through ref:`Data Sampler` which split the 
    111111data set into two subsets: one, containing 70% of examples (signal 
    112 :obj:`Classified Examples`) will be used for training a 
     112:code:`Classified Examples`) will be used for training a 
    113113:ref:`Naive Bayes <Naive Bayes>` classifier, and the other 30% (signal 
    114 :obj:`Remaining Classified Examples`) for testing. Attribute subset selection 
     114:code:`Remaining Classified Examples`) for testing. Attribute subset selection 
    115115based on information gain was performed on the training set only, and five most 
    116116informative attributes were selected for learning. A data set with all other 
    117 attributes removed (signal :obj:`Reduced Example Table`) is fed into 
     117attributes removed (signal :code:`Reduced Example Table`) is fed into 
    118118:ref:`Test Learners`. Test Learners widgets also gets the 
    119 :obj:`Remaining Classified Examples` to use them as test examples (don't 
    120 forget to set :obj:`Test on Test Data` in that widget!). 
     119:code:`Remaining Classified Examples` to use them as test examples (don't 
     120forget to set :code:`Test on Test Data` in that widget!). 
    121121 
    122122To verify how the subset selection affects the classifier's performance, we 
    123123added another :ref:`Test Learners`, but connected it to the 
    124 :ref:`Data Sampler` so that the two subsets emitted by the latter are used 
     124:code:`Data Sampler` so that the two subsets emitted by the latter are used 
    125125for training and testing without any feature subset selection. 
    126126 
  • docs/widgets/rst/regression/pade.rst

    r11404 r11359  
    3232 
    3333The widget is implemented to cache some data. After, for instance, computing 
    34 the derivatives by ``x`` and ``y`` separately, the widget has already 
     34the derivatives by :code:`x` and :code:`y` separately, the widget has already 
    3535stored all the data to produce the derivatives by both in a moment. 
    3636 
  • docs/widgets/rst/regression/regressiontree.rst

    r11404 r11359  
    2424 
    2525 
    26 Signal :obj:`Regression Tree` sends data only if the learning data (signal 
    27 :obj:`Examples`) is present. 
     26Signal :code:`Regression Tree` sends data only if the learning data (signal 
     27:code:`Examples`) is present. 
    2828 
    2929Description 
     
    4242:ref:`Test Learners`. The default name is "Regression Tree". 
    4343 
    44 If :obj:`Binarization` is checked, the values of multivalued attributes 
     44If :code:`Binarization` is checked, the values of multivalued attributes 
    4545are split into two groups (based on the statistics in the particular node) 
    4646to yield a binary tree. Binarization gets rid of the usual measures' bias 
Note: See TracChangeset for help on using the changeset viewer.