本文整理汇总了Python中Orange.widgets.widget.OWWidget类的典型用法代码示例。如果您正苦于以下问题:Python OWWidget类的具体用法?Python OWWidget怎么用?Python OWWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OWWidget类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_initial_value
def test_set_initial_value(self):
widget = OWWidget()
variables = [ContinuousVariable(x) for x in "abc"]
model = VariableListModel(variables)
widget.foo = variables[1]
combo = gui.comboBox(widget.controlArea, widget, "foo", model=model)
self.assertEqual(combo.currentIndex(), 1)
示例2: test_select
def test_select(self):
widget = OWWidget()
widget.foo = None
self.attrs = VariableListModel()
view = gui.listView(widget.controlArea, widget, "foo", model=self.attrs)
self.assertIsNone(widget.foo)
a, b, c = (ContinuousVariable(x) for x in "abc")
self.attrs[:] = [a, b, c]
view.setCurrentIndex(self.attrs.index(0, 0))
self.assertIs(widget.foo, a)
view.setCurrentIndex(self.attrs.index(2, 0))
self.assertIs(widget.foo, c)
widget.foo = b
selection = view.selectedIndexes()
self.assertEqual(len(selection), 1)
self.assertEqual(selection[0].row(), 1)
示例3: showEvent
def showEvent(self, ev):
OWWidget.showEvent(self, ev)
self.updateGraph()
示例4: resizeEvent
def resizeEvent(self, e):
OWWidget.resizeEvent(self,e)
self.updateGraph()
示例5: saveSettings
def saveSettings(self):
OWWidget.saveSettings(self)
示例6: __init__
def __init__(self, parent=None, signalManager = None):
OWWidget.__init__(self, parent, signalManager, "Scatterplot (Qt)", True)
##TODO tukaj mas testni graf!
self.graph = OWScatterPlotGraphQt_test(self, self.mainArea, "ScatterPlotQt_test")
#add a graph widget
##TODO pazi
# self.mainArea.layout().addWidget(self.graph.pgPlotWidget) # tale je zaresni
self.mainArea.layout().addWidget(self.graph.glw) # tale je testni
## TODO spodaj je se en POZOR, kjer nastavis palette
# self.vizrank = OWVizRank(self, self.signalManager, self.graph, orngVizRank.SCATTERPLOT, "ScatterPlotQt")
# self.optimizationDlg = self.vizrank
# local variables
self.showGridlines = 1
self.autoSendSelection = 1
self.toolbarSelection = 0
self.classificationResults = None
self.outlierValues = None
self.colorSettings = None
self.selectedSchemaIndex = 0
self.graph.sendSelectionOnUpdate = 0
self.attributeSelectionList = None
self.data = None
self.subsetData = None
#load settings
# self.loadSettings()
self.graph.setShowXaxisTitle()
self.graph.setShowYLaxisTitle()
# self.connect(self.graphButton, SIGNAL("clicked()"), self.graph.saveToFile)
box1 = gui.widgetBox(self.controlArea, "Axis Variables")
#x attribute
self.attrX = ""
self.attrXCombo = gui.comboBox(box1, self, "attrX", label="X-Axis:", labelWidth=50, orientation="horizontal", callback = self.majorUpdateGraph, sendSelectedValue = 1, valueType = str)
# y attribute
self.attrY = ""
self.attrYCombo = gui.comboBox(box1, self, "attrY", label="Y-Axis:", labelWidth=50, orientation="horizontal", callback = self.majorUpdateGraph, sendSelectedValue = 1, valueType = str)
box2 = gui.widgetBox(self.controlArea, "Point Properties")
self.attrColor = ""
self.attrColorCombo = gui.comboBox(box2, self, "attrColor", label="Color:", labelWidth=50, orientation="horizontal", callback = self.updateGraph, sendSelectedValue=1, valueType = str, emptyString = "(Same color)")
# labelling
self.attrLabel = ""
self.attrLabelCombo = gui.comboBox(box2, self, "attrLabel", label="Label:", labelWidth=50, orientation="horizontal", callback = self.updateGraph, sendSelectedValue = 1, valueType = str, emptyString = "(No labels)")
# shaping
self.attrShape = ""
self.attrShapeCombo = gui.comboBox(box2, self, "attrShape", label="Shape:", labelWidth=50, orientation="horizontal", callback = self.updateGraph, sendSelectedValue=1, valueType = str, emptyString = "(Same shape)")
# sizing
self.attrSize = ""
self.attrSizeCombo = gui.comboBox(box2, self, "attrSize", label="Size:", labelWidth=50, orientation="horizontal", callback = self.updateGraph, sendSelectedValue=1, valueType = str, emptyString = "(Same size)")
g = self.graph.gui
box3 = g.point_properties_box(self.controlArea)
# self.jitterSizeCombo = gui.comboBox(box3, self, "graph.jitter_size", label = 'Jittering size (% of size):'+' ', orientation = "horizontal", callback = self.resetGraphData, items = self.jitterSizeNums, sendSelectedValue = 1, valueType = float)
## TODO: jitter size slider ima samo interger values -> ali lahko slajda po self.jitterSizeNums
gui.hSlider(box3, self, value='graph.jitter_size', label='Jittering (%): ', minValue=1, maxValue=10, callback=self.resetGraphData)
gui.checkBox(gui.indentedBox(box3), self, 'graph.jitter_continuous', 'Jitter continuous values', callback = self.resetGraphData, tooltip = "Does jittering apply also on continuous attributes?")
gui.button(box3, self, "Set Colors", self.setColors, tooltip = "Set the canvas background color, grid color and color palette for coloring continuous variables")
box4 = gui.widgetBox(self.controlArea, "Plot Properties")
g.add_widgets([g.ShowLegend, g.ShowGridLines], box4)
# gui.comboBox(box4, self, "graph.tooltipKind", items = ["Don't Show Tooltips", "Show Visible Attributes", "Show All Attributes"], callback = self.updateGraph)
gui.checkBox(box4, self, value='graph.tooltipShowsAllAttributes', label='Show all attributes in tooltip')
box5 = gui.widgetBox(self.controlArea, "Auto Send Selected Data When...")
gui.checkBox(box5, self, 'autoSendSelection', 'Adding/Removing selection areas', callback = self.selectionChanged, tooltip = "Send selected data whenever a selection area is added or removed")
gui.checkBox(box5, self, 'graph.sendSelectionOnUpdate', 'Moving/Resizing selection areas', tooltip = "Send selected data when a user moves or resizes an existing selection area")
self.graph.selection_changed.connect(self.selectionChanged)
# zooming / selection
self.zoomSelectToolbar = g.zoom_select_toolbar(self.controlArea, buttons = g.default_zoom_select_buttons + [g.Spacing, g.ShufflePoints])
self.connect(self.zoomSelectToolbar.buttons[g.SendSelection], SIGNAL("clicked()"), self.sendSelections)
self.connect(self.zoomSelectToolbar.buttons[g.Zoom], SIGNAL("clicked()",), self.graph.zoomButtonClicked)
self.connect(self.zoomSelectToolbar.buttons[g.Pan], SIGNAL("clicked()",), self.graph.panButtonClicked)
self.connect(self.zoomSelectToolbar.buttons[g.Select], SIGNAL("clicked()",), self.graph.selectButtonClicked)
self.controlArea.layout().addStretch(100)
self.icons = gui.attributeIconDict
self.debugSettings = ["attrX", "attrY", "attrColor", "attrLabel", "attrShape", "attrSize"]
# self.wdChildDialogs = [self.vizrank] # used when running widget debugging
dlg = self.createColorDialog()
self.graph.contPalette = dlg.getContinuousPalette("contPalette")
self.graph.discPalette = dlg.getDiscretePalette("discPalette")
##TODO POZOR!
# p = self.graph.pgPlotWidget.palette()
p = self.graph.glw.palette()
#.........这里部分代码省略.........
示例7: closeEvent
def closeEvent(self, ce):
# self.vizrank.close()
OWWidget.closeEvent(self, ce)
示例8: test_checked_extension
def test_checked_extension(self):
widget = OWWidget()
widget.some_param = 0
widget.some_option = False
gui.doubleSpin(widget=widget, master=widget, value="some_param",
minv=1, maxv=10, checked="some_option")