Changeset 2537

Show
Ignore:
Timestamp:
10/24/08 14:25:46 (2 months ago)
Author:
mwlinnem
Message:

Removed icon

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plugins/visualization/edu.iu.nwb.visualization.guess/ALGORITHM/config.properties

    r2532 r2537  
    11executable=guess 
    2 template=${executable} ${inFile[0]} scripts/guessfixer.py scripts/infoWindowOpener.py 
     2template=${executable} ${inFile[0]} scripts/guessfixer.py scripts/infoWindowOpener.py scripts/graphModifier.py 
  • trunk/plugins/visualization/edu.iu.nwb.visualization.guess/ALGORITHM/default/scripts/graphModifier.py

    r2530 r2537  
    4444method = {} 
    4545method["color"] = lambda x: changeColor(x) # x is a tuple (dataTuple) 
     46method["node_style"] = lambda x: changeNodeStyle(x) 
    4647method["show"] = lambda x: showIt(x) 
    4748method["hide"] = lambda x: hideIt(x) 
     
    9495(yellow, 255, 255, 0), (yellowgreen, 196, 252, 139), (yelloworange, 253, 198, 8)] 
    9596 
     97 
    9698# list of just the color names 
    9799colorList = [] 
     100 
     101#node styles available 
     102displayedNodeStyleIndexes = [1,2,3,4,5,6,8,9,10] 
     103 
     104nodeStyleIndexToFileName = {1 : "nodestyle1.gif", 2 : "nodestyle2.gif", 3 : "nodestyle3.gif", \ 
     105                            4 : "nodestyle4.gif", 5 : "nodestyle5.gif", 6 : "nodestyle6.gif", \ 
     106                            7 : "nodestyle7.gif", 8 : "nodestyle8.gif", 9 : "nodestyle9.gif", \ 
     107                            10 :"nodestyle10.gif"} 
     108                             
     109nodeStyleImageDirectory = "images/" 
     110 
     111image_style = 7 
    98112 
    99113# dummy component to fulfill some parameters 
     
    503517                dockSelf.layoutPanel = JPanel() # top: main controls bottom: hidden controls 
    504518                dockSelf.layoutPanel.setLayout(BoxLayout(dockSelf.layoutPanel, BoxLayout.Y_AXIS)) 
     519                 
    505520                dockSelf.topPanel = JPanel() # the top panel 
     521                 
    506522                macDimH = 40 
    507                 winDimH = 3
     523                winDimH = 5
    508524                macDimW = 900 
    509                 winDimW = 80
     525                winDimW = 57
    510526                # Here we assume people are using either mac or windows.  
    511527                # If I had a way to test for linux and tweak the sizes I'd do it here. 
     
    519535                dockSelf.topPanel.setPreferredSize(Dimension(dimWidth, dimHeight)) 
    520536                dockSelf.layoutPanel.add(dockSelf.topPanel) 
    521                 dockSelf.buttonPanel = JPanel() # the panel for the buttons 
     537                dockSelf.buttonPanel = JPanel(GridLayout(2, 5)) # the panel for the buttons 
    522538                dockSelf.buttonPanel.setPreferredSize(Dimension(dimWidth, dimHeight)) 
    523539                dockSelf.layoutPanel.add(dockSelf.buttonPanel) 
    524540                dockSelf.bottomPanel = JPanel() # the bottom panel 
    525                 dockSelf.bottomPanel.setPreferredSize(Dimension(900, 280)) 
     541                dockSelf.bottomPanel.setPreferredSize(Dimension(dimWidth, dimHeight)) 
    526542                dockSelf.layoutPanel.add(dockSelf.bottomPanel) 
    527543                 
     
    533549                obf = objectBoxFilter(dockSelf) 
    534550                dockSelf.objectBox.addActionListener(obf) 
     551         
    535552                 
    536553                # color panel 
     
    545562                # create the color buttons 
    546563                for theColor in dockSelf.colorInfo: 
    547                         dockSelf.colors[theColor[0]] = JButton("#") 
    548                         dockSelf.colors[theColor[0]].setBackground(Color(theColor[1], theColor[2], theColor[3])) 
    549                         dockSelf.colors[theColor[0]].setForeground(Color(theColor[1], theColor[2], theColor[3])) 
    550                         dockSelf.colors[theColor[0]].setPreferredSize(Dimension(15,15)) 
    551                         dockSelf.colors[theColor[0]].actionPerformed = lambda event: setColor(event, GraphModifier.self) 
    552                         dockSelf.colorPanel.add(dockSelf.colors[theColor[0]]) 
    553                          
     564                        colorName = theColor[0] 
     565                        dockSelf.colors[colorName] = JButton("#") 
     566                        dockSelf.colors[colorName].setBackground(Color(theColor[1], theColor[2], theColor[3])) 
     567                        dockSelf.colors[colorName].setForeground(Color(theColor[1], theColor[2], theColor[3])) 
     568                        dockSelf.colors[colorName].setPreferredSize(Dimension(14, 14)) 
     569                        dockSelf.colors[colorName].actionPerformed = lambda event: setColor(event, GraphModifier.self) 
     570                        dockSelf.colorPanel.add(dockSelf.colors[theColor[0]])                    
     571                                         
     572                #node style panel 
     573                dockSelf.nodeStylePanel = JPanel(GridLayout(1, 8)) 
     574                dockSelf.nodeStylePanel.setVisible(false) 
     575                 
     576                #node styles 
     577                dockSelf.nodeStyleIndexToButton = {} 
     578                 
     579                #create the node style buttons 
     580                dockSelf.nodeStylePanelButtons = {} 
     581                for nodeStyleIndex in displayedNodeStyleIndexes: 
     582                    iconFileName = nodeStyleIndexToFileName[nodeStyleIndex] 
     583                    nodeStyleIcon = ImageIcon(nodeStyleImageDirectory + iconFileName) 
     584                    dockSelf.nodeStylePanelButtons[nodeStyleIndex] = JButton(nodeStyleIcon) 
     585                    dockSelf.nodeStylePanelButtons[nodeStyleIndex].setPreferredSize(Dimension(32,32)) 
     586                    dockSelf.nodeStylePanelButtons[nodeStyleIndex].actionPerformed = lambda event: setNodeStyle(event, GraphModifier.self) 
     587                    dockSelf.nodeStylePanel.add(dockSelf.nodeStylePanelButtons[nodeStyleIndex]) 
     588                 
    554589                # size panel 
    555                 dockSelf.sizePanel = JPanel(GridLayout(2,4)) 
     590                dockSelf.sizePanel = JPanel(GridLayout(20,20)) 
    556591                 
    557592                # assuming this is for a node, do edges later 
     
    645680                dockSelf.changeLabelButton.actionPerformed = lambda event: updateBottomPanel(GraphModifier.self, GraphModifier.self.changeLabelPanel) 
    646681                 
     682                #node style 
     683                dockSelf.nodeStyleButton = JButton("Node Shape") 
     684                dockSelf.nodeStyleButton.actionPerformed = lambda event: updateBottomPanel(GraphModifier.self, GraphModifier.self.nodeStylePanel) 
     685                 
    647686                # center button 
    648687                dockSelf.centerButton = JButton("Center") 
     
    696735                dockSelf.buttonPanel.add(dockSelf.hideLabelButton) 
    697736                dockSelf.buttonPanel.add(dockSelf.changeLabelButton) 
     737                dockSelf.buttonPanel.add(dockSelf.nodeStyleButton) 
    698738                dockSelf.buttonPanel.add(dockSelf.centerButton) 
    699739                dockSelf.buttonPanel.add(dockSelf.changeHistoryButton) 
     
    733773        changeAttribute(o) 
    734774        o.colorPanel.setVisible(false) 
     775         
     776# set the node style to change   
     777def setNodeStyle(b, o): 
     778    o.currentAction = "node_style" 
     779    #figure out which button was pressed 
     780    for nodeStyleIndex in displayedNodeStyleIndexes: 
     781       if b.getSource() == o.nodeStylePanelButtons[nodeStyleIndex]: 
     782           o.currentNodeStyle = nodeStyleIndex 
     783           break 
     784    t[1] = o.currentNodeStyle 
     785    changeAttribute(o) 
     786    o.nodeStylePanel.setVisible(false) 
     787     
    735788 
    736789# shows the specified objects 
     
    792845                                # change all edge colors 
    793846                                g.edges.color = o.currentColor 
     847                        elif o.currentAction == "node_style": 
     848                            g.nodes.style = image_style # a hack to fix problem in switching between styles in GUESS 
     849                            g.nodes.style = o.currentNodeStyle 
    794850                        elif o.currentAction == "show": 
    795851                                # show all nodes 
     
    838894                        if o.currentAction == "color": 
    839895                                g.nodes.color = o.currentColor 
     896                        elif o.currentAction == "node_style": 
     897                            g.nodes.style = image_style 
     898                            g.nodes.style = o.currentNodeStyle 
    840899                        elif o.currentAction == "show": 
    841900                                g.nodes.visible = true 
     
    858917                        if o.currentAction == "color": 
    859918                                g.edges.color = o.currentColor 
     919                        elif o.currentAction == "node_style": 
     920                            g.nodes.style = image_style 
     921                            g.nodes.style = o.currentNodeStyle 
    860922                        elif o.currentAction == "show": 
    861923                                g.edges.visible = true 
     
    9571019        tup[0].color = tup[1] 
    9581020 
     1021#change the style of the specified node 
     1022def changeNodeStyle(tup): 
     1023    tup[0].style = image_style 
     1024    tup[0].style = tup[1] 
     1025 
    9591026# show the specified object 
    9601027def showIt(tup): 
     
    10281095                if action == "color": 
    10291096                        historyCode = historyCode + "\ti.color = " + str(o.currentColor) + "\n" 
     1097                if action == "node_style": 
     1098                    historyCode = historyCode + "\ti.style = " + str(o.currentNodeStyle) + "\n" 
    10301099                elif action == "hide": 
    10311100                        historyCode = historyCode + "\ti.visible = false\n"