Changeset 2537
- Timestamp:
- 10/24/08 14:25:46 (2 months ago)
- Files:
-
- trunk/plugins/visualization/edu.iu.nwb.visualization.guess/ALGORITHM/config.properties (modified) (1 diff)
- trunk/plugins/visualization/edu.iu.nwb.visualization.guess/ALGORITHM/default/images/guess-icon1.gif (added)
- trunk/plugins/visualization/edu.iu.nwb.visualization.guess/ALGORITHM/default/images/guess-icon2.gif (added)
- trunk/plugins/visualization/edu.iu.nwb.visualization.guess/ALGORITHM/default/images/guess-icons3.gif (added)
- trunk/plugins/visualization/edu.iu.nwb.visualization.guess/ALGORITHM/default/images/nodestyle8.gif (deleted)
- trunk/plugins/visualization/edu.iu.nwb.visualization.guess/ALGORITHM/default/scripts/graphModifier.py (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plugins/visualization/edu.iu.nwb.visualization.guess/ALGORITHM/config.properties
r2532 r2537 1 1 executable=guess 2 template=${executable} ${inFile[0]} scripts/guessfixer.py scripts/infoWindowOpener.py 2 template=${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 44 44 method = {} 45 45 method["color"] = lambda x: changeColor(x) # x is a tuple (dataTuple) 46 method["node_style"] = lambda x: changeNodeStyle(x) 46 47 method["show"] = lambda x: showIt(x) 47 48 method["hide"] = lambda x: hideIt(x) … … 94 95 (yellow, 255, 255, 0), (yellowgreen, 196, 252, 139), (yelloworange, 253, 198, 8)] 95 96 97 96 98 # list of just the color names 97 99 colorList = [] 100 101 #node styles available 102 displayedNodeStyleIndexes = [1,2,3,4,5,6,8,9,10] 103 104 nodeStyleIndexToFileName = {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 109 nodeStyleImageDirectory = "images/" 110 111 image_style = 7 98 112 99 113 # dummy component to fulfill some parameters … … 503 517 dockSelf.layoutPanel = JPanel() # top: main controls bottom: hidden controls 504 518 dockSelf.layoutPanel.setLayout(BoxLayout(dockSelf.layoutPanel, BoxLayout.Y_AXIS)) 519 505 520 dockSelf.topPanel = JPanel() # the top panel 521 506 522 macDimH = 40 507 winDimH = 30523 winDimH = 50 508 524 macDimW = 900 509 winDimW = 800525 winDimW = 570 510 526 # Here we assume people are using either mac or windows. 511 527 # If I had a way to test for linux and tweak the sizes I'd do it here. … … 519 535 dockSelf.topPanel.setPreferredSize(Dimension(dimWidth, dimHeight)) 520 536 dockSelf.layoutPanel.add(dockSelf.topPanel) 521 dockSelf.buttonPanel = JPanel( ) # the panel for the buttons537 dockSelf.buttonPanel = JPanel(GridLayout(2, 5)) # the panel for the buttons 522 538 dockSelf.buttonPanel.setPreferredSize(Dimension(dimWidth, dimHeight)) 523 539 dockSelf.layoutPanel.add(dockSelf.buttonPanel) 524 540 dockSelf.bottomPanel = JPanel() # the bottom panel 525 dockSelf.bottomPanel.setPreferredSize(Dimension( 900, 280))541 dockSelf.bottomPanel.setPreferredSize(Dimension(dimWidth, dimHeight)) 526 542 dockSelf.layoutPanel.add(dockSelf.bottomPanel) 527 543 … … 533 549 obf = objectBoxFilter(dockSelf) 534 550 dockSelf.objectBox.addActionListener(obf) 551 535 552 536 553 # color panel … … 545 562 # create the color buttons 546 563 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 554 589 # size panel 555 dockSelf.sizePanel = JPanel(GridLayout(2 ,4))590 dockSelf.sizePanel = JPanel(GridLayout(20,20)) 556 591 557 592 # assuming this is for a node, do edges later … … 645 680 dockSelf.changeLabelButton.actionPerformed = lambda event: updateBottomPanel(GraphModifier.self, GraphModifier.self.changeLabelPanel) 646 681 682 #node style 683 dockSelf.nodeStyleButton = JButton("Node Shape") 684 dockSelf.nodeStyleButton.actionPerformed = lambda event: updateBottomPanel(GraphModifier.self, GraphModifier.self.nodeStylePanel) 685 647 686 # center button 648 687 dockSelf.centerButton = JButton("Center") … … 696 735 dockSelf.buttonPanel.add(dockSelf.hideLabelButton) 697 736 dockSelf.buttonPanel.add(dockSelf.changeLabelButton) 737 dockSelf.buttonPanel.add(dockSelf.nodeStyleButton) 698 738 dockSelf.buttonPanel.add(dockSelf.centerButton) 699 739 dockSelf.buttonPanel.add(dockSelf.changeHistoryButton) … … 733 773 changeAttribute(o) 734 774 o.colorPanel.setVisible(false) 775 776 # set the node style to change 777 def 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 735 788 736 789 # shows the specified objects … … 792 845 # change all edge colors 793 846 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 794 850 elif o.currentAction == "show": 795 851 # show all nodes … … 838 894 if o.currentAction == "color": 839 895 g.nodes.color = o.currentColor 896 elif o.currentAction == "node_style": 897 g.nodes.style = image_style 898 g.nodes.style = o.currentNodeStyle 840 899 elif o.currentAction == "show": 841 900 g.nodes.visible = true … … 858 917 if o.currentAction == "color": 859 918 g.edges.color = o.currentColor 919 elif o.currentAction == "node_style": 920 g.nodes.style = image_style 921 g.nodes.style = o.currentNodeStyle 860 922 elif o.currentAction == "show": 861 923 g.edges.visible = true … … 957 1019 tup[0].color = tup[1] 958 1020 1021 #change the style of the specified node 1022 def changeNodeStyle(tup): 1023 tup[0].style = image_style 1024 tup[0].style = tup[1] 1025 959 1026 # show the specified object 960 1027 def showIt(tup): … … 1028 1095 if action == "color": 1029 1096 historyCode = historyCode + "\ti.color = " + str(o.currentColor) + "\n" 1097 if action == "node_style": 1098 historyCode = historyCode + "\ti.style = " + str(o.currentNodeStyle) + "\n" 1030 1099 elif action == "hide": 1031 1100 historyCode = historyCode + "\ti.visible = false\n"
