| ||
| ° Home ° Forums ° Reply ° Statistics ° Sign Up ° Search ° Manual ° |
| PM forums / Creating Scripts for GanttPV / New Script: Color Chooser for Setting Plan Bar color |
| Author | Message |
| Joel Member |
# Posted: 14 Aug 2007 00:26:38 - I've created a script which lets you choose the Plan Bar color from a color picker dialog instead of manually typing in the hex string of the desired color. It is a small modification to Brian's original script. You can download it at: http://tools.assembla.com/ganttpv_scripts/browser/trunk/Bar%20Colors/C hoose%20Plan%20Bar%20Color.py Instructions: 1. At the link above click the "Plain Text" link at the bottom of the Trac page to download the file. 2. Save it to the "GanttPV/Scripts/Bar Colors" directory. 3. Open a Gantt Chart (new or existing) in GanttPV. 4. On the "Script" menu select "Bar Colors/Install Resource Plan Bar Color" 5. Select the row (or rows) of the Plan Bar(s) you want to change. 6. Go back to the "Script" menu and select "Bar Colors/Choose Plan Bar Color". 7. A color chooser will appear. Select a color and click "OK". 8. The bar(s) will change color. This script has been tested on GanttPV 0.7 on both Windows XP and Ubuntu Linux 6.10 Edgy. |
| Alexander Moderator |
# Posted: 3 Sep 2007 16:30:23 - Thank you, Joel! Your script works well. |
| Jim |
# Posted: 15 Feb 2008 11:05:36 - Joel, I got the following error message when I tried the script: Traceback (most recent call last): File "Data.pyo", line 2128, in RunScript File "C:Program FilesGanttPVScriptsBar ColorsChoose Plan Bar Color.py", line 110, in <module> SetPlanBarColor(self) File "C:Program FilesGanttPVScriptsBar ColorsChoose Plan Bar Color.py", line 92, in SetPlanBarColor newcolor = RGBToHTMLColor(str(clr)) File "C:Program FilesGanttPVScriptsBar ColorsChoose Plan Bar Color.py", line 38, in RGBToHTMLColor hexcolor = '%02x%02x%02x' % tuple([int(c) for c in wxColour[1:-1].split(",")]) TypeError: not all arguments converted during string formatting My e-mail address is jim.armstrong@att.com Thanks. Jim |
| DJ Webre Member |
# Posted: 6 Aug 2008 11:54:08 - Jim I received the same error message. I made a few revisions as follows: #!/usr/bin/env python # Choose Plan Bar Color.py # Copyright 2005 by Brian C. Christensen # Modified in 2007 by Joel L. Lawhead # This file is part of GanttPV. # # GanttPV is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # GanttPV is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GanttPV; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 050627 - Set the PlanBarColor in the report row # 070813 - Set the PlanBarColor in the report row using the wxColorDialog # 080805 - D. J. Webre - Revised to run on Win XP (return R, G, B in lieu of R, G, B, R) import wx import re def hint(s): try: Data.Hint("%s: %s" % (scriptname, s)) except AttributeError: self.SetStatusText(s) if debug: print 'Start Script' def RGBToHTMLColor(wxColour): """ convert a wxColour (R, G, B) string to RRGGBB hex""" hexcolor = '%02x%02x%02x' % tuple([int(c) for c in wxColour[1:-1].split(",")]) return hexcolor def SetPlanBarColor(self): # set local pointers to tables rid = self.ReportID # current report drep = Data.Database['Report'] drow = Data.Database['ReportRow'] drt = Data.Database['ReportType'] rr = drep[rid] # make sure report has report type if not rr.has_key('ReportTypeID') or not drt.has_key(rr['ReportTypeID']): if debug: print "ReportType key not found" hint("Error: Can't find type of this report.") return rtid = rr['ReportTypeID'] # is this a task report rt = drt[rtid] # pointer to report type record ta = rt.get('TableA') tb = rt.get('TableB') # if two table report all inserts go at the end (less confusing to user) if not (ta == 'Task' or tb == 'Task'): hint('Use script only with Task reports.') return # find the selected rows sel = self.Report.GetSelectedRows() # current selection if len(sel) <= 0: hint("Must select at least one task row.") return rows = self.Report.table.rows # get row ids for all task rows rids = [ rows[x] for x in sel if drow[rows[x]].get('TableName') == 'Task' ] if len(rids) < 1: hint("Must select at least one task row.") return if len(rids) == 1: # one row selected oldvalue = drow[rids[0]].get('PlanBarColor') if not oldvalue or not re.match('^[0-9A-F]{6}$', oldvalue): oldvalue = "" else: oldvalue = "" # prompt for new color #dlg = wx.ColourDialog(None) #dlg.GetColourData().SetChooseFull(True) dlg = wx.ColourDialog(self) dlg.GetColourData().SetChooseFull(True) if dlg.ShowModal() == wx.ID_OK: # edit new color #cd = dlg.GetColourData() #clr = cd.GetColour() data = dlg.GetColourData() clr = str(data.GetColour().Get()) if clr == '(0, 0, 0)': hint('Please select a basic color first.') else: hint(clr) newcolor = RGBToHTMLColor(str(clr)) newcolor = newcolor.upper() # set to uppercase hex if not (newcolor == "" or re.match('^[0-9A-F]{6}$', newcolor)): hint('Color must be six hexidecimal digits.') return if newcolor == "": newcolor = None # change all selected rows to new color for rowid in rids: if drow[rowid].get('PlanBarColor') != newcolor: change = { 'Table': 'ReportRow', 'ID': rowid, 'PlanBarColor': newcolor } Data.Update(change) Data.SetUndo('Set Plan Bar Color') #dlg.Destroy() SetPlanBarColor(self) if debug: print 'End Script' |
| Cedric Canierro Member |
# Posted: 6 Aug 2008 23:02:22 - i think i have to repeat your script, it doesn't work here |
| Brian Member |
# Posted: 7 Aug 2008 02:22:25 - The necessary indentations are not displayed in the above script. You can see what the indentation should be if you view the Page Source in your browser. |
| paper Member |
# Posted: 25 Aug 2010 22:27:21 - Ok, as soon as Ice Block wow power leveling expires you want to pop Frost Nova and Ice Barrier again as you strafe (don't wow power leveling backup, slower movement speed) out of the groups melee range. Now commence to laying on the AoE damage. Remeber that Mograine can't be Frost Nova'd so that is why you put your Ice Barrier back up since he will be beating on you while you are AoE killing his minions. Once wow power leveling all the minions are dead, Mograine should be less than 50% so finish him off. Immediately pop Evocation to refill aion kina mana because Whitemane is on her way. As long as you didn't end up close to her spawn point when you killed Mograine (practice will show you to finish buy wow gold Mograine towards the middle of the chamber) then you will get off a full Evocation for plenty more gold in wow mana. Now kill Whitemane and Mograine again when she resurrects him. You're done! This wow gold eu little run nets me 6-8g in change not to mention any vendor trash, greens, blues and cloth that drop off all the mobs you just wow gold cheap killed. Plus if you are an enchanter you can DE the Boss blues from cheap aion power leveling Scarlet Commander Mograine and HIgh Inquisitor Whitemane sell the shards in AH. This run take a whopping EVE ISK 10 minutes tops after you run it a few times to get patrol behaviors |
|
Powered by mini BB forum software © 2001-2010 |