Changeset 3845:688851d3888c in orange


Ignore:
Timestamp:
05/13/08 11:28:36 (6 years ago)
Author:
miha <miha.stajdohar@…>
Branch:
default
Convert:
10961737913701c3c89cf0e5f9d2545aaed03969
Message:

ported to qt4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Prototypes/OWInteractionGraphProto.py

    r3842 r3845  
    44<icon>icons/InteractionGraph.png</icon> 
    55<contact>Aleks Jakulin</contact> 
    6 <priority>4010</priority> 
     6<priority>3012</priority> 
    77""" 
    88# InteractionGraph.py 
    99# 
    1010# 
    11  
     11import orngOrangeFoldersQt4 
    1212from OWWidget import * 
    13 from qt import * 
    14 from qtcanvas import * 
    1513import orngInteract, OWQCanvasFuncts 
    1614import statc 
     
    2220from orangeom import Network 
    2321 
    24 class IntGraphView(QCanvasView): 
     22class IntGraphView(QGraphicsView): 
    2523    def __init__(self, parent, name, *args): 
    26         apply(QCanvasView.__init__,(self,) + args) 
     24        apply(QGraphicsView.__init__,(self,) + args) 
    2725        self.parent = parent 
    2826        self.name = name 
     
    7270        self.loadSettings() 
    7371 
    74         self.tabs = QTabWidget(self.mainArea) 
    75          
    76         self.listTab = QVGroupBox(self) 
    77         self.graphTab = QVGroupBox(self) 
    78  
    79         self.tabs.insertTab(self.listTab, "List") 
    80         self.tabs.insertTab(self.graphTab, "Graph") 
     72        # add a settings dialog and initialize its values 
     73        self.tabs = OWGUI.tabWidget(self.mainArea) 
     74         
     75        self.listTab = OWGUI.createTabPage(self.tabs, "List") 
     76        self.graphTab = OWGUI.createTabPage(self.tabs, "Graph") 
     77         
     78        self.splitter = QSplitter(Qt.Horizontal, self.listTab) 
     79        self.listTab.layout().addWidget(self.splitter) 
    8180 
    8281        self.splitCanvas = QSplitter(self.listTab) 
    8382 
    84         self.canvasL = QCanvas(2000, 2000) 
    85         self.canvasViewL = IntGraphView(self, "interactions", self.canvasL, self.splitCanvas) 
    86         self.canvasViewL.show() 
    87          
    88         self.canvasM = QCanvas(2000, 2000) 
    89         self.canvasViewM = IntGraphView(self, "correlations", self.canvasM, self.splitCanvas) 
    90         self.canvasViewM.show() 
    91  
    92         self.canvasR = QCanvas(2000,2000) 
    93         self.canvasViewR = IntGraphView(self, "graph", self.canvasR, self.graphTab) 
    94         self.canvasViewR.show() 
     83        self.canvasL = QGraphicsScene() 
     84        self.canvasViewL = IntGraphView(self, "interactions", self.canvasL, self) 
     85        self.splitter.addWidget(self.canvasViewL) 
     86        self.canvasViewL.setAlignment(Qt.AlignLeft | Qt.AlignTop) 
     87         
     88        self.canvasM = QGraphicsScene() 
     89        self.canvasViewM = IntGraphView(self, "correlations", self.canvasM, self) 
     90        self.splitter.addWidget(self.canvasViewM) 
     91 
     92        self.canvasR = QGraphicsScene() 
     93        self.canvasViewR = IntGraphView(self, "graph", self.canvasR, self) 
     94        self.graphTab.layout().addWidget(self.canvasViewR) 
    9595 
    9696        #GUI 
    9797        #add controls to self.controlArea widget 
    98         self.shownAttribsGroup = OWGUI.widgetBox(self.controlArea, "Selected Attributes", addSpace = True) 
     98        self.shownAttribsGroup = OWGUI.widgetBox(self.controlArea, "Selected Attributes") 
    9999        self.addRemoveGroup = OWGUI.widgetBox(self.controlArea, 1, orientation = "horizontal" ) 
    100         self.hiddenAttribsGroup = OWGUI.widgetBox(self.controlArea, "Unselected Attributes", addSpace = True) 
    101  
    102         self.shownAttribsLB = OWGUI.listBox(self.shownAttribsGroup, self, "selectedShown", "shownAttributes", selectionMode = QListBox.Extended) 
     100        self.hiddenAttribsGroup = OWGUI.widgetBox(self.controlArea, "Unselected Attributes") 
     101 
     102        self.shownAttribsLB = OWGUI.listBox(self.shownAttribsGroup, self, "selectedShown", "shownAttributes", selectionMode = QListWidget.ExtendedSelection) 
    103103 
    104104        self.attrAddButton =    OWGUI.button(self.addRemoveGroup, self, "", callback = self.addAttributeClick, tooltip="Add (show) selected attributes") 
    105         self.attrAddButton.setPixmap(QPixmap(os.path.dirname(__file__) + "/../icons/Dlg_up2.png")) 
     105        self.attrAddButton.setIcon(QIcon(os.path.join(self.widgetDir, r"icons\Dlg_up2.png"))) 
    106106        self.attrRemoveButton = OWGUI.button(self.addRemoveGroup, self, "", callback = self.removeAttributeClick, tooltip="Remove (hide) selected attributes") 
    107         self.attrRemoveButton.setPixmap(QPixmap(os.path.dirname(__file__) + "/../icons/Dlg_down2.png")) 
    108  
    109         self.hiddenAttribsLB = OWGUI.listBox(self.hiddenAttribsGroup, self, "selectedHidden", "hiddenAttributes", selectionMode = QListBox.Extended, addSpace = True) 
    110  
    111         settingsBox = OWGUI.widgetBox(self.controlArea, "Settings", addSpace = True) 
     107        self.attrRemoveButton.setIcon(QIcon(os.path.join(self.widgetDir, r"icons\Dlg_down2.png"))) 
     108 
     109        self.hiddenAttribsLB = OWGUI.listBox(self.hiddenAttribsGroup, self, "selectedHidden", "hiddenAttributes", selectionMode = QListWidget.ExtendedSelection) 
     110 
     111        settingsBox = OWGUI.widgetBox(self.controlArea, "Settings") 
    112112        self.mergeAttributesCB = OWGUI.checkBox(settingsBox, self, "mergeAttributes", 'Merge attributes', callback = self.mergeAttributesEvent, tooltip = "Enable or disable attribute merging. If enabled, you can merge \ntwo attributes with a right mouse click inside interaction rectangles in the left graph.\nA merged attribute is then created as a cartesian product of corresponding attributes \nand added to the list of attributes.") 
    113113        self.importantInteractionsCB = OWGUI.checkBox(settingsBox, self, "onlyImportantInteractions", 'Important interactions only', callback = self.showImportantInteractions) 
     
    118118        self.saveRCanvas = OWGUI.button(self.controlArea, self, "Save right canvas", callback = self.saveToFileRCanvas) 
    119119 
     120        self.listTab.layout().addStretch(1) 
     121        self.graphTab.layout().addStretch(1) 
     122         
    120123        #self.connect(self.graphButton, SIGNAL("clicked()"), self.graph.saveToFile) 
    121124        #self.connect(self.settingsButton, SIGNAL("clicked()"), self.options.show) 
     125         
    122126        self.activateLoadedSettings() 
    123127 
Note: See TracChangeset for help on using the changeset viewer.