3 #**************************************************************************
6 # Copyright (C) 2009 Euan Freeman <euan04@gmail.com>
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License version 3
10 # as published by the Free Software Foundation.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #*************************************************************************/
20 # Last modified: 7th March 2010
34 AUTHORS
= ["Euan Freeman <euan04@gmail.com>"]
36 COMMENTS
= "tintwizard generates config files for the lightweight panel replacement tint2"
37 WEBSITE
= "http://code.google.com/p/tintwizard/"
39 # Default values for text entry fields
49 PANEL_AUTOHIDE_SHOW
= "0.0"
50 PANEL_AUTOHIDE_HIDE
= "0.0"
51 PANEL_AUTOHIDE_HEIGHT
= "0"
52 TASKBAR_PADDING_X
= "0"
53 TASKBAR_PADDING_Y
= "0"
56 TASK_MAXIMUM_SIZE_X
= "200"
57 TASK_MAXIMUM_SIZE_Y
= "32"
64 TRAY_MAX_ICON_SIZE
= "0"
65 TRAY_ICON_ALPHA
= "100"
71 ACTIVE_ICON_ALPHA
= "100"
74 URGENT_ICON_ALPHA
= "100"
77 ICONIFIED_ICON_ALPHA
= "100"
78 ICONIFIED_ICON_SAT
= "0"
79 ICONIFIED_ICON_BRI
= "0"
81 CLOCK_FMT_2
= "%a %d %b"
83 CLOCK_TIME1_TIMEZONE
= ""
84 CLOCK_TIME2_TIMEZONE
= ""
85 CLOCK_TOOLTIP_TIMEZONE
= ""
90 TOOLTIP_PADDING_X
= "0"
91 TOOLTIP_PADDING_Y
= "0"
92 TOOLTIP_SHOW_TIMEOUT
= "0"
93 TOOLTIP_HIDE_TIMEOUT
= "0"
96 BATTERY_ACTION
= 'notify-send "battery low"'
97 BATTERY_PADDING_X
= "0"
98 BATTERY_PADDING_Y
= "0"
100 class TintWizardPrefGUI(gtk
.Window
):
101 """The dialog window which lets the user change the default preferences."""
102 def __init__(self
, tw
):
103 """Create and shows the window."""
106 # Create top-level window
107 gtk
.Window
.__init
__(self
, gtk
.WINDOW_TOPLEVEL
)
109 self
.set_title("Preferences")
110 self
.connect("delete_event", self
.quit
)
112 self
.layout
= gtk
.Table(2, 2, False)
114 self
.table
= gtk
.Table(5, 2, False)
115 self
.table
.set_row_spacings(5)
116 self
.table
.set_col_spacings(5)
118 temp
= gtk
.Label("Default Font")
119 temp
.set_alignment(0, 0.5)
120 self
.table
.attach(temp
, 0, 1, 0, 1)
121 self
.font
= gtk
.FontButton(self
.tw
.defaults
["font"])
122 self
.font
.set_alignment(0, 0.5)
123 self
.table
.attach(self
.font
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
125 temp
= gtk
.Label("Default Background Color")
126 temp
.set_alignment(0, 0.5)
127 self
.table
.attach(temp
, 0, 1, 1, 2)
128 self
.bgColor
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.tw
.defaults
["bgColor"]))
129 self
.bgColor
.set_alignment(0, 0.5)
130 self
.table
.attach(self
.bgColor
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
132 temp
= gtk
.Label("Default Foreground Color")
133 temp
.set_alignment(0, 0.5)
134 self
.table
.attach(temp
, 0, 1, 2, 3)
135 self
.fgColor
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.tw
.defaults
["fgColor"]))
136 self
.fgColor
.set_alignment(0, 0.5)
137 self
.table
.attach(self
.fgColor
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
139 temp
= gtk
.Label("Default Border Color")
140 temp
.set_alignment(0, 0.5)
141 self
.table
.attach(temp
, 0, 1, 3, 4)
142 self
.borderColor
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.tw
.defaults
["borderColor"]))
143 self
.borderColor
.set_alignment(0, 0.5)
144 self
.table
.attach(self
.borderColor
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
146 temp
= gtk
.Label("Number of Background Styles")
147 temp
.set_alignment(0, 0.5)
148 self
.table
.attach(temp
, 0, 1, 4, 5)
149 self
.bgCount
= gtk
.Entry(6)
150 self
.bgCount
.set_width_chars(8)
151 self
.bgCount
.set_text(str(self
.tw
.defaults
["bgCount"]))
152 self
.table
.attach(self
.bgCount
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
154 temp
= gtk
.Label("Default directory")
155 temp
.set_alignment(0, 0.5)
156 self
.table
.attach(temp
, 0, 1, 5, 6)
157 self
.dir = gtk
.Button(self
.tw
.defaults
["dir"])
158 self
.dir.connect("clicked", self
.chooseFolder
)
159 self
.table
.attach(self
.dir, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
161 self
.layout
.attach(self
.table
, 0, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
, xpadding
=20, ypadding
=5)
163 temp
= gtk
.Button("Save", gtk
.STOCK_SAVE
)
164 temp
.set_name("save")
165 temp
.connect("clicked", self
.save
)
166 self
.layout
.attach(temp
, 0, 1, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
, ypadding
=20)
167 temp
= gtk
.Button("Cancel", gtk
.STOCK_CANCEL
)
168 temp
.set_name("cancel")
169 temp
.connect("clicked", self
.quit
)
170 self
.layout
.attach(temp
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
, ypadding
=20)
172 self
.add(self
.layout
)
176 def chooseFolder(self
, widget
=None, direction
=None):
177 """Called every time the folder button is clicked. Shows a file chooser."""
178 chooser
= gtk
.FileChooserDialog("Choose Default Folder", self
, gtk
.FILE_CHOOSER_ACTION_SELECT_FOLDER
, (gtk
.STOCK_CANCEL
, gtk
.RESPONSE_CANCEL
, gtk
.STOCK_OPEN
, gtk
.RESPONSE_OK
))
179 chooser
.set_default_response(gtk
.RESPONSE_OK
)
181 if self
.tw
.curDir
!= None:
182 chooser
.set_current_folder(self
.tw
.curDir
)
186 response
= chooser
.run()
188 if response
== gtk
.RESPONSE_OK
:
189 self
.dir.set_label(chooser
.get_filename())
196 def quit(self
, widget
=None, event
=None):
197 """Destroys the window."""
200 def save(self
, action
=None):
201 """Called when the Save button is clicked."""
202 if confirmDialog(self
, "Overwrite configuration file?") == gtk
.RESPONSE_YES
:
203 self
.tw
.defaults
["font"] = self
.font
.get_font_name()
204 self
.tw
.defaults
["bgColor"] = rgbToHex(self
.bgColor
.get_color().red
, self
.bgColor
.get_color().green
, self
.bgColor
.get_color().blue
)
205 self
.tw
.defaults
["fgColor"] = rgbToHex(self
.fgColor
.get_color().red
, self
.fgColor
.get_color().green
, self
.fgColor
.get_color().blue
)
206 self
.tw
.defaults
["borderColor"] = rgbToHex(self
.borderColor
.get_color().red
, self
.borderColor
.get_color().green
, self
.borderColor
.get_color().blue
)
209 self
.tw
.defaults
["bgCount"] = int(self
.bgCount
.get_text())
211 errorDialog(self
, "Invalid value for background count")
214 self
.tw
.defaults
["dir"] = self
.dir.get_label()
215 self
.curDir
= self
.tw
.defaults
["dir"]
221 class TintWizardGUI(gtk
.Window
):
222 """The main window for the application."""
224 """Create and show the window."""
229 if len(sys
.argv
) > 1:
230 self
.filename
= sys
.argv
[1]
231 self
.oneConfigFile
= True
233 self
.oneConfigFile
= False
235 # Read conf file and set default values
238 if self
.defaults
["bgColor"] in [None, "None"]:
239 self
.defaults
["bgColor"] = "#000000"
241 if self
.defaults
["fgColor"] in [None, "None"]:
242 self
.defaults
["fgColor"] = "#ffffff"
244 if self
.defaults
["borderColor"] in [None, "None"]:
245 self
.defaults
["borderColor"] = "#ffffff"
247 if self
.defaults
["dir"] in [None, "None"]:
248 if os
.path
.exists(os
.path
.expandvars("${HOME}") + "/.config/tint2"):
249 self
.curDir
= os
.path
.expandvars("${HOME}") + "/.config/tint2"
253 self
.curDir
= os
.path
.expandvars(self
.defaults
["dir"])
255 if not os
.path
.exists(os
.path
.expandvars(self
.curDir
)):
256 if os
.path
.exists(os
.path
.expandvars("${HOME}") + "/.config/tint2"):
257 self
.curDir
= os
.path
.expandvars("${HOME}") + "/.config/tint2"
262 self
.defaults
["bgCount"] = int(self
.defaults
["bgCount"])
264 self
.defaults
["bgCount"] = 2
266 # Get the full location of the tint2 binary
267 which
= os
.popen('which tint2')
269 self
.tint2Bin
= which
.readline().strip()
273 if len(self
.tint2Bin
) == 0:
274 errorDialog(self
, "tint2 could not be found. Are you sure it is installed?")
277 # Create top-level window
278 gtk
.Window
.__init
__(self
, gtk
.WINDOW_TOPLEVEL
)
280 self
.set_title("tintwizard")
282 self
.connect("delete_event", self
.quit
)
284 # self.table is our main layout manager
285 self
.table
= gtk
.Table(4, 1, False)
287 # Create menus and toolbar items
290 <menubar name="MenuBar">
292 <menuitem action="New" />
293 <menuitem action="Open" />
295 <menuitem action="Save" />
296 <menuitem action="Save As..." />
298 <menuitem action="Quit" />
300 <menu action="Tint2">
301 <menuitem action="OpenDefault" />
302 <menuitem action="SaveDefault" />
304 <menuitem action="Apply" />
306 <menu action="Tools">
307 <menuitem action="FontChange" />
309 <menuitem action="Defaults" />
311 <menu action="HelpMenu">
312 <menuitem action="Help" />
313 <menuitem action="Report Bug" />
315 <menuitem action="About" />
318 <toolbar name="ToolBar">
319 <toolitem action="New" />
320 <toolitem action="Open" />
321 <toolitem action="Save" />
323 <toolitem action="Apply" />
329 self
.uiManager
= gtk
.UIManager()
331 accelGroup
= self
.uiManager
.get_accel_group()
332 self
.add_accel_group(accelGroup
)
334 self
.ag
= gtk
.ActionGroup("File")
335 self
.ag
.add_actions([("File", None, "_File"),
336 ("New",gtk
.STOCK_NEW
, "_New", None, "Create a new config", self
.new
),
337 ("Open", gtk
.STOCK_OPEN
, "_Open", None, "Open an existing config", self
.openFile
),
338 ("Save", gtk
.STOCK_SAVE
, "_Save", None, "Save the current config", self
.save
),
339 ("Save As...", gtk
.STOCK_SAVE_AS
, "Save As", None, "Save the current config as...", self
.saveAs
),
340 ("SaveDefault", None, "Save As tint2 Default", None, "Save the current config as the tint2 default", self
.saveAsDef
),
341 ("OpenDefault", None, "Open tint2 Default", None, "Open the current tint2 default config", self
.openDef
),
342 ("Apply", gtk
.STOCK_APPLY
, "Apply Config", None, "Apply the current config to tint2", self
.apply),
343 ("Quit", gtk
.STOCK_QUIT
, "_Quit", None, "Quit the program", self
.quit
),
344 ("Tools", None, "_Tools"),
345 ("Tint2", None, "Tint_2"),
346 ("HelpMenu", None, "_Help"),
347 ("FontChange",gtk
.STOCK_SELECT_FONT
, "Change All Fonts", None, "Change all fonts at once.", self
.changeAllFonts
),
348 ("Defaults",gtk
.STOCK_PREFERENCES
, "Change Defaults", None, "Change tintwizard defaults.", self
.changeDefaults
),
349 ("Help",gtk
.STOCK_HELP
, "_Help", None, "Get help with tintwizard", self
.help),
350 ("Report Bug",None, "Report Bug", None, "Report a problem with tintwizard", self
.reportBug
),
351 ("About",gtk
.STOCK_ABOUT
, "_About Tint Wizard", None, "Find out more about Tint Wizard", self
.about
)])
354 self
.uiManager
.insert_action_group(self
.ag
, -1)
355 self
.uiManager
.add_ui_from_string(ui
)
357 if not self
.oneConfigFile
:
358 # Attach menubar and toolbar to main window
359 self
.table
.attach(self
.uiManager
.get_widget("/MenuBar"), 0, 4, 0, 1)
360 self
.table
.attach(self
.uiManager
.get_widget("/ToolBar"), 0, 4, 1, 2)
363 self
.notebook
= gtk
.Notebook()
364 self
.notebook
.set_tab_pos(gtk
.POS_TOP
)
366 # Create notebook pages
368 self
.tableBgs
= gtk
.Table(rows
=1, columns
=1, homogeneous
=False)
369 self
.tableBgs
.set_row_spacings(5)
370 self
.tableBgs
.set_col_spacings(5)
372 self
.bgNotebook
= gtk
.Notebook()
373 self
.bgNotebook
.set_scrollable(True)
375 self
.tableBgs
.attach(self
.bgNotebook
, 0, 2, 0, 1)
379 # Add buttons for adding/deleting background styles
380 temp
= gtk
.Button("New Background", gtk
.STOCK_NEW
)
381 temp
.set_name("addBg")
382 temp
.connect("clicked", self
.addBgClick
)
383 self
.tableBgs
.attach(temp
, 0, 1, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
384 temp
= gtk
.Button("Delete Background", gtk
.STOCK_DELETE
)
385 temp
.set_name("delBg")
386 temp
.connect("clicked", self
.delBgClick
)
387 self
.tableBgs
.attach(temp
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
390 self
.tablePanelDisplay
= gtk
.Table(rows
=6, columns
=3, homogeneous
=False)
391 self
.tablePanelDisplay
.set_row_spacings(5)
392 self
.tablePanelDisplay
.set_col_spacings(5)
394 temp
= gtk
.Label("Position")
395 temp
.set_alignment(0, 0.5)
396 self
.tablePanelDisplay
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
397 self
.panelPosY
= gtk
.combo_box_new_text()
398 self
.panelPosY
.append_text("bottom")
399 self
.panelPosY
.append_text("top")
400 self
.panelPosY
.append_text("center")
401 self
.panelPosY
.set_active(0)
402 self
.panelPosY
.connect("changed", self
.changeOccurred
)
403 self
.tablePanelDisplay
.attach(self
.panelPosY
, 2, 3, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
404 self
.panelPosX
= gtk
.combo_box_new_text()
405 self
.panelPosX
.append_text("left")
406 self
.panelPosX
.append_text("right")
407 self
.panelPosX
.append_text("center")
408 self
.panelPosX
.set_active(0)
409 self
.panelPosX
.connect("changed", self
.changeOccurred
)
410 self
.tablePanelDisplay
.attach(self
.panelPosX
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
412 temp
= gtk
.Label("Panel Orientation")
413 temp
.set_alignment(0, 0.5)
414 self
.tablePanelDisplay
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
415 self
.panelOrientation
= gtk
.combo_box_new_text()
416 self
.panelOrientation
.append_text("horizontal")
417 self
.panelOrientation
.append_text("vertical")
418 self
.panelOrientation
.set_active(0)
419 self
.panelOrientation
.connect("changed", self
.changeOccurred
)
420 self
.tablePanelDisplay
.attach(self
.panelOrientation
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
422 self
.panelSizeLabel
= gtk
.Label("Size (width, height)")
423 self
.panelSizeLabel
.set_alignment(0, 0.5)
424 self
.tablePanelDisplay
.attach(self
.panelSizeLabel
, 0, 1, 2, 3, xpadding
=10)
425 self
.panelSizeX
= gtk
.Entry(6)
426 self
.panelSizeX
.set_width_chars(8)
427 self
.panelSizeX
.set_text(PANEL_SIZE_X
)
428 self
.panelSizeX
.connect("changed", self
.changeOccurred
)
429 self
.tablePanelDisplay
.attach(self
.panelSizeX
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
430 self
.panelSizeY
= gtk
.Entry(6)
431 self
.panelSizeY
.set_width_chars(8)
432 self
.panelSizeY
.set_text(PANEL_SIZE_Y
)
433 self
.panelSizeY
.connect("changed", self
.changeOccurred
)
434 self
.tablePanelDisplay
.attach(self
.panelSizeY
, 2, 3, 2, 3, xoptions
=gtk
.EXPAND
)
436 temp
= gtk
.Label("Margin (x, y)")
437 temp
.set_alignment(0, 0.5)
438 self
.tablePanelDisplay
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
439 self
.panelMarginX
= gtk
.Entry(6)
440 self
.panelMarginX
.set_width_chars(8)
441 self
.panelMarginX
.set_text(PANEL_MARGIN_X
)
442 self
.panelMarginX
.connect("changed", self
.changeOccurred
)
443 self
.tablePanelDisplay
.attach(self
.panelMarginX
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
444 self
.panelMarginY
= gtk
.Entry(6)
445 self
.panelMarginY
.set_width_chars(8)
446 self
.panelMarginY
.set_text(PANEL_MARGIN_Y
)
447 self
.panelMarginY
.connect("changed", self
.changeOccurred
)
448 self
.tablePanelDisplay
.attach(self
.panelMarginY
, 2, 3, 3, 4, xoptions
=gtk
.EXPAND
)
450 temp
= gtk
.Label("Padding (x, y)")
451 temp
.set_alignment(0, 0.5)
452 self
.tablePanelDisplay
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
453 self
.panelPadX
= gtk
.Entry(6)
454 self
.panelPadX
.set_width_chars(8)
455 self
.panelPadX
.set_text(PANEL_PADDING_Y
)
456 self
.panelPadX
.connect("changed", self
.changeOccurred
)
457 self
.tablePanelDisplay
.attach(self
.panelPadX
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
458 self
.panelPadY
= gtk
.Entry(6)
459 self
.panelPadY
.set_width_chars(8)
460 self
.panelPadY
.set_text(PANEL_PADDING_Y
)
461 self
.panelPadY
.connect("changed", self
.changeOccurred
)
462 self
.tablePanelDisplay
.attach(self
.panelPadY
, 2, 3, 4, 5, xoptions
=gtk
.EXPAND
)
464 temp
= gtk
.Label("Panel Background ID")
465 temp
.set_alignment(0, 0.5)
466 self
.tablePanelDisplay
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
467 self
.panelBg
= gtk
.combo_box_new_text()
468 self
.panelBg
.append_text("0 (fully transparent)")
469 for i
in range(len(self
.bgs
)):
470 self
.panelBg
.append_text(str(i
+1))
471 self
.panelBg
.set_active(0)
472 self
.panelBg
.connect("changed", self
.changeOccurred
)
473 self
.tablePanelDisplay
.attach(self
.panelBg
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
476 self
.tablePanelSettings
= gtk
.Table(rows
=5, columns
=3, homogeneous
=False)
477 self
.tablePanelSettings
.set_row_spacings(5)
478 self
.tablePanelSettings
.set_col_spacings(5)
480 temp
= gtk
.Label("Window Manager Menu")
481 temp
.set_alignment(0, 0.5)
482 self
.tablePanelSettings
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
483 self
.panelMenu
= gtk
.CheckButton()
484 self
.panelMenu
.set_active(False)
485 self
.panelMenu
.connect("toggled", self
.changeOccurred
)
486 self
.tablePanelSettings
.attach(self
.panelMenu
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
488 temp
= gtk
.Label("Place In Window Manager Dock")
489 temp
.set_alignment(0, 0.5)
490 self
.tablePanelSettings
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
491 self
.panelDock
= gtk
.CheckButton()
492 self
.panelDock
.set_active(False)
493 self
.panelDock
.connect("toggled", self
.changeOccurred
)
494 self
.tablePanelSettings
.attach(self
.panelDock
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
496 temp
= gtk
.Label("Panel Layer")
497 temp
.set_alignment(0, 0.5)
498 self
.tablePanelSettings
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
499 self
.panelLayer
= gtk
.combo_box_new_text()
500 self
.panelLayer
.append_text("bottom")
501 self
.panelLayer
.append_text("top")
502 self
.panelLayer
.append_text("normal")
503 self
.panelLayer
.set_active(0)
504 self
.panelLayer
.connect("changed", self
.changeOccurred
)
505 self
.tablePanelSettings
.attach(self
.panelLayer
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
507 temp
= gtk
.Label("Strut Policy")
508 temp
.set_alignment(0, 0.5)
509 self
.tablePanelSettings
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
510 self
.panelAutohideStrut
= gtk
.combo_box_new_text()
511 self
.panelAutohideStrut
.append_text("none")
512 self
.panelAutohideStrut
.append_text("minimum")
513 self
.panelAutohideStrut
.append_text("follow_size")
514 self
.panelAutohideStrut
.set_active(0)
515 self
.panelAutohideStrut
.connect("changed", self
.changeOccurred
)
516 self
.tablePanelSettings
.attach(self
.panelAutohideStrut
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
518 temp
= gtk
.Label("Panel Monitor (all, 1, 2...)")
519 temp
.set_alignment(0, 0.5)
520 self
.tablePanelSettings
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
521 self
.panelMonitor
= gtk
.Entry(6)
522 self
.panelMonitor
.set_width_chars(8)
523 self
.panelMonitor
.set_text(PANEL_MONITOR
)
524 self
.panelMonitor
.connect("changed", self
.changeOccurred
)
525 self
.tablePanelSettings
.attach(self
.panelMonitor
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
528 self
.tablePanelAutohide
= gtk
.Table(rows
=4, columns
=3, homogeneous
=False)
529 self
.tablePanelAutohide
.set_row_spacings(5)
530 self
.tablePanelAutohide
.set_col_spacings(5)
532 temp
= gtk
.Label("Autohide Panel")
533 temp
.set_alignment(0, 0.5)
534 self
.tablePanelAutohide
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
535 self
.panelAutohide
= gtk
.CheckButton()
536 self
.panelAutohide
.set_active(False)
537 self
.panelAutohide
.connect("toggled", self
.changeOccurred
)
538 self
.tablePanelAutohide
.attach(self
.panelAutohide
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
540 temp
= gtk
.Label("Autohide Show Timeout (seconds)")
541 temp
.set_alignment(0, 0.5)
542 self
.tablePanelAutohide
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
543 self
.panelAutohideShow
= gtk
.Entry(6)
544 self
.panelAutohideShow
.set_width_chars(8)
545 self
.panelAutohideShow
.set_text(PANEL_AUTOHIDE_SHOW
)
546 self
.panelAutohideShow
.connect("changed", self
.changeOccurred
)
547 self
.tablePanelAutohide
.attach(self
.panelAutohideShow
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
549 temp
= gtk
.Label("Autohide Hide Timeout (seconds)")
550 temp
.set_alignment(0, 0.5)
551 self
.tablePanelAutohide
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
552 self
.panelAutohideHide
= gtk
.Entry(6)
553 self
.panelAutohideHide
.set_width_chars(8)
554 self
.panelAutohideHide
.set_text(PANEL_AUTOHIDE_HIDE
)
555 self
.panelAutohideHide
.connect("changed", self
.changeOccurred
)
556 self
.tablePanelAutohide
.attach(self
.panelAutohideHide
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
558 temp
= gtk
.Label("Autohide Hidden Height")
559 temp
.set_alignment(0, 0.5)
560 self
.tablePanelAutohide
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
561 self
.panelAutohideHeight
= gtk
.Entry(6)
562 self
.panelAutohideHeight
.set_width_chars(8)
563 self
.panelAutohideHeight
.set_text(PANEL_AUTOHIDE_HEIGHT
)
564 self
.panelAutohideHeight
.connect("changed", self
.changeOccurred
)
565 self
.tablePanelAutohide
.attach(self
.panelAutohideHeight
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
570 self
.tableTaskbar
= gtk
.Table(rows
=5, columns
=3, homogeneous
=False)
571 self
.tableTaskbar
.set_row_spacings(5)
572 self
.tableTaskbar
.set_col_spacings(5)
574 temp
= gtk
.Label("Taskbar Mode")
575 temp
.set_alignment(0, 0.5)
576 self
.tableTaskbar
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
577 self
.taskbarMode
= gtk
.combo_box_new_text()
578 self
.taskbarMode
.append_text("single_desktop")
579 self
.taskbarMode
.append_text("multi_desktop")
580 self
.taskbarMode
.set_active(0)
581 self
.taskbarMode
.connect("changed", self
.changeOccurred
)
582 self
.tableTaskbar
.attach(self
.taskbarMode
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
584 temp
= gtk
.Label("Padding (x, y)")
585 temp
.set_alignment(0, 0.5)
586 self
.tableTaskbar
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
587 self
.taskbarPadX
= gtk
.Entry(6)
588 self
.taskbarPadX
.set_width_chars(8)
589 self
.taskbarPadX
.set_text(TASKBAR_PADDING_X
)
590 self
.taskbarPadX
.connect("changed", self
.changeOccurred
)
591 self
.tableTaskbar
.attach(self
.taskbarPadX
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
592 self
.taskbarPadY
= gtk
.Entry(6)
593 self
.taskbarPadY
.set_width_chars(8)
594 self
.taskbarPadY
.set_text(TASKBAR_PADDING_Y
)
595 self
.taskbarPadY
.connect("changed", self
.changeOccurred
)
596 self
.tableTaskbar
.attach(self
.taskbarPadY
, 2, 3, 1, 2, xoptions
=gtk
.EXPAND
)
598 temp
= gtk
.Label("Horizontal Spacing")
599 temp
.set_alignment(0, 0.5)
600 self
.tableTaskbar
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
601 self
.panelSpacing
= gtk
.Entry(6)
602 self
.panelSpacing
.set_width_chars(8)
603 self
.panelSpacing
.set_text(TASKBAR_SPACING
)
604 self
.panelSpacing
.connect("changed", self
.changeOccurred
)
605 self
.tableTaskbar
.attach(self
.panelSpacing
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
607 temp
= gtk
.Label("Taskbar Background ID")
608 temp
.set_alignment(0, 0.5)
609 self
.tableTaskbar
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
610 self
.taskbarBg
= gtk
.combo_box_new_text()
611 self
.taskbarBg
.append_text("0 (fully transparent)")
612 for i
in range(len(self
.bgs
)):
613 self
.taskbarBg
.append_text(str(i
+1))
614 self
.taskbarBg
.set_active(0)
615 self
.taskbarBg
.connect("changed", self
.changeOccurred
)
616 self
.tableTaskbar
.attach(self
.taskbarBg
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
618 temp
= gtk
.Label("Active Taskbar Background ID")
619 temp
.set_alignment(0, 0.5)
620 self
.tableTaskbar
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
621 self
.taskbarActiveBg
= gtk
.combo_box_new_text()
622 self
.taskbarActiveBg
.append_text("0 (fully transparent)")
623 for i
in range(len(self
.bgs
)):
624 self
.taskbarActiveBg
.append_text(str(i
+1))
625 self
.taskbarActiveBg
.set_active(0)
626 self
.taskbarActiveBg
.connect("changed", self
.changeOccurred
)
627 self
.tableTaskbar
.attach(self
.taskbarActiveBg
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
628 self
.taskbarActiveBgEnable
= gtk
.CheckButton("Enable")
629 self
.taskbarActiveBgEnable
.set_active(False)
630 self
.taskbarActiveBgEnable
.connect("toggled", self
.changeOccurred
)
631 self
.tableTaskbar
.attach(self
.taskbarActiveBgEnable
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
)
634 self
.tableTask
= gtk
.Table(rows
=12, columns
=3, homogeneous
=False)
635 self
.tableTask
.set_row_spacings(5)
636 self
.tableTask
.set_col_spacings(5)
638 temp
= gtk
.Label("Number of 'Blinks' on Urgent Event")
639 temp
.set_alignment(0, 0.5)
640 self
.tableTask
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
641 self
.taskBlinks
= gtk
.Entry(6)
642 self
.taskBlinks
.set_width_chars(8)
643 self
.taskBlinks
.set_text(TASK_BLINKS
)
644 self
.taskBlinks
.connect("changed", self
.changeOccurred
)
645 self
.tableTask
.attach(self
.taskBlinks
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
647 temp
= gtk
.Label("Show Icons")
648 temp
.set_alignment(0, 0.5)
649 self
.tableTask
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
650 self
.taskIconCheckButton
= gtk
.CheckButton()
651 self
.taskIconCheckButton
.set_active(True)
652 self
.taskIconCheckButton
.connect("toggled", self
.changeOccurred
)
653 self
.tableTask
.attach(self
.taskIconCheckButton
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
655 temp
= gtk
.Label("Show Text")
656 temp
.set_alignment(0, 0.5)
657 self
.tableTask
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
658 self
.taskTextCheckButton
= gtk
.CheckButton()
659 self
.taskTextCheckButton
.set_active(True)
660 self
.taskTextCheckButton
.connect("toggled", self
.changeOccurred
)
661 self
.tableTask
.attach(self
.taskTextCheckButton
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
663 temp
= gtk
.Label("Centre Text")
664 temp
.set_alignment(0, 0.5)
665 self
.tableTask
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
666 self
.taskCentreCheckButton
= gtk
.CheckButton()
667 self
.taskCentreCheckButton
.set_active(True)
668 self
.taskCentreCheckButton
.connect("toggled", self
.changeOccurred
)
669 self
.tableTask
.attach(self
.taskCentreCheckButton
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
671 temp
= gtk
.Label("Font")
672 temp
.set_alignment(0, 0.5)
673 self
.tableTask
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
674 self
.fontButton
= gtk
.FontButton()
676 if self
.defaults
["font"] in [None, "None"]: # If there was no font specified in the config file
677 self
.defaults
["font"] = self
.fontButton
.get_font_name() # Use the gtk default
679 self
.fontButton
.set_font_name(self
.defaults
["font"])
680 self
.fontButton
.connect("font-set", self
.changeOccurred
)
681 self
.tableTask
.attach(self
.fontButton
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
683 temp
= gtk
.Label("Show Font Shadow")
684 temp
.set_alignment(0, 0.5)
685 self
.tableTask
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
686 self
.fontShadowCheckButton
= gtk
.CheckButton()
687 self
.fontShadowCheckButton
.set_active(False)
688 self
.fontShadowCheckButton
.connect("toggled", self
.changeOccurred
)
689 self
.tableTask
.attach(self
.fontShadowCheckButton
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
691 temp
= gtk
.Label("Maximum Size (x, y)")
692 temp
.set_alignment(0, 0.5)
693 self
.tableTask
.attach(temp
, 0, 1, 6, 7, xpadding
=10)
694 self
.taskMaxSizeX
= gtk
.Entry(6)
695 self
.taskMaxSizeX
.set_width_chars(8)
696 self
.taskMaxSizeX
.set_text(TASK_MAXIMUM_SIZE_X
)
697 self
.taskMaxSizeX
.connect("changed", self
.changeOccurred
)
698 self
.tableTask
.attach(self
.taskMaxSizeX
, 1, 2, 6, 7, xoptions
=gtk
.EXPAND
)
699 self
.taskMaxSizeY
= gtk
.Entry(6)
700 self
.taskMaxSizeY
.set_width_chars(8)
701 self
.taskMaxSizeY
.set_text(TASK_MAXIMUM_SIZE_Y
)
702 self
.taskMaxSizeY
.connect("changed", self
.changeOccurred
)
703 self
.tableTask
.attach(self
.taskMaxSizeY
, 2, 3, 6, 7, xoptions
=gtk
.EXPAND
)
705 temp
= gtk
.Label("Padding (x, y)")
706 temp
.set_alignment(0, 0.5)
707 self
.tableTask
.attach(temp
, 0, 1, 7, 8, xpadding
=10)
708 self
.taskPadX
= gtk
.Entry(6)
709 self
.taskPadX
.set_width_chars(8)
710 self
.taskPadX
.set_text(TASK_PADDING_X
)
711 self
.taskPadX
.connect("changed", self
.changeOccurred
)
712 self
.tableTask
.attach(self
.taskPadX
, 1, 2, 7, 8, xoptions
=gtk
.EXPAND
)
713 self
.taskPadY
= gtk
.Entry(6)
714 self
.taskPadY
.set_width_chars(8)
715 self
.taskPadY
.set_text(TASK_PADDING_Y
)
716 self
.taskPadY
.connect("changed", self
.changeOccurred
)
717 self
.tableTask
.attach(self
.taskPadY
, 2, 3, 7, 8, xoptions
=gtk
.EXPAND
)
719 temp
= gtk
.Label("Horizontal Spacing")
720 temp
.set_alignment(0, 0.5)
721 self
.tableTask
.attach(temp
, 0, 1, 8, 9, xpadding
=10)
722 self
.taskbarSpacing
= gtk
.Entry(6)
723 self
.taskbarSpacing
.set_width_chars(8)
724 self
.taskbarSpacing
.set_text(TASK_SPACING
)
725 self
.taskbarSpacing
.connect("changed", self
.changeOccurred
)
726 self
.tableTask
.attach(self
.taskbarSpacing
, 1, 2, 8, 9, xoptions
=gtk
.EXPAND
)
729 self
.tableTaskDefault
= gtk
.Table(rows
=6, columns
=3, homogeneous
=False)
730 self
.tableTaskDefault
.set_row_spacings(5)
731 self
.tableTaskDefault
.set_col_spacings(5)
733 temp
= gtk
.Label("Normal Task Background ID")
734 temp
.set_alignment(0, 0.5)
735 self
.tableTaskDefault
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
736 self
.taskBg
= gtk
.combo_box_new_text()
737 self
.taskBg
.append_text("0 (fully transparent)")
738 for i
in range(len(self
.bgs
)):
739 self
.taskBg
.append_text(str(i
+1))
740 self
.taskBg
.set_active(0)
741 self
.taskBg
.connect("changed", self
.changeOccurred
)
742 self
.tableTaskDefault
.attach(self
.taskBg
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
744 temp
= gtk
.Label("Note: Default values of 0 for each of these settings leaves icons unchanged!")
745 temp
.set_alignment(0, 0.5)
746 self
.tableTaskDefault
.attach(temp
, 0, 3, 1, 2, xpadding
=10)
748 temp
= gtk
.Label("Normal Icon Alpha (0 to 100)")
749 temp
.set_alignment(0, 0.5)
750 self
.tableTaskDefault
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
751 self
.iconHue
= gtk
.Entry(6)
752 self
.iconHue
.set_width_chars(8)
753 self
.iconHue
.set_text(ICON_ALPHA
)
754 self
.iconHue
.connect("changed", self
.changeOccurred
)
755 self
.tableTaskDefault
.attach(self
.iconHue
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
757 temp
= gtk
.Label("Normal Icon Saturation (-100 to 100)")
758 temp
.set_alignment(0, 0.5)
759 self
.tableTaskDefault
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
760 self
.iconSat
= gtk
.Entry(6)
761 self
.iconSat
.set_width_chars(8)
762 self
.iconSat
.set_text(ICON_SAT
)
763 self
.iconSat
.connect("changed", self
.changeOccurred
)
764 self
.tableTaskDefault
.attach(self
.iconSat
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
766 temp
= gtk
.Label("Normal Icon Brightness (-100 to 100)")
767 temp
.set_alignment(0, 0.5)
768 self
.tableTaskDefault
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
769 self
.iconBri
= gtk
.Entry(6)
770 self
.iconBri
.set_width_chars(8)
771 self
.iconBri
.set_text(ICON_BRI
)
772 self
.iconBri
.connect("changed", self
.changeOccurred
)
773 self
.tableTaskDefault
.attach(self
.iconBri
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
775 temp
= gtk
.Label("Normal Font Color")
776 temp
.set_alignment(0, 0.5)
777 self
.tableTaskDefault
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
778 self
.fontCol
= gtk
.Entry(7)
779 self
.fontCol
.set_width_chars(9)
780 self
.fontCol
.set_name("fontCol")
781 self
.fontCol
.connect("activate", self
.colorTyped
)
782 self
.tableTaskDefault
.attach(self
.fontCol
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
783 self
.fontColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
784 self
.fontColButton
.set_use_alpha(True)
785 self
.fontColButton
.set_name("fontCol")
786 self
.fontColButton
.connect("color-set", self
.colorChange
)
787 self
.tableTaskDefault
.attach(self
.fontColButton
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
788 self
.fontCol
.set_text(self
.defaults
["fgColor"])
789 # Add this AFTER we set color to avoid "changed" event
790 self
.fontCol
.connect("changed", self
.changeOccurred
)
793 self
.tableTaskActive
= gtk
.Table(rows
=6, columns
=3, homogeneous
=False)
794 self
.tableTaskActive
.set_row_spacings(5)
795 self
.tableTaskActive
.set_col_spacings(5)
797 temp
= gtk
.Label("Active Task Background ID")
798 temp
.set_alignment(0, 0.5)
799 self
.tableTaskActive
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
800 self
.taskActiveBg
= gtk
.combo_box_new_text()
801 self
.taskActiveBg
.append_text("0 (fully transparent)")
802 for i
in range(len(self
.bgs
)):
803 self
.taskActiveBg
.append_text(str(i
+1))
804 self
.taskActiveBg
.set_active(0)
805 self
.taskActiveBg
.connect("changed", self
.changeOccurred
)
806 self
.tableTaskActive
.attach(self
.taskActiveBg
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
808 temp
= gtk
.Label("Note: Default values of 0 for each of these settings leaves icons unchanged!")
809 temp
.set_alignment(0, 0.5)
810 self
.tableTaskActive
.attach(temp
, 0, 3, 1, 2, xpadding
=10)
812 temp
= gtk
.Label("Active Icon Alpha (0 to 100)")
813 temp
.set_alignment(0, 0.5)
814 self
.tableTaskActive
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
815 self
.activeIconHue
= gtk
.Entry(6)
816 self
.activeIconHue
.set_width_chars(8)
817 self
.activeIconHue
.set_text(ACTIVE_ICON_ALPHA
)
818 self
.activeIconHue
.connect("changed", self
.changeOccurred
)
819 self
.tableTaskActive
.attach(self
.activeIconHue
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
821 temp
= gtk
.Label("Active Icon Saturation (-100 to 100)")
822 temp
.set_alignment(0, 0.5)
823 self
.tableTaskActive
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
824 self
.activeIconSat
= gtk
.Entry(6)
825 self
.activeIconSat
.set_width_chars(8)
826 self
.activeIconSat
.set_text(ACTIVE_ICON_SAT
)
827 self
.activeIconSat
.connect("changed", self
.changeOccurred
)
828 self
.tableTaskActive
.attach(self
.activeIconSat
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
830 temp
= gtk
.Label("Active Icon Brightness (-100 to 100)")
831 temp
.set_alignment(0, 0.5)
832 self
.tableTaskActive
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
833 self
.activeIconBri
= gtk
.Entry(6)
834 self
.activeIconBri
.set_width_chars(8)
835 self
.activeIconBri
.set_text(ACTIVE_ICON_BRI
)
836 self
.activeIconBri
.connect("changed", self
.changeOccurred
)
837 self
.tableTaskActive
.attach(self
.activeIconBri
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
839 temp
= gtk
.Label("Active Font Color")
840 temp
.set_alignment(0, 0.5)
841 self
.tableTaskActive
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
842 self
.fontActiveCol
= gtk
.Entry(7)
843 self
.fontActiveCol
.set_width_chars(9)
844 self
.fontActiveCol
.set_name("fontActiveCol")
845 self
.fontActiveCol
.connect("activate", self
.colorTyped
)
846 self
.tableTaskActive
.attach(self
.fontActiveCol
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
847 self
.fontActiveColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
848 self
.fontActiveColButton
.set_use_alpha(True)
849 self
.fontActiveColButton
.set_name("fontActiveCol")
850 self
.fontActiveColButton
.connect("color-set", self
.colorChange
)
851 self
.tableTaskActive
.attach(self
.fontActiveColButton
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
852 self
.fontActiveCol
.set_text(self
.defaults
["fgColor"])
853 # Add this AFTER we set color to avoid "changed" event
854 self
.fontActiveCol
.connect("changed", self
.changeOccurred
)
857 self
.tableTaskUrgent
= gtk
.Table(rows
=6, columns
=3, homogeneous
=False)
858 self
.tableTaskUrgent
.set_row_spacings(5)
859 self
.tableTaskUrgent
.set_col_spacings(5)
861 temp
= gtk
.Label("Urgent Task Background ID")
862 temp
.set_alignment(0, 0.5)
863 self
.tableTaskUrgent
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
864 self
.taskUrgentBg
= gtk
.combo_box_new_text()
865 self
.taskUrgentBg
.append_text("0 (fully transparent)")
866 for i
in range(len(self
.bgs
)):
867 self
.taskUrgentBg
.append_text(str(i
+1))
868 self
.taskUrgentBg
.set_active(0)
869 self
.taskUrgentBg
.connect("changed", self
.changeOccurred
)
870 self
.tableTaskUrgent
.attach(self
.taskUrgentBg
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
872 temp
= gtk
.Label("Note: Default values of 0 for each of these settings leaves icons unchanged!")
873 temp
.set_alignment(0, 0.5)
874 self
.tableTaskUrgent
.attach(temp
, 0, 3, 1, 2, xpadding
=10)
876 temp
= gtk
.Label("Urgent Icon Alpha (0 to 100)")
877 temp
.set_alignment(0, 0.5)
878 self
.tableTaskUrgent
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
879 self
.urgentIconHue
= gtk
.Entry(6)
880 self
.urgentIconHue
.set_width_chars(8)
881 self
.urgentIconHue
.set_text(URGENT_ICON_ALPHA
)
882 self
.urgentIconHue
.connect("changed", self
.changeOccurred
)
883 self
.tableTaskUrgent
.attach(self
.urgentIconHue
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
885 temp
= gtk
.Label("Urgent Icon Saturation (-100 to 100)")
886 temp
.set_alignment(0, 0.5)
887 self
.tableTaskUrgent
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
888 self
.urgentIconSat
= gtk
.Entry(6)
889 self
.urgentIconSat
.set_width_chars(8)
890 self
.urgentIconSat
.set_text(URGENT_ICON_SAT
)
891 self
.urgentIconSat
.connect("changed", self
.changeOccurred
)
892 self
.tableTaskUrgent
.attach(self
.urgentIconSat
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
894 temp
= gtk
.Label("Urgent Icon Brightness (-100 to 100)")
895 temp
.set_alignment(0, 0.5)
896 self
.tableTaskUrgent
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
897 self
.urgentIconBri
= gtk
.Entry(6)
898 self
.urgentIconBri
.set_width_chars(8)
899 self
.urgentIconBri
.set_text(URGENT_ICON_BRI
)
900 self
.urgentIconBri
.connect("changed", self
.changeOccurred
)
901 self
.tableTaskUrgent
.attach(self
.urgentIconBri
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
903 temp
= gtk
.Label("Urgent Font Color")
904 temp
.set_alignment(0, 0.5)
905 self
.tableTaskUrgent
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
906 self
.fontUrgentCol
= gtk
.Entry(7)
907 self
.fontUrgentCol
.set_width_chars(9)
908 self
.fontUrgentCol
.set_name("fontUrgentCol")
909 self
.fontUrgentCol
.connect("activate", self
.colorTyped
)
910 self
.tableTaskUrgent
.attach(self
.fontUrgentCol
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
911 self
.fontUrgentColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
912 self
.fontUrgentColButton
.set_use_alpha(True)
913 self
.fontUrgentColButton
.set_name("fontUrgentCol")
914 self
.fontUrgentColButton
.connect("color-set", self
.colorChange
)
915 self
.tableTaskUrgent
.attach(self
.fontUrgentColButton
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
916 self
.fontUrgentCol
.set_text(self
.defaults
["fgColor"])
917 # Add this AFTER we set color to avoid "changed" event
918 self
.fontUrgentCol
.connect("changed", self
.changeOccurred
)
920 # Iconified Appearance
921 self
.tableTaskIconified
= gtk
.Table(rows
=6, columns
=3, homogeneous
=False)
922 self
.tableTaskIconified
.set_row_spacings(5)
923 self
.tableTaskIconified
.set_col_spacings(5)
925 temp
= gtk
.Label("Iconified Task Background ID")
926 temp
.set_alignment(0, 0.5)
927 self
.tableTaskIconified
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
928 self
.taskIconifiedBg
= gtk
.combo_box_new_text()
929 self
.taskIconifiedBg
.append_text("0 (fully transparent)")
930 for i
in range(len(self
.bgs
)):
931 self
.taskIconifiedBg
.append_text(str(i
+1))
932 self
.taskIconifiedBg
.set_active(0)
933 self
.taskIconifiedBg
.connect("changed", self
.changeOccurred
)
934 self
.tableTaskIconified
.attach(self
.taskIconifiedBg
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
936 temp
= gtk
.Label("Note: Default values of 0 for each of these settings leaves icons unchanged!")
937 temp
.set_alignment(0, 0.5)
938 self
.tableTaskIconified
.attach(temp
, 0, 3, 1, 2, xpadding
=10)
940 temp
= gtk
.Label("Iconified Icon Alpha (0 to 100)")
941 temp
.set_alignment(0, 0.5)
942 self
.tableTaskIconified
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
943 self
.iconifiedIconHue
= gtk
.Entry(6)
944 self
.iconifiedIconHue
.set_width_chars(8)
945 self
.iconifiedIconHue
.set_text(ICONIFIED_ICON_ALPHA
)
946 self
.iconifiedIconHue
.connect("changed", self
.changeOccurred
)
947 self
.tableTaskIconified
.attach(self
.iconifiedIconHue
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
949 temp
= gtk
.Label("Iconified Icon Saturation (-100 to 100)")
950 temp
.set_alignment(0, 0.5)
951 self
.tableTaskIconified
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
952 self
.iconifiedIconSat
= gtk
.Entry(6)
953 self
.iconifiedIconSat
.set_width_chars(8)
954 self
.iconifiedIconSat
.set_text(ICONIFIED_ICON_SAT
)
955 self
.iconifiedIconSat
.connect("changed", self
.changeOccurred
)
956 self
.tableTaskIconified
.attach(self
.iconifiedIconSat
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
958 temp
= gtk
.Label("Iconified Icon Brightness (-100 to 100)")
959 temp
.set_alignment(0, 0.5)
960 self
.tableTaskIconified
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
961 self
.iconifiedIconBri
= gtk
.Entry(6)
962 self
.iconifiedIconBri
.set_width_chars(8)
963 self
.iconifiedIconBri
.set_text(ICONIFIED_ICON_BRI
)
964 self
.iconifiedIconBri
.connect("changed", self
.changeOccurred
)
965 self
.tableTaskIconified
.attach(self
.iconifiedIconBri
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
967 temp
= gtk
.Label("Iconified Font Color")
968 temp
.set_alignment(0, 0.5)
969 self
.tableTaskIconified
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
970 self
.fontIconifiedCol
= gtk
.Entry(7)
971 self
.fontIconifiedCol
.set_width_chars(9)
972 self
.fontIconifiedCol
.set_name("fontIconifiedCol")
973 self
.fontIconifiedCol
.connect("activate", self
.colorTyped
)
974 self
.tableTaskIconified
.attach(self
.fontIconifiedCol
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
975 self
.fontIconifiedColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
976 self
.fontIconifiedColButton
.set_use_alpha(True)
977 self
.fontIconifiedColButton
.set_name("fontIconifiedCol")
978 self
.fontIconifiedColButton
.connect("color-set", self
.colorChange
)
979 self
.tableTaskIconified
.attach(self
.fontIconifiedColButton
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
980 self
.fontIconifiedCol
.set_text(self
.defaults
["fgColor"])
981 # Add this AFTER we set color to avoid "changed" event
982 self
.fontIconifiedCol
.connect("changed", self
.changeOccurred
)
984 # System Tray Options
985 self
.tableTray
= gtk
.Table(rows
=9, columns
=3, homogeneous
=False)
986 self
.tableTray
.set_row_spacings(5)
987 self
.tableTray
.set_col_spacings(5)
989 temp
= gtk
.Label("Show System Tray")
990 temp
.set_alignment(0, 0.5)
991 self
.tableTray
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
992 self
.trayShow
= gtk
.CheckButton()
993 self
.trayShow
.set_active(True)
994 self
.trayShow
.connect("toggled", self
.changeOccurred
)
995 self
.tableTray
.attach(self
.trayShow
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
997 temp
= gtk
.Label("Padding (x, y)")
998 temp
.set_alignment(0, 0.5)
999 self
.tableTray
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
1000 self
.trayPadX
= gtk
.Entry(6)
1001 self
.trayPadX
.set_width_chars(8)
1002 self
.trayPadX
.set_text(TRAY_PADDING_X
)
1003 self
.trayPadX
.connect("changed", self
.changeOccurred
)
1004 self
.tableTray
.attach(self
.trayPadX
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
1005 self
.trayPadY
= gtk
.Entry(6)
1006 self
.trayPadY
.set_width_chars(8)
1007 self
.trayPadY
.set_text(TRAY_PADDING_Y
)
1008 self
.trayPadY
.connect("changed", self
.changeOccurred
)
1009 self
.tableTray
.attach(self
.trayPadY
, 2, 3, 1, 2, xoptions
=gtk
.EXPAND
)
1011 temp
= gtk
.Label("Horizontal Spacing")
1012 temp
.set_alignment(0, 0.5)
1013 self
.tableTray
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
1014 self
.traySpacing
= gtk
.Entry(6)
1015 self
.traySpacing
.set_width_chars(8)
1016 self
.traySpacing
.set_text(TRAY_SPACING
)
1017 self
.traySpacing
.connect("changed", self
.changeOccurred
)
1018 self
.tableTray
.attach(self
.traySpacing
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
1020 temp
= gtk
.Label("System Tray Background ID")
1021 temp
.set_alignment(0, 0.5)
1022 self
.tableTray
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
1023 self
.trayBg
= gtk
.combo_box_new_text()
1024 self
.trayBg
.append_text("0 (fully transparent)")
1025 for i
in range(len(self
.bgs
)):
1026 self
.trayBg
.append_text(str(i
+1))
1027 self
.trayBg
.set_active(0)
1028 self
.trayBg
.connect("changed", self
.changeOccurred
)
1029 self
.tableTray
.attach(self
.trayBg
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1031 temp
= gtk
.Label("Icon Ordering")
1032 temp
.set_alignment(0, 0.5)
1033 self
.tableTray
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
1034 self
.trayOrder
= gtk
.combo_box_new_text()
1035 self
.trayOrder
.append_text("ascending")
1036 self
.trayOrder
.append_text("descending")
1037 self
.trayOrder
.append_text("left2right")
1038 self
.trayOrder
.append_text("right2left")
1039 self
.trayOrder
.set_active(0)
1040 self
.trayOrder
.connect("changed", self
.changeOccurred
)
1041 self
.tableTray
.attach(self
.trayOrder
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1043 temp
= gtk
.Label("Maximum Icon Size (0 for automatic size)")
1044 temp
.set_alignment(0, 0.5)
1045 self
.tableTray
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
1046 self
.trayMaxIconSize
= gtk
.Entry(6)
1047 self
.trayMaxIconSize
.set_width_chars(8)
1048 self
.trayMaxIconSize
.set_text(TRAY_MAX_ICON_SIZE
)
1049 self
.trayMaxIconSize
.connect("changed", self
.changeOccurred
)
1050 self
.tableTray
.attach(self
.trayMaxIconSize
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
1052 temp
= gtk
.Label("System Tray Icon Alpha (0 to 100)")
1053 temp
.set_alignment(0, 0.5)
1054 self
.tableTray
.attach(temp
, 0, 1, 6, 7, xpadding
=10)
1055 self
.trayIconHue
= gtk
.Entry(6)
1056 self
.trayIconHue
.set_width_chars(8)
1057 self
.trayIconHue
.set_text(TRAY_ICON_ALPHA
)
1058 self
.trayIconHue
.connect("changed", self
.changeOccurred
)
1059 self
.tableTray
.attach(self
.trayIconHue
, 1, 2, 6, 7, xoptions
=gtk
.EXPAND
)
1061 temp
= gtk
.Label("System Tray Icon Saturation (-100 to 100)")
1062 temp
.set_alignment(0, 0.5)
1063 self
.tableTray
.attach(temp
, 0, 1, 7, 8, xpadding
=10)
1064 self
.trayIconSat
= gtk
.Entry(6)
1065 self
.trayIconSat
.set_width_chars(8)
1066 self
.trayIconSat
.set_text(TRAY_ICON_SAT
)
1067 self
.trayIconSat
.connect("changed", self
.changeOccurred
)
1068 self
.tableTray
.attach(self
.trayIconSat
, 1, 2, 7, 8, xoptions
=gtk
.EXPAND
)
1070 temp
= gtk
.Label("System Tray Icon Brightness (-100 to 100)")
1071 temp
.set_alignment(0, 0.5)
1072 self
.tableTray
.attach(temp
, 0, 1, 8, 9, xpadding
=10)
1073 self
.trayIconBri
= gtk
.Entry(6)
1074 self
.trayIconBri
.set_width_chars(8)
1075 self
.trayIconBri
.set_text(TRAY_ICON_BRI
)
1076 self
.trayIconBri
.connect("changed", self
.changeOccurred
)
1077 self
.tableTray
.attach(self
.trayIconBri
, 1, 2, 8, 9, xoptions
=gtk
.EXPAND
)
1080 self
.tableClockDisplays
= gtk
.Table(rows
=3, columns
=3, homogeneous
=False)
1081 self
.tableClockDisplays
.set_row_spacings(5)
1082 self
.tableClockDisplays
.set_col_spacings(5)
1084 temp
= gtk
.Label("Show Clock")
1085 temp
.set_alignment(0, 0.5)
1086 self
.tableClockDisplays
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
1087 self
.clockCheckButton
= gtk
.CheckButton()
1088 self
.clockCheckButton
.set_active(True)
1089 self
.clockCheckButton
.connect("toggled", self
.changeOccurred
)
1090 self
.tableClockDisplays
.attach(self
.clockCheckButton
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
1092 temp
= gtk
.Label("Time 1 Format")
1093 temp
.set_alignment(0, 0.5)
1094 self
.tableClockDisplays
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
1095 self
.clock1Format
= gtk
.Entry(50)
1096 self
.clock1Format
.set_width_chars(20)
1097 self
.clock1Format
.set_text(CLOCK_FMT_1
)
1098 self
.clock1Format
.connect("changed", self
.changeOccurred
)
1099 self
.tableClockDisplays
.attach(self
.clock1Format
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
1100 self
.clock1CheckButton
= gtk
.CheckButton("Show")
1101 self
.clock1CheckButton
.set_active(True)
1102 self
.clock1CheckButton
.connect("toggled", self
.changeOccurred
)
1103 self
.tableClockDisplays
.attach(self
.clock1CheckButton
, 2, 3, 1, 2, xoptions
=gtk
.EXPAND
)
1105 temp
= gtk
.Label("Time 1 Font")
1106 temp
.set_alignment(0, 0.5)
1107 self
.tableClockDisplays
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
1108 self
.clock1FontButton
= gtk
.FontButton()
1109 self
.clock1FontButton
.set_font_name(self
.defaults
["font"])
1110 self
.clock1FontButton
.connect("font-set", self
.changeOccurred
)
1111 self
.tableClockDisplays
.attach(self
.clock1FontButton
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1113 temp
= gtk
.Label("Time 2 Format")
1114 temp
.set_alignment(0, 0.5)
1115 self
.tableClockDisplays
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
1116 self
.clock2Format
= gtk
.Entry(50)
1117 self
.clock2Format
.set_width_chars(20)
1118 self
.clock2Format
.set_text(CLOCK_FMT_2
)
1119 self
.clock2Format
.connect("changed", self
.changeOccurred
)
1120 self
.tableClockDisplays
.attach(self
.clock2Format
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
1121 self
.clock2CheckButton
= gtk
.CheckButton("Show")
1122 self
.clock2CheckButton
.set_active(True)
1123 self
.clock2CheckButton
.connect("toggled", self
.changeOccurred
)
1124 self
.tableClockDisplays
.attach(self
.clock2CheckButton
, 2, 3, 3, 4, xoptions
=gtk
.EXPAND
)
1126 temp
= gtk
.Label("Time 2 Font")
1127 temp
.set_alignment(0, 0.5)
1128 self
.tableClockDisplays
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
1129 self
.clock2FontButton
= gtk
.FontButton()
1130 self
.clock2FontButton
.set_font_name(self
.defaults
["font"])
1131 self
.clock2FontButton
.connect("font-set", self
.changeOccurred
)
1132 self
.tableClockDisplays
.attach(self
.clock2FontButton
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1134 temp
= gtk
.Label("Tooltip Format")
1135 temp
.set_alignment(0, 0.5)
1136 self
.tableClockDisplays
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
1137 self
.clockTooltipFormat
= gtk
.Entry(50)
1138 self
.clockTooltipFormat
.set_width_chars(20)
1139 self
.clockTooltipFormat
.set_text(CLOCK_TOOLTIP
)
1140 self
.clockTooltipFormat
.connect("changed", self
.changeOccurred
)
1141 self
.tableClockDisplays
.attach(self
.clockTooltipFormat
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
1142 self
.clockTooltipCheckButton
= gtk
.CheckButton("Show")
1143 self
.clockTooltipCheckButton
.set_active(True)
1144 self
.clockTooltipCheckButton
.connect("toggled", self
.changeOccurred
)
1145 self
.tableClockDisplays
.attach(self
.clockTooltipCheckButton
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
)
1147 self
.clockArea
= gtk
.ScrolledWindow()
1148 self
.clockBuf
= gtk
.TextBuffer()
1149 self
.clockTextView
= gtk
.TextView(self
.clockBuf
)
1150 self
.clockBuf
.insert_at_cursor("%H 00-23 (24-hour) %I 01-12 (12-hour) %l 1-12 (12-hour) %M 00-59 (minutes)\n%S 00-59 (seconds) %P am/pm %b Jan-Dec %B January-December\n%a Sun-Sat %A Sunday-Saturday %d 01-31 (day) %e 1-31 (day)\n%y 2 digit year, e.g. 09 %Y 4 digit year, e.g. 2009")
1151 self
.clockTextView
.set_editable(False)
1152 self
.clockArea
.add_with_viewport(self
.clockTextView
)
1153 self
.tableClockDisplays
.attach(self
.clockArea
, 0, 3, 6, 7, xpadding
=10)
1155 self
.tableClockSettings
= gtk
.Table(rows
=3, columns
=3, homogeneous
=False)
1156 self
.tableClockSettings
.set_row_spacings(5)
1157 self
.tableClockSettings
.set_col_spacings(5)
1159 temp
= gtk
.Label("Clock Font Color")
1160 temp
.set_alignment(0, 0.5)
1161 self
.tableClockSettings
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
1162 self
.clockFontCol
= gtk
.Entry(7)
1163 self
.clockFontCol
.set_width_chars(9)
1164 self
.clockFontCol
.set_name("clockFontCol")
1165 self
.clockFontCol
.connect("activate", self
.colorTyped
)
1166 self
.tableClockSettings
.attach(self
.clockFontCol
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
1167 self
.clockFontColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
1168 self
.clockFontColButton
.set_use_alpha(True)
1169 self
.clockFontColButton
.set_name("clockFontCol")
1170 self
.clockFontColButton
.connect("color-set", self
.colorChange
)
1171 self
.tableClockSettings
.attach(self
.clockFontColButton
, 2, 3, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1172 self
.clockFontCol
.set_text(self
.defaults
["fgColor"])
1173 # Add this AFTER we set color to avoid "changed" event
1174 self
.clockFontCol
.connect("changed", self
.changeOccurred
)
1176 temp
= gtk
.Label("Padding (x, y)")
1177 temp
.set_alignment(0, 0.5)
1178 self
.tableClockSettings
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
1179 self
.clockPadX
= gtk
.Entry(6)
1180 self
.clockPadX
.set_width_chars(8)
1181 self
.clockPadX
.set_text(CLOCK_PADDING_X
)
1182 self
.clockPadX
.connect("changed", self
.changeOccurred
)
1183 self
.tableClockSettings
.attach(self
.clockPadX
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
1184 self
.clockPadY
= gtk
.Entry(6)
1185 self
.clockPadY
.set_width_chars(8)
1186 self
.clockPadY
.set_text(CLOCK_PADDING_Y
)
1187 self
.clockPadY
.connect("changed", self
.changeOccurred
)
1188 self
.tableClockSettings
.attach(self
.clockPadY
, 2, 3, 1, 2, xoptions
=gtk
.EXPAND
)
1190 temp
= gtk
.Label("Clock Background ID")
1191 temp
.set_alignment(0, 0.5)
1192 self
.tableClockSettings
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
1193 self
.clockBg
= gtk
.combo_box_new_text()
1194 self
.clockBg
.append_text("0 (fully transparent)")
1195 for i
in range(len(self
.bgs
)):
1196 self
.clockBg
.append_text(str(i
+1))
1197 self
.clockBg
.set_active(0)
1198 self
.clockBg
.connect("changed", self
.changeOccurred
)
1199 self
.tableClockSettings
.attach(self
.clockBg
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1201 temp
= gtk
.Label("Left Click Command")
1202 temp
.set_alignment(0, 0.5)
1203 self
.tableClockSettings
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
1204 self
.clockLClick
= gtk
.Entry(50)
1205 self
.clockLClick
.set_width_chars(20)
1206 self
.clockLClick
.set_text(CLOCK_LCLICK
)
1207 self
.clockLClick
.connect("changed", self
.changeOccurred
)
1208 self
.tableClockSettings
.attach(self
.clockLClick
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
1210 temp
= gtk
.Label("Right Click Command")
1211 temp
.set_alignment(0, 0.5)
1212 self
.tableClockSettings
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
1213 self
.clockRClick
= gtk
.Entry(50)
1214 self
.clockRClick
.set_width_chars(20)
1215 self
.clockRClick
.set_text(CLOCK_RCLICK
)
1216 self
.clockRClick
.connect("changed", self
.changeOccurred
)
1217 self
.tableClockSettings
.attach(self
.clockRClick
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
1219 temp
= gtk
.Label("Time 1 Timezone")
1220 temp
.set_alignment(0, 0.5)
1221 self
.tableClockSettings
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
1222 self
.clockTime1Timezone
= gtk
.Entry(50)
1223 self
.clockTime1Timezone
.set_width_chars(20)
1224 self
.clockTime1Timezone
.set_text(CLOCK_TIME1_TIMEZONE
)
1225 self
.clockTime1Timezone
.connect("changed", self
.changeOccurred
)
1226 self
.tableClockSettings
.attach(self
.clockTime1Timezone
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
1227 self
.clockTimezone1CheckButton
= gtk
.CheckButton("Enable")
1228 self
.clockTimezone1CheckButton
.set_active(False)
1229 self
.clockTimezone1CheckButton
.connect("toggled", self
.changeOccurred
)
1230 self
.tableClockSettings
.attach(self
.clockTimezone1CheckButton
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
)
1232 temp
= gtk
.Label("Time 2 Timezone")
1233 temp
.set_alignment(0, 0.5)
1234 self
.tableClockSettings
.attach(temp
, 0, 1, 6, 7, xpadding
=10)
1235 self
.clockTime2Timezone
= gtk
.Entry(50)
1236 self
.clockTime2Timezone
.set_width_chars(20)
1237 self
.clockTime2Timezone
.set_text(CLOCK_TIME2_TIMEZONE
)
1238 self
.clockTime2Timezone
.connect("changed", self
.changeOccurred
)
1239 self
.tableClockSettings
.attach(self
.clockTime2Timezone
, 1, 2, 6, 7, xoptions
=gtk
.EXPAND
)
1240 self
.clockTimezone2CheckButton
= gtk
.CheckButton("Enable")
1241 self
.clockTimezone2CheckButton
.set_active(False)
1242 self
.clockTimezone2CheckButton
.connect("toggled", self
.changeOccurred
)
1243 self
.tableClockSettings
.attach(self
.clockTimezone2CheckButton
, 2, 3, 6, 7, xoptions
=gtk
.EXPAND
)
1245 temp
= gtk
.Label("Tooltip Timezone")
1246 temp
.set_alignment(0, 0.5)
1247 self
.tableClockSettings
.attach(temp
, 0, 1, 7, 8, xpadding
=10)
1248 self
.clockTooltipTimezone
= gtk
.Entry(50)
1249 self
.clockTooltipTimezone
.set_width_chars(20)
1250 self
.clockTooltipTimezone
.set_text(CLOCK_TOOLTIP_TIMEZONE
)
1251 self
.clockTooltipTimezone
.connect("changed", self
.changeOccurred
)
1252 self
.tableClockSettings
.attach(self
.clockTooltipTimezone
, 1, 2, 7, 8, xoptions
=gtk
.EXPAND
)
1253 self
.clockTimezoneTooltipCheckButton
= gtk
.CheckButton("Enable")
1254 self
.clockTimezoneTooltipCheckButton
.set_active(False)
1255 self
.clockTimezoneTooltipCheckButton
.connect("toggled", self
.changeOccurred
)
1256 self
.tableClockSettings
.attach(self
.clockTimezoneTooltipCheckButton
, 2, 3, 7, 8, xoptions
=gtk
.EXPAND
)
1259 self
.tableTooltip
= gtk
.Table(rows
=7, columns
=3, homogeneous
=False)
1260 self
.tableTooltip
.set_row_spacings(5)
1261 self
.tableTooltip
.set_col_spacings(5)
1263 temp
= gtk
.Label("Show Tooltips")
1264 temp
.set_alignment(0, 0.5)
1265 self
.tableTooltip
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
1266 self
.tooltipShow
= gtk
.CheckButton()
1267 self
.tooltipShow
.set_active(False)
1268 self
.tooltipShow
.connect("toggled", self
.changeOccurred
)
1269 self
.tableTooltip
.attach(self
.tooltipShow
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
1271 temp
= gtk
.Label("Padding (x, y)")
1272 temp
.set_alignment(0, 0.5)
1273 self
.tableTooltip
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
1274 self
.tooltipPadX
= gtk
.Entry(6)
1275 self
.tooltipPadX
.set_width_chars(8)
1276 self
.tooltipPadX
.set_text(TOOLTIP_PADDING_X
)
1277 self
.tooltipPadX
.connect("changed", self
.changeOccurred
)
1278 self
.tableTooltip
.attach(self
.tooltipPadX
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
1279 self
.tooltipPadY
= gtk
.Entry(6)
1280 self
.tooltipPadY
.set_width_chars(8)
1281 self
.tooltipPadY
.set_text(TOOLTIP_PADDING_Y
)
1282 self
.tooltipPadY
.connect("changed", self
.changeOccurred
)
1283 self
.tableTooltip
.attach(self
.tooltipPadY
, 2, 3, 1, 2, xoptions
=gtk
.EXPAND
)
1285 temp
= gtk
.Label("Tooltip Show Timeout (seconds)")
1286 temp
.set_alignment(0, 0.5)
1287 self
.tableTooltip
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
1288 self
.tooltipShowTime
= gtk
.Entry(6)
1289 self
.tooltipShowTime
.set_width_chars(8)
1290 self
.tooltipShowTime
.set_text(TOOLTIP_SHOW_TIMEOUT
)
1291 self
.tooltipShowTime
.connect("changed", self
.changeOccurred
)
1292 self
.tableTooltip
.attach(self
.tooltipShowTime
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
1294 temp
= gtk
.Label("Tooltip Hide Timeout (seconds)")
1295 temp
.set_alignment(0, 0.5)
1296 self
.tableTooltip
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
1297 self
.tooltipHideTime
= gtk
.Entry(6)
1298 self
.tooltipHideTime
.set_width_chars(8)
1299 self
.tooltipHideTime
.set_text(TOOLTIP_HIDE_TIMEOUT
)
1300 self
.tooltipHideTime
.connect("changed", self
.changeOccurred
)
1301 self
.tableTooltip
.attach(self
.tooltipHideTime
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
1303 temp
= gtk
.Label("Tooltip Background ID")
1304 temp
.set_alignment(0, 0.5)
1305 self
.tableTooltip
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
1306 self
.tooltipBg
= gtk
.combo_box_new_text()
1307 self
.tooltipBg
.append_text("0 (fully transparent)")
1308 for i
in range(len(self
.bgs
)):
1309 self
.tooltipBg
.append_text(str(i
+1))
1310 self
.tooltipBg
.set_active(0)
1311 self
.tooltipBg
.connect("changed", self
.changeOccurred
)
1312 self
.tableTooltip
.attach(self
.tooltipBg
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1314 temp
= gtk
.Label("Tooltip Font")
1315 temp
.set_alignment(0, 0.5)
1316 self
.tableTooltip
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
1317 self
.tooltipFont
= gtk
.FontButton()
1318 self
.tooltipFont
.set_font_name(self
.defaults
["font"])
1319 self
.tooltipFont
.connect("font-set", self
.changeOccurred
)
1320 self
.tableTooltip
.attach(self
.tooltipFont
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1322 temp
= gtk
.Label("Tooltip Font Color")
1323 temp
.set_alignment(0, 0.5)
1324 self
.tableTooltip
.attach(temp
, 0, 1, 6, 7, xpadding
=10)
1325 self
.tooltipFontCol
= gtk
.Entry(7)
1326 self
.tooltipFontCol
.set_width_chars(9)
1327 self
.tooltipFontCol
.set_name("tooltipFontCol")
1328 self
.tooltipFontCol
.connect("activate", self
.colorTyped
)
1329 self
.tableTooltip
.attach(self
.tooltipFontCol
, 1, 2, 6, 7, xoptions
=gtk
.EXPAND
)
1330 self
.tooltipFontColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
1331 self
.tooltipFontColButton
.set_use_alpha(True)
1332 self
.tooltipFontColButton
.set_name("tooltipFontCol")
1333 self
.tooltipFontColButton
.connect("color-set", self
.colorChange
)
1334 self
.tableTooltip
.attach(self
.tooltipFontColButton
, 2, 3, 6, 7, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1335 self
.tooltipFontCol
.set_text(self
.defaults
["fgColor"])
1336 # Add this AFTER we set color to avoid "changed" event
1337 self
.clockFontCol
.connect("changed", self
.changeOccurred
)
1340 self
.tableMouse
= gtk
.Table(rows
=4, columns
=3, homogeneous
=False)
1341 self
.tableMouse
.set_row_spacings(5)
1342 self
.tableMouse
.set_col_spacings(5)
1344 temp
= gtk
.Label("Middle Mouse Click Action")
1345 temp
.set_alignment(0, 0.5)
1346 self
.tableMouse
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
1347 self
.mouseMiddle
= gtk
.combo_box_new_text()
1348 self
.mouseMiddle
.append_text("none")
1349 self
.mouseMiddle
.append_text("close")
1350 self
.mouseMiddle
.append_text("toggle")
1351 self
.mouseMiddle
.append_text("iconify")
1352 self
.mouseMiddle
.append_text("shade")
1353 self
.mouseMiddle
.append_text("toggle_iconify")
1354 self
.mouseMiddle
.append_text("maximize_restore")
1355 self
.mouseMiddle
.append_text("desktop_left")
1356 self
.mouseMiddle
.append_text("desktop_right")
1357 self
.mouseMiddle
.append_text("next_task")
1358 self
.mouseMiddle
.append_text("prev_task")
1359 self
.mouseMiddle
.set_active(0)
1360 self
.mouseMiddle
.connect("changed", self
.changeOccurred
)
1361 self
.tableMouse
.attach(self
.mouseMiddle
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1363 temp
= gtk
.Label("Right Mouse Click Action")
1364 temp
.set_alignment(0, 0.5)
1365 self
.tableMouse
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
1366 self
.mouseRight
= gtk
.combo_box_new_text()
1367 self
.mouseRight
.append_text("none")
1368 self
.mouseRight
.append_text("close")
1369 self
.mouseRight
.append_text("toggle")
1370 self
.mouseRight
.append_text("iconify")
1371 self
.mouseRight
.append_text("shade")
1372 self
.mouseRight
.append_text("toggle_iconify")
1373 self
.mouseRight
.append_text("maximize_restore")
1374 self
.mouseRight
.append_text("desktop_left")
1375 self
.mouseRight
.append_text("desktop_right")
1376 self
.mouseRight
.append_text("next_task")
1377 self
.mouseRight
.append_text("prev_task")
1378 self
.mouseRight
.set_active(0)
1379 self
.mouseRight
.connect("changed", self
.changeOccurred
)
1380 self
.tableMouse
.attach(self
.mouseRight
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1382 temp
= gtk
.Label("Mouse Wheel Scroll Up Action")
1383 temp
.set_alignment(0, 0.5)
1384 self
.tableMouse
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
1385 self
.mouseUp
= gtk
.combo_box_new_text()
1386 self
.mouseUp
.append_text("none")
1387 self
.mouseUp
.append_text("close")
1388 self
.mouseUp
.append_text("toggle")
1389 self
.mouseUp
.append_text("iconify")
1390 self
.mouseUp
.append_text("shade")
1391 self
.mouseUp
.append_text("toggle_iconify")
1392 self
.mouseUp
.append_text("maximize_restore")
1393 self
.mouseUp
.append_text("desktop_left")
1394 self
.mouseUp
.append_text("desktop_right")
1395 self
.mouseUp
.append_text("next_task")
1396 self
.mouseUp
.append_text("prev_task")
1397 self
.mouseUp
.set_active(0)
1398 self
.mouseUp
.connect("changed", self
.changeOccurred
)
1399 self
.tableMouse
.attach(self
.mouseUp
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1401 temp
= gtk
.Label("Mouse Wheel Scroll Down Action")
1402 temp
.set_alignment(0, 0.5)
1403 self
.tableMouse
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
1404 self
.mouseDown
= gtk
.combo_box_new_text()
1405 self
.mouseDown
.append_text("none")
1406 self
.mouseDown
.append_text("close")
1407 self
.mouseDown
.append_text("toggle")
1408 self
.mouseDown
.append_text("iconify")
1409 self
.mouseDown
.append_text("shade")
1410 self
.mouseDown
.append_text("toggle_iconify")
1411 self
.mouseDown
.append_text("maximize_restore")
1412 self
.mouseDown
.append_text("desktop_left")
1413 self
.mouseDown
.append_text("desktop_right")
1414 self
.mouseDown
.append_text("next_task")
1415 self
.mouseDown
.append_text("prev_task")
1416 self
.mouseDown
.set_active(0)
1417 self
.mouseDown
.connect("changed", self
.changeOccurred
)
1418 self
.tableMouse
.attach(self
.mouseDown
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1421 self
.tableBattery
= gtk
.Table(rows
=8, columns
=3, homogeneous
=False)
1422 self
.tableBattery
.set_row_spacings(5)
1423 self
.tableBattery
.set_col_spacings(5)
1425 temp
= gtk
.Label("Show Battery Applet")
1426 temp
.set_alignment(0, 0.5)
1427 self
.tableBattery
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
1428 self
.batteryCheckButton
= gtk
.CheckButton()
1429 self
.batteryCheckButton
.set_active(False)
1430 self
.batteryCheckButton
.connect("toggled", self
.changeOccurred
)
1431 self
.tableBattery
.attach(self
.batteryCheckButton
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
1433 temp
= gtk
.Label("Battery Low Status (%)")
1434 temp
.set_alignment(0, 0.5)
1435 self
.tableBattery
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
1436 self
.batteryLow
= gtk
.Entry(6)
1437 self
.batteryLow
.set_width_chars(8)
1438 self
.batteryLow
.set_text(BATTERY_LOW
)
1439 self
.batteryLow
.connect("changed", self
.changeOccurred
)
1440 self
.tableBattery
.attach(self
.batteryLow
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
1442 temp
= gtk
.Label("Battery Low Action")
1443 temp
.set_alignment(0, 0.5)
1444 self
.tableBattery
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
1445 self
.batteryLowAction
= gtk
.Entry(150)
1446 self
.batteryLowAction
.set_width_chars(32)
1447 self
.batteryLowAction
.set_text(BATTERY_ACTION
)
1448 self
.batteryLowAction
.connect("changed", self
.changeOccurred
)
1449 self
.tableBattery
.attach(self
.batteryLowAction
, 1, 3, 2, 3, xoptions
=gtk
.EXPAND
)
1451 temp
= gtk
.Label("Battery Hide (0 to 100)")
1452 temp
.set_alignment(0, 0.5)
1453 self
.tableBattery
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
1454 self
.batteryHide
= gtk
.Entry(6)
1455 self
.batteryHide
.set_width_chars(8)
1456 self
.batteryHide
.set_text(BATTERY_HIDE
)
1457 self
.batteryHide
.connect("changed", self
.changeOccurred
)
1458 self
.tableBattery
.attach(self
.batteryHide
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
1460 temp
= gtk
.Label("Battery 1 Font")
1461 temp
.set_alignment(0, 0.5)
1462 self
.tableBattery
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
1463 self
.bat1FontButton
= gtk
.FontButton()
1464 self
.bat1FontButton
.set_font_name(self
.defaults
["font"])
1465 self
.bat1FontButton
.connect("font-set", self
.changeOccurred
)
1466 self
.tableBattery
.attach(self
.bat1FontButton
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1468 temp
= gtk
.Label("Battery 2 Font")
1469 temp
.set_alignment(0, 0.5)
1470 self
.tableBattery
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
1471 self
.bat2FontButton
= gtk
.FontButton()
1472 self
.bat2FontButton
.set_font_name(self
.defaults
["font"])
1473 self
.bat2FontButton
.connect("font-set", self
.changeOccurred
)
1474 self
.tableBattery
.attach(self
.bat2FontButton
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1476 temp
= gtk
.Label("Battery Font Color")
1477 temp
.set_alignment(0, 0.5)
1478 self
.tableBattery
.attach(temp
, 0, 1, 6, 7, xpadding
=10)
1479 self
.batteryFontCol
= gtk
.Entry(7)
1480 self
.batteryFontCol
.set_width_chars(9)
1481 self
.batteryFontCol
.set_name("batteryFontCol")
1482 self
.batteryFontCol
.connect("activate", self
.colorTyped
)
1483 self
.tableBattery
.attach(self
.batteryFontCol
, 1, 2, 6, 7, xoptions
=gtk
.EXPAND
)
1484 self
.batteryFontColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
1485 self
.batteryFontColButton
.set_use_alpha(True)
1486 self
.batteryFontColButton
.set_name("batteryFontCol")
1487 self
.batteryFontColButton
.connect("color-set", self
.colorChange
)
1488 self
.tableBattery
.attach(self
.batteryFontColButton
, 2, 3, 6, 7, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1489 self
.batteryFontCol
.set_text(self
.defaults
["fgColor"])
1490 # Add this AFTER we set color to avoid "changed" event
1491 self
.batteryFontCol
.connect("changed", self
.changeOccurred
)
1493 temp
= gtk
.Label("Padding (x, y)")
1494 temp
.set_alignment(0, 0.5)
1495 self
.tableBattery
.attach(temp
, 0, 1, 7, 8, xpadding
=10)
1496 self
.batteryPadX
= gtk
.Entry(6)
1497 self
.batteryPadX
.set_width_chars(8)
1498 self
.batteryPadX
.set_text(BATTERY_PADDING_X
)
1499 self
.batteryPadX
.connect("changed", self
.changeOccurred
)
1500 self
.tableBattery
.attach(self
.batteryPadX
, 1, 2, 7, 8, xoptions
=gtk
.EXPAND
)
1501 self
.batteryPadY
= gtk
.Entry(6)
1502 self
.batteryPadY
.set_width_chars(8)
1503 self
.batteryPadY
.set_text(BATTERY_PADDING_Y
)
1504 self
.batteryPadY
.connect("changed", self
.changeOccurred
)
1505 self
.tableBattery
.attach(self
.batteryPadY
, 2, 3, 7, 8, xoptions
=gtk
.EXPAND
)
1507 temp
= gtk
.Label("Battery Background ID")
1508 temp
.set_alignment(0, 0.5)
1509 self
.tableBattery
.attach(temp
, 0, 1, 8, 9, xpadding
=10)
1510 self
.batteryBg
= gtk
.combo_box_new_text()
1511 self
.batteryBg
.append_text("0 (fully transparent)")
1512 for i
in range(len(self
.bgs
)):
1513 self
.batteryBg
.append_text(str(i
+1))
1514 self
.batteryBg
.set_active(0)
1515 self
.batteryBg
.connect("changed", self
.changeOccurred
)
1516 self
.tableBattery
.attach(self
.batteryBg
, 1, 2, 8, 9, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1519 self
.configArea
= gtk
.ScrolledWindow()
1520 self
.configBuf
= gtk
.TextBuffer()
1521 self
.configTextView
= gtk
.TextView(self
.configBuf
)
1522 self
.configArea
.add_with_viewport(self
.configTextView
)
1524 # Add backgrounds to notebooks
1525 for i
in range(self
.defaults
["bgCount"]):
1526 self
.addBgClick(None, init
=True)
1528 self
.bgNotebook
.set_current_page(0)
1530 # Create sub-notebooks
1531 self
.panelNotebook
= gtk
.Notebook()
1532 self
.panelNotebook
.set_tab_pos(gtk
.POS_TOP
)
1533 self
.panelNotebook
.set_current_page(0)
1535 self
.panelNotebook
.append_page(self
.tablePanelDisplay
, gtk
.Label("Panel Display"))
1536 self
.panelNotebook
.append_page(self
.tablePanelSettings
, gtk
.Label("Panel Settings"))
1537 self
.panelNotebook
.append_page(self
.tablePanelAutohide
, gtk
.Label("Panel Autohide"))
1539 self
.taskNotebook
= gtk
.Notebook()
1540 self
.taskNotebook
.set_tab_pos(gtk
.POS_TOP
)
1541 self
.taskNotebook
.set_current_page(0)
1543 self
.taskNotebook
.append_page(self
.tableTask
, gtk
.Label("Task Settings"))
1544 self
.taskNotebook
.append_page(self
.tableTaskDefault
, gtk
.Label("Normal Tasks"))
1545 self
.taskNotebook
.append_page(self
.tableTaskActive
, gtk
.Label("Active Tasks"))
1546 self
.taskNotebook
.append_page(self
.tableTaskUrgent
, gtk
.Label("Urgent Tasks"))
1547 self
.taskNotebook
.append_page(self
.tableTaskIconified
, gtk
.Label("Iconified Tasks"))
1549 self
.clockNotebook
= gtk
.Notebook()
1550 self
.clockNotebook
.set_tab_pos(gtk
.POS_TOP
)
1551 self
.clockNotebook
.set_current_page(0)
1553 self
.clockNotebook
.append_page(self
.tableClockDisplays
, gtk
.Label("Clock Display"))
1554 self
.clockNotebook
.append_page(self
.tableClockSettings
, gtk
.Label("Clock Settings"))
1556 # Add pages to notebook
1557 self
.notebook
.append_page(self
.tableBgs
, gtk
.Label("Backgrounds"))
1558 self
.notebook
.append_page(self
.panelNotebook
, gtk
.Label("Panel"))
1559 self
.notebook
.append_page(self
.tableTaskbar
, gtk
.Label("Taskbar"))
1560 self
.notebook
.append_page(self
.taskNotebook
, gtk
.Label("Tasks"))
1561 self
.notebook
.append_page(self
.tableTray
, gtk
.Label("System Tray"))
1562 self
.notebook
.append_page(self
.clockNotebook
, gtk
.Label("Clock"))
1563 self
.notebook
.append_page(self
.tableMouse
, gtk
.Label("Mouse"))
1564 self
.notebook
.append_page(self
.tableTooltip
, gtk
.Label("Tooltips"))
1565 self
.notebook
.append_page(self
.tableBattery
, gtk
.Label("Battery"))
1566 self
.notebook
.append_page(self
.configArea
, gtk
.Label("View Config"))
1568 self
.notebook
.connect("switch-page", self
.switchPage
)
1570 # Add notebook to window and show
1571 self
.table
.attach(self
.notebook
, 0, 4, 2, 3, xpadding
=5, ypadding
=5)
1573 if self
.oneConfigFile
:
1574 # Add button Apply and Close
1575 self
.box1
= gtk
.HBox(False, 20)
1576 self
.table
.attach(self
.box1
, 0, 4, 3, 4, xpadding
=5, ypadding
=5)
1577 temp
= gtk
.Button("Apply", gtk
.STOCK_APPLY
)
1578 temp
.set_name("applyBg")
1579 temp
.connect("clicked", self
.apply)
1580 self
.box1
.pack_start(temp
, True, True, 0)
1581 temp
= gtk
.Button("Close", gtk
.STOCK_CLOSE
)
1582 temp
.set_name("closeBg")
1583 temp
.connect("clicked", self
.quit
)
1584 self
.box1
.pack_start(temp
, True, True, 0)
1586 # Create and add the status bar to the bottom of the main window
1587 self
.statusBar
= gtk
.Statusbar()
1588 self
.statusBar
.set_has_resize_grip(True)
1589 self
.updateStatusBar("New Config File [*]")
1590 self
.table
.attach(self
.statusBar
, 0, 4, 4, 5)
1592 self
.add(self
.table
)
1596 # Create our property dictionary. This holds the widgets which correspond to each property
1598 "panel_monitor": self
.panelMonitor
,
1599 "panel_position": (self
.panelPosY
, self
.panelPosX
, self
.panelOrientation
),
1600 "panel_size": (self
.panelSizeX
, self
.panelSizeY
),
1601 "panel_margin": (self
.panelMarginX
, self
.panelMarginY
),
1602 "panel_padding": (self
.panelPadX
, self
.panelPadY
, self
.panelSpacing
),
1603 "wm_menu": self
.panelMenu
,
1604 "panel_layer": self
.panelLayer
,
1605 "panel_dock": self
.panelDock
,
1606 "panel_background_id": self
.panelBg
,
1607 "autohide": self
.panelAutohide
,
1608 "autohide_show_timeout": self
.panelAutohideShow
,
1609 "autohide_hide_timeout": self
.panelAutohideHide
,
1610 "autohide_height": self
.panelAutohideHeight
,
1611 "strut_policy": self
.panelAutohideStrut
,
1612 "taskbar_mode": self
.taskbarMode
,
1613 "taskbar_padding": (self
.taskbarPadX
, self
.taskbarPadY
, self
.taskbarSpacing
),
1614 "taskbar_background_id": self
.taskbarBg
,
1615 "taskbar_active_background_id": self
.taskbarActiveBg
,
1616 "task_icon": self
.taskIconCheckButton
,
1617 "task_text": self
.taskTextCheckButton
,
1618 "task_centered": self
.taskCentreCheckButton
,
1619 "task_maximum_size": (self
.taskMaxSizeX
, self
.taskMaxSizeY
),
1620 "task_padding": (self
.taskPadX
, self
.taskPadY
),
1621 "task_background_id": self
.taskBg
,
1622 "task_active_background_id": self
.taskActiveBg
,
1623 "task_urgent_background_id": self
.taskUrgentBg
,
1624 "task_iconified_background_id": self
.taskIconifiedBg
,
1625 "task_font": self
.fontButton
,
1626 "task_font_color": (self
.fontCol
, self
.fontColButton
),
1627 "task_active_font_color": (self
.fontActiveCol
, self
.fontActiveColButton
),
1628 "task_urgent_font_color": (self
.fontUrgentCol
, self
.fontUrgentColButton
),
1629 "task_iconified_font_color": (self
.fontIconifiedCol
, self
.fontIconifiedColButton
),
1630 "task_icon_asb": (self
.iconHue
, self
.iconSat
, self
.iconBri
),
1631 "task_active_icon_asb": (self
.activeIconHue
, self
.activeIconSat
, self
.activeIconBri
),
1632 "task_urgent_icon_asb": (self
.urgentIconHue
, self
.urgentIconSat
, self
.urgentIconBri
),
1633 "task_iconified_icon_asb": (self
.iconifiedIconHue
, self
.iconifiedIconSat
, self
.iconifiedIconBri
),
1634 "font_shadow": self
.fontShadowCheckButton
,
1635 "systray": self
.trayShow
,
1636 "systray_padding": (self
.trayPadX
, self
.trayPadY
, self
.traySpacing
),
1637 "systray_background_id": self
.trayBg
,
1638 "systray_sort": self
.trayOrder
,
1639 "systray_icon_size": self
.trayMaxIconSize
,
1640 "systray_icon_asb": (self
.trayIconHue
, self
.trayIconSat
, self
.trayIconBri
),
1641 "time1_format": self
.clock1Format
,
1642 "time2_format": self
.clock2Format
,
1643 "clock_tooltip": self
.clockTooltipFormat
,
1644 "time1_font": self
.clock1FontButton
,
1645 "time2_font": self
.clock2FontButton
,
1646 "clock_font_color": (self
.clockFontCol
, self
.clockFontColButton
),
1647 "clock_padding": (self
.clockPadX
, self
.clockPadY
),
1648 "clock_background_id": self
.clockBg
,
1649 "clock_lclick_command": self
.clockLClick
,
1650 "clock_rclick_command": self
.clockRClick
,
1651 "time1_timezone": self
.clockTime1Timezone
,
1652 "time2_timezone": self
.clockTime2Timezone
,
1653 "clock_tooltip_timezone": self
.clockTooltipTimezone
,
1654 "mouse_middle": self
.mouseMiddle
,
1655 "mouse_right": self
.mouseRight
,
1656 "mouse_scroll_up": self
.mouseUp
,
1657 "mouse_scroll_down": self
.mouseDown
,
1658 "tooltip": self
.tooltipShow
,
1659 "tooltip_padding": (self
.tooltipPadX
, self
.tooltipPadY
),
1660 "tooltip_show_timeout": self
.tooltipShowTime
,
1661 "tooltip_hide_timeout": self
.tooltipHideTime
,
1662 "tooltip_background_id": self
.tooltipBg
,
1663 "tooltip_font": self
.tooltipFont
,
1664 "tooltip_font_color": (self
.tooltipFontCol
, self
.tooltipFontColButton
),
1665 "battery": self
.batteryCheckButton
,
1666 "battery_low_status": self
.batteryLow
,
1667 "battery_low_cmd": self
.batteryLowAction
,
1668 "battery_hide": self
.batteryHide
,
1669 "bat1_font": self
.bat1FontButton
,
1670 "bat2_font": self
.bat2FontButton
,
1671 "battery_font_color": (self
.batteryFontCol
, self
.batteryFontColButton
),
1672 "battery_padding": (self
.batteryPadX
, self
.batteryPadY
),
1673 "battery_background_id": self
.batteryBg
1676 if self
.oneConfigFile
:
1677 self
.readTint2Config()
1679 self
.generateConfig()
1681 def about(self
, action
=None):
1682 """Displays the About dialog."""
1683 about
= gtk
.AboutDialog()
1684 about
.set_program_name(NAME
)
1685 about
.set_version(VERSION
)
1686 about
.set_authors(AUTHORS
)
1687 about
.set_comments(COMMENTS
)
1688 about
.set_website(WEBSITE
)
1689 gtk
.about_dialog_set_url_hook(self
.aboutLinkCallback
)
1693 def aboutLinkCallback(dialog
, link
, data
=None):
1694 """Callback for when a URL is clicked in an About dialog."""
1696 webbrowser
.open(link
)
1698 errorDialog(self
, "Your default web-browser could not be opened.\nPlease visit %s" % link
)
1701 """Adds a new background to the list of backgrounds."""
1702 self
.bgs
+= [gtk
.Table(4, 3, False)]
1704 temp
= gtk
.Label("Corner Rounding (px)")
1705 temp
.set_alignment(0, 0.5)
1706 self
.bgs
[-1].attach(temp
, 0, 1, 0, 1, xpadding
=10)
1708 temp
.set_width_chars(9)
1709 temp
.set_name("rounded")
1710 temp
.set_text(BG_ROUNDING
)
1711 temp
.connect("changed", self
.changeOccurred
)
1712 self
.bgs
[-1].attach(temp
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
1714 temp
= gtk
.Label("Background Color")
1715 temp
.set_alignment(0, 0.5)
1716 self
.bgs
[-1].attach(temp
, 0, 1, 1, 2, xpadding
=10)
1718 temp
.set_width_chars(9)
1719 temp
.set_name("bgColEntry")
1720 temp
.set_text(self
.defaults
["bgColor"])
1721 temp
.connect("changed", self
.changeOccurred
)
1722 temp
.connect("activate", self
.colorTyped
)
1723 self
.bgs
[-1].attach(temp
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
1724 temp
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["bgColor"]))
1725 temp
.set_use_alpha(True)
1726 temp
.set_name("bgCol")
1727 temp
.connect("color-set", self
.colorChange
)
1728 self
.bgs
[-1].attach(temp
, 2, 3, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1730 temp
= gtk
.Label("Border Width (px)")
1731 temp
.set_alignment(0, 0.5)
1732 self
.bgs
[-1].attach(temp
, 0, 1, 2, 3, xpadding
=10)
1734 temp
.set_width_chars(9)
1735 temp
.set_name("border")
1736 temp
.set_text(BG_BORDER
)
1737 temp
.connect("changed", self
.changeOccurred
)
1738 self
.bgs
[-1].attach(temp
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
1740 temp
= gtk
.Label("Border Color")
1741 temp
.set_alignment(0, 0.5)
1742 self
.bgs
[-1].attach(temp
, 0, 1, 3, 4, xpadding
=10)
1744 temp
.set_width_chars(9)
1745 temp
.set_name("borderColEntry")
1746 temp
.connect("activate", self
.colorTyped
)
1747 temp
.set_text(self
.defaults
["borderColor"])
1748 temp
.connect("changed", self
.changeOccurred
)
1749 self
.bgs
[-1].attach(temp
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
1750 temp
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["borderColor"]))
1751 temp
.set_use_alpha(True)
1752 temp
.set_name("borderCol")
1753 temp
.connect("color-set", self
.colorChange
)
1754 self
.bgs
[-1].attach(temp
, 2, 3, 3, 4, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1756 # Note: Only set init to True when initialising background styles.
1757 # This prevents unwanted calls to changeOccurred()
1758 def addBgClick(self
, widget
=None, init
=False):
1759 """Creates a new background and adds a new tab to the notebook."""
1760 n
= self
.bgNotebook
.get_n_pages()
1762 if n
> (self
.defaults
["bgCount"] + 2):
1763 if confirmDialog(self
, "You already have %d background styles. Are you sure you would like another?" % n
) == gtk
.RESPONSE_NO
:
1768 newId
= len(self
.bgs
)
1770 self
.bgNotebook
.append_page(self
.bgs
[newId
-1], gtk
.Label("Background ID %d" % (newId
)))
1772 self
.bgNotebook
.show_all()
1774 self
.updateComboBoxes(n
, "add")
1776 self
.bgNotebook
.set_current_page(n
)
1779 self
.changeOccurred()
1781 def addBgDefs(self
, bgDefs
):
1782 """Add interface elements for a list of background style definitions. bgDefs
1783 should be a list containing dictionaries with the following keys: rounded,
1784 border_width, background_color, border_color"""
1788 for child
in self
.bgs
[-1].get_children():
1789 if child
.get_name() == "rounded":
1790 child
.set_text(d
["rounded"])
1791 elif child
.get_name() == "border":
1792 child
.set_text(d
["border_width"])
1793 elif child
.get_name() == "bgColEntry":
1794 child
.set_text(d
["background_color"].split(" ")[0].strip())
1796 elif child
.get_name() == "borderColEntry":
1797 child
.set_text(d
["border_color"].split(" ")[0].strip())
1799 elif child
.get_name() == "bgCol":
1800 list = d
["background_color"].split(" ")
1802 child
.set_alpha(int(int(list[1].strip()) * 65535 / 100.0))
1804 child
.set_alpha(65535)
1805 elif child
.get_name() == "borderCol":
1806 list = d
["border_color"].split(" ")
1808 child
.set_alpha(int(int(list[1].strip()) * 65535 / 100.0))
1810 child
.set_alpha(65535)
1812 newId
= len(self
.bgs
)
1814 self
.bgNotebook
.append_page(self
.bgs
[newId
-1], gtk
.Label("Background ID %d" % (newId
)))
1816 self
.bgNotebook
.show_all()
1818 self
.updateComboBoxes(newId
-1, "add")
1820 self
.bgNotebook
.set_current_page(newId
)
1822 def apply(self
, widget
, event
=None, confirmChange
=True):
1823 """Applies the current config to tint2."""
1824 # Check if tint2 is running
1825 procs
= os
.popen('pidof "tint2"') # Check list of active processes for tint2
1826 pids
= [] # List of process ids for tint2
1828 for proc
in procs
.readlines():
1829 pids
+= [int(proc
.strip().split(" ")[0])]
1833 if self
.oneConfigFile
:
1834 # Save and copy as default
1836 tmpSrc
= self
.filename
1837 tmpDest
= os
.path
.expandvars("${HOME}") + "/.config/tint2/tint2rc"
1839 shutil
.copyfile(tmpSrc
, tmpDest
)
1840 except shutil
.Error
:
1842 # Ask tint2 to reload config
1844 os
.kill(pid
, signal
.SIGUSR1
)
1846 if confirmDialog(self
, "This will terminate all currently running instances of tint2 before applying config. Continue?") == gtk
.RESPONSE_YES
:
1850 #shutil.copyfile(self.filename, self.filename+".backup") # Create backup
1852 # If it is - kill it
1854 os
.kill(pid
, signal
.SIGTERM
)
1857 os
.spawnv(os
.P_NOWAIT
, self
.tint2Bin
, [self
.tint2Bin
, "-c" + self
.filename
])
1859 if confirmChange
and self
.filename
!= (os
.path
.expandvars("${HOME}") + "/.config/tint2/tint2rc") and confirmDialog(self
, "Use this as default tint2 config?") == gtk
.RESPONSE_YES
:
1861 self
.filename
= os
.path
.expandvars("${HOME}") + "/.config/tint2/tint2rc"
1863 shutil
.copyfile(tmp
, self
.filename
)
1864 except shutil
.Error
:
1867 #if confirmChange and confirmDialog(self, "Keep this config?") == gtk.RESPONSE_NO:
1868 # shutil.copyfile(self.filename+".backup", self.filename) # Create backup
1869 # self.apply(widget, event, False)
1871 def changeAllFonts(self
, widget
):
1872 """Changes all fonts at once."""
1873 dialog
= gtk
.FontSelectionDialog("Select Font")
1875 dialog
.set_font_name(self
.defaults
["font"])
1877 if dialog
.run() == gtk
.RESPONSE_OK
:
1878 newFont
= dialog
.get_font_name()
1880 self
.clock1FontButton
.set_font_name(newFont
)
1881 self
.clock2FontButton
.set_font_name(newFont
)
1882 self
.bat1FontButton
.set_font_name(newFont
)
1883 self
.bat2FontButton
.set_font_name(newFont
)
1884 self
.fontButton
.set_font_name(newFont
)
1888 self
.generateConfig()
1889 self
.changeOccurred()
1891 def changeDefaults(self
, widget
=None):
1892 """Shows the style preferences widget."""
1893 TintWizardPrefGUI(self
)
1895 def changeOccurred(self
, widget
=None):
1896 """Called when the user changes something, i.e. entry value"""
1899 self
.updateStatusBar(change
=True)
1901 if widget
== self
.panelOrientation
:
1902 if self
.panelOrientation
.get_active_text() == "horizontal":
1903 self
.panelSizeLabel
.set_text("Size (width, height)")
1905 self
.panelSizeLabel
.set_text("Size (height, width)")
1907 def colorChange(self
, widget
):
1908 """Update the text entry when a color button is updated."""
1909 r
= widget
.get_color().red
1910 g
= widget
.get_color().green
1911 b
= widget
.get_color().blue
1913 label
= self
.getColorLabel(widget
)
1919 label
.set_text(rgbToHex(r
, g
, b
))
1921 self
.changeOccurred()
1923 def colorTyped(self
, widget
):
1924 """Update the color button when a valid value is typed into the entry."""
1925 s
= widget
.get_text()
1927 # The color button associated with this widget.
1928 colorButton
= self
.getColorButton(widget
)
1930 # Just a precautionary check - this situation should never arise.
1932 #print "Error in colorTyped() -- unrecognised entry widget."
1935 # If the entered value is invalid, set textbox to the current
1936 # hex value of the associated color button.
1937 buttonHex
= self
.getHexFromWidget(colorButton
)
1940 errorDialog(self
, "Invalid color specification: [%s]" % s
)
1941 widget
.set_text(buttonHex
)
1945 col
= gtk
.gdk
.Color(s
)
1947 errorDialog(self
, "Invalid color specification: [%s]" % s
)
1948 widget
.set_text(buttonHex
)
1951 colorButton
.set_color(col
)
1953 # Note: only set init to True when removing backgrounds for a new config
1954 # This prevents unwanted calls to changeOccurred()
1955 def delBgClick(self
, widget
=None, prompt
=True, init
=False):
1956 """Deletes the selected background after confirming with the user."""
1957 selected
= self
.bgNotebook
.get_current_page()
1959 if selected
== -1: # Nothing to remove
1963 if confirmDialog(self
, "Remove this background?") != gtk
.RESPONSE_YES
:
1966 self
.bgNotebook
.remove_page(selected
)
1967 self
.bgs
.pop(selected
)
1969 for i
in range(self
.bgNotebook
.get_n_pages()):
1970 self
.bgNotebook
.set_tab_label_text(self
.bgNotebook
.get_nth_page(i
), "Background ID %d" % (i
+1))
1972 self
.bgNotebook
.show_all()
1974 self
.updateComboBoxes(len(self
.bgs
) + 1, "remove")
1977 self
.changeOccurred()
1979 def generateConfig(self
):
1980 """Reads values from each widget and generates a config."""
1981 self
.configBuf
.delete(self
.configBuf
.get_start_iter(), self
.configBuf
.get_end_iter())
1982 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "# Tint2 config file\n")
1983 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "# Generated by tintwizard (http://code.google.com/p/tintwizard/)\n")
1984 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "# For information on manually configuring tint2 see http://code.google.com/p/tint2/wiki/Configure\n\n")
1985 if not self
.oneConfigFile
:
1986 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "# To use this as default tint2 config: save as $HOME/.config/tint2/tint2rc\n\n")
1988 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "# Background definitions\n")
1989 for i
in range(len(self
.bgs
)):
1990 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "# ID %d\n" % (i
+ 1))
1992 for child
in self
.bgs
[i
].get_children():
1993 if child
.get_name() == "rounded":
1994 rounded
= child
.get_text() if child
.get_text() else BG_ROUNDING
1995 elif child
.get_name() == "border":
1996 borderW
= child
.get_text() if child
.get_text() else BG_BORDER
1997 elif child
.get_name() == "bgCol":
1998 bgCol
= self
.getHexFromWidget(child
)
1999 bgAlpha
= int(child
.get_alpha() / 65535.0 * 100)
2000 elif child
.get_name() == "borderCol":
2001 borderCol
= self
.getHexFromWidget(child
)
2002 borderAlpha
= int(child
.get_alpha() / 65535.0 * 100)
2004 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "rounded = %s\n" % (rounded
))
2005 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "border_width = %s\n" % (borderW
))
2006 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "background_color = %s %d\n" % (bgCol
, bgAlpha
))
2007 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "border_color = %s %d\n\n" % (borderCol
, borderAlpha
))
2009 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "# Panel\n")
2010 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "panel_monitor = %s\n" % (self
.panelMonitor
.get_text() if self
.panelMonitor
.get_text() else PANEL_MONITOR
))
2011 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "panel_position = %s %s %s\n" % (self
.panelPosY
.get_active_text(), self
.panelPosX
.get_active_text(), self
.panelOrientation
.get_active_text()))
2012 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "panel_size = %s %s\n" % (self
.panelSizeX
.get_text() if self
.panelSizeX
.get_text() else PANEL_SIZE_X
,
2013 self
.panelSizeY
.get_text() if self
.panelSizeY
.get_text() else PANEL_SIZE_Y
))
2014 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "panel_margin = %s %s\n" % (self
.panelMarginX
.get_text() if self
.panelMarginX
.get_text() else PANEL_MARGIN_X
,
2015 self
.panelMarginY
.get_text() if self
.panelMarginY
.get_text() else PANEL_MARGIN_Y
))
2016 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "panel_padding = %s %s %s\n" % (self
.panelPadX
.get_text() if self
.panelPadX
.get_text() else PANEL_PADDING_X
,
2017 self
.panelPadY
.get_text() if self
.panelPadY
.get_text() else PANEL_PADDING_Y
,
2018 self
.panelSpacing
.get_text() if self
.panelSpacing
.get_text() else TASKBAR_SPACING
))
2019 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "panel_dock = %s\n" % int(self
.panelDock
.get_active()))
2020 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "wm_menu = %s\n" % int(self
.panelMenu
.get_active()))
2021 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "panel_layer = %s\n" % (self
.panelLayer
.get_active_text()))
2022 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "panel_background_id = %s\n" % (self
.panelBg
.get_active()))
2024 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Panel Autohide\n")
2025 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "autohide = %s\n" % int(self
.panelAutohide
.get_active()))
2026 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "autohide_show_timeout = %s\n" % (self
.panelAutohideShow
.get_text() if self
.panelAutohideShow
.get_text() else PANEL_AUTOHIDE_SHOW
))
2027 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "autohide_hide_timeout = %s\n" % (self
.panelAutohideHide
.get_text() if self
.panelAutohideHide
.get_text() else PANEL_AUTOHIDE_HIDE
))
2028 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "autohide_height = %s\n" % (self
.panelAutohideHeight
.get_text() if self
.panelAutohideHeight
.get_text() else PANEL_AUTOHIDE_HEIGHT
))
2029 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "strut_policy = %s\n" % (self
.panelAutohideStrut
.get_active_text() if self
.panelAutohideStrut
.get_active_text() else PANEL_AUTOHIDE_STRUT
))
2031 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Taskbar\n")
2032 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "taskbar_mode = %s\n" % (self
.taskbarMode
.get_active_text()))
2033 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "taskbar_padding = %s %s %s\n" % (self
.taskbarPadX
.get_text() if self
.taskbarPadX
.get_text() else TASKBAR_PADDING_X
,
2034 self
.taskbarPadY
.get_text() if self
.taskbarPadY
.get_text() else TASKBAR_PADDING_X
,
2035 self
.taskbarSpacing
.get_text() if self
.taskbarSpacing
.get_text() else TASK_SPACING
))
2036 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "taskbar_background_id = %s\n" % (self
.taskbarBg
.get_active()))
2037 # Comment out the taskbar_active_background_id if user has "disabled" it
2038 if self
.taskbarActiveBgEnable
.get_active() == 0:
2039 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "#")
2040 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "taskbar_active_background_id = %s\n" % (self
.taskbarActiveBg
.get_active()))
2042 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Tasks\n")
2043 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "urgent_nb_of_blink = %s\n" % (self
.taskBlinks
.get_text() if self
.taskBlinks
.get_text() else TASK_BLINKS
))
2044 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_icon = %s\n" % int(self
.taskIconCheckButton
.get_active()))
2045 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_text = %s\n" % int(self
.taskTextCheckButton
.get_active()))
2046 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_centered = %s\n" % int(self
.taskCentreCheckButton
.get_active()))
2047 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_maximum_size = %s %s\n" % (self
.taskMaxSizeX
.get_text() if self
.taskMaxSizeX
.get_text() else TASK_MAXIMUM_SIZE_X
, self
.taskMaxSizeY
.get_text() if self
.taskMaxSizeY
.get_text() else TASK_MAXIMUM_SIZE_Y
))
2048 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_padding = %s %s\n" % (self
.taskPadX
.get_text() if self
.taskPadX
.get_text() else TASK_PADDING_X
,
2049 self
.taskPadY
.get_text() if self
.taskPadY
.get_text() else TASK_PADDING_Y
))
2050 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_background_id = %s\n" % (self
.taskBg
.get_active()))
2051 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_active_background_id = %s\n" % (self
.taskActiveBg
.get_active()))
2052 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_urgent_background_id = %s\n" % (self
.taskUrgentBg
.get_active()))
2053 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_iconified_background_id = %s\n" % (self
.taskIconifiedBg
.get_active()))
2055 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Task Icons\n")
2056 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_icon_asb = %s %s %s\n" % (self
.iconHue
.get_text() if self
.iconHue
.get_text() else ICON_ALPHA
,
2057 self
.iconSat
.get_text() if self
.iconSat
.get_text() else ICON_SAT
,
2058 self
.iconBri
.get_text() if self
.iconBri
.get_text() else ICON_BRI
))
2059 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_active_icon_asb = %s %s %s\n" % (self
.activeIconHue
.get_text() if self
.activeIconHue
.get_text() else ACTIVE_ICON_ALPHA
,
2060 self
.activeIconSat
.get_text() if self
.activeIconSat
.get_text() else ACTIVE_ICON_SAT
,
2061 self
.activeIconBri
.get_text() if self
.activeIconBri
.get_text() else ACTIVE_ICON_BRI
))
2062 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_urgent_icon_asb = %s %s %s\n" % (self
.urgentIconHue
.get_text() if self
.urgentIconHue
.get_text() else URGENT_ICON_ALPHA
,
2063 self
.urgentIconSat
.get_text() if self
.urgentIconSat
.get_text() else URGENT_ICON_SAT
,
2064 self
.urgentIconBri
.get_text() if self
.urgentIconBri
.get_text() else URGENT_ICON_BRI
))
2065 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_iconified_icon_asb = %s %s %s\n" % (self
.iconifiedIconHue
.get_text() if self
.iconifiedIconHue
.get_text() else ICONIFIED_ICON_ALPHA
,
2066 self
.iconifiedIconSat
.get_text() if self
.iconifiedIconSat
.get_text() else ICONIFIED_ICON_SAT
,
2067 self
.iconifiedIconBri
.get_text() if self
.iconifiedIconBri
.get_text() else ICONIFIED_ICON_BRI
))
2069 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Fonts\n")
2070 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_font = %s\n" % (self
.fontButton
.get_font_name()))
2071 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_font_color = %s %s\n" % (self
.getHexFromWidget(self
.fontColButton
),
2072 int(self
.fontColButton
.get_alpha() / 65535.0 * 100)))
2073 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_active_font_color = %s %s\n" % (self
.getHexFromWidget(self
.fontActiveColButton
),
2074 int(self
.fontActiveColButton
.get_alpha() / 65535.0 * 100)))
2075 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_urgent_font_color = %s %s\n" % (self
.getHexFromWidget(self
.fontUrgentColButton
),
2076 int(self
.fontUrgentColButton
.get_alpha() / 65535.0 * 100)))
2077 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_iconified_font_color = %s %s\n" % (self
.getHexFromWidget(self
.fontIconifiedColButton
),
2078 int(self
.fontIconifiedColButton
.get_alpha() / 65535.0 * 100)))
2079 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "font_shadow = %s\n" % int(self
.fontShadowCheckButton
.get_active()))
2081 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# System Tray\n")
2082 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "systray = %s\n" % int(self
.trayShow
.get_active()))
2083 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "systray_padding = %s %s %s\n" % (self
.trayPadX
.get_text() if self
.trayPadX
.get_text() else TRAY_PADDING_X
,
2084 self
.trayPadY
.get_text() if self
.trayPadY
.get_text() else TRAY_PADDING_Y
,
2085 self
.traySpacing
.get_text() if self
.traySpacing
.get_text() else TRAY_SPACING
))
2086 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "systray_sort = %s\n" % (self
.trayOrder
.get_active_text()))
2087 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "systray_background_id = %s\n" % (self
.trayBg
.get_active()))
2088 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "systray_icon_size = %s\n" % (self
.trayMaxIconSize
.get_text() if self
.trayMaxIconSize
.get_text() else TRAY_MAX_ICON_SIZE
))
2089 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "systray_icon_asb = %s %s %s\n" % (self
.trayIconHue
.get_text() if self
.trayIconHue
.get_text() else TRAY_ICON_ALPHA
,
2090 self
.trayIconSat
.get_text() if self
.trayIconSat
.get_text() else TRAY_ICON_SAT
,
2091 self
.trayIconBri
.get_text() if self
.trayIconBri
.get_text() else TRAY_ICON_BRI
))
2093 if self
.clockCheckButton
.get_active():
2094 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Clock\n")
2095 if self
.clock1CheckButton
.get_active():
2096 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "time1_format = %s\n" % (self
.clock1Format
.get_text() if self
.clock1Format
.get_text() else CLOCK_FMT_1
))
2097 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "time1_font = %s\n" % (self
.clock1FontButton
.get_font_name()))
2098 if self
.clock2CheckButton
.get_active():
2099 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "time2_format = %s\n" % (self
.clock2Format
.get_text() if self
.clock2Format
.get_text() else CLOCK_FMT_2
))
2100 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "time2_font = %s\n" % (self
.clock2FontButton
.get_font_name()))
2102 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "clock_font_color = %s %s\n" % (self
.getHexFromWidget(self
.clockFontColButton
),
2103 int(self
.clockFontColButton
.get_alpha() / 65535.0 * 100)))
2105 if self
.clockTooltipCheckButton
.get_active():
2106 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "clock_tooltip = %s\n" % (self
.clockTooltipFormat
.get_text() if self
.clockTooltipFormat
.get_text() else CLOCK_TOOLTIP
))
2107 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "clock_padding = %s %s\n" % (self
.clockPadX
.get_text() if self
.clockPadX
.get_text() else CLOCK_PADDING_X
,
2108 self
.clockPadY
.get_text() if self
.clockPadY
.get_text() else CLOCK_PADDING_Y
))
2109 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "clock_background_id = %s\n" % (self
.clockBg
.get_active()))
2110 if self
.clockLClick
.get_text():
2111 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "clock_lclick_command = %s\n" % (self
.clockLClick
.get_text()))
2112 if self
.clockRClick
.get_text():
2113 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "clock_rclick_command = %s\n" % (self
.clockRClick
.get_text()))
2114 if self
.clockTimezone1CheckButton
.get_active():
2115 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "time1_timezone = %s\n" % (self
.clockTime1Timezone
.get_text() if self
.clockTime1Timezone
.get_text() else CLOCK_TIME1_TIMEZONE
))
2116 if self
.clockTimezone2CheckButton
.get_active():
2117 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "time2_timezone = %s\n" % (self
.clockTime2Timezone
.get_text() if self
.clockTime2Timezone
.get_text() else CLOCK_TIME2_TIMEZONE
))
2118 if self
.clockTimezoneTooltipCheckButton
.get_active():
2119 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "clock_tooltip_timezone = %s\n" % (self
.clockTooltipTimezone
.get_text() if self
.clockTooltipTimezone
.get_text() else CLOCK_TOOLTIP_TIMEZONE
))
2122 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Tooltips\n")
2123 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "tooltip = %s\n" % int(self
.tooltipShow
.get_active()))
2124 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "tooltip_padding = %s %s\n" % (self
.tooltipPadX
.get_text() if self
.tooltipPadX
.get_text() else TOOLTIP_PADDING_Y
,
2125 self
.tooltipPadY
.get_text() if self
.tooltipPadY
.get_text() else TOOLTIP_PADDING_Y
))
2126 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "tooltip_show_timeout = %s\n" % (self
.tooltipShowTime
.get_text() if self
.tooltipShowTime
.get_text() else TOOLTIP_SHOW_TIMEOUT
))
2127 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "tooltip_hide_timeout = %s\n" % (self
.tooltipHideTime
.get_text() if self
.tooltipHideTime
.get_text() else TOOLTIP_HIDE_TIMEOUT
))
2128 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "tooltip_background_id = %s\n" % (self
.tooltipBg
.get_active()))
2129 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "tooltip_font = %s\n" % (self
.tooltipFont
.get_font_name()))
2130 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "tooltip_font_color = %s %s\n" % (self
.getHexFromWidget(self
.tooltipFontColButton
),
2131 int(self
.tooltipFontColButton
.get_alpha() / 65535.0 * 100)))
2133 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Mouse\n")
2134 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "mouse_middle = %s\n" % (self
.mouseMiddle
.get_active_text()))
2135 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "mouse_right = %s\n" % (self
.mouseRight
.get_active_text()))
2136 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "mouse_scroll_up = %s\n" % (self
.mouseUp
.get_active_text()))
2137 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "mouse_scroll_down = %s\n" % (self
.mouseDown
.get_active_text()))
2139 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Battery\n")
2140 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "battery = %s\n" % int(self
.batteryCheckButton
.get_active()))
2141 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "battery_low_status = %s\n" % (self
.batteryLow
.get_text() if self
.batteryLow
.get_text() else BATTERY_LOW
))
2142 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "battery_low_cmd = %s\n" % (self
.batteryLowAction
.get_text() if self
.batteryLowAction
.get_text() else BATTERY_ACTION
))
2143 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "battery_hide = %s\n" % (self
.batteryHide
.get_text() if self
.batteryHide
.get_text() else BATTERY_HIDE
))
2144 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "bat1_font = %s\n" % (self
.bat1FontButton
.get_font_name()))
2145 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "bat2_font = %s\n" % (self
.bat2FontButton
.get_font_name()))
2146 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "battery_font_color = %s %s\n" % (self
.getHexFromWidget(self
.batteryFontColButton
),
2147 int(self
.batteryFontColButton
.get_alpha() / 65535.0 * 100)))
2148 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "battery_padding = %s %s\n" % (self
.batteryPadX
.get_text() if self
.batteryPadX
.get_text() else BATTERY_PADDING_Y
,
2149 self
.batteryPadY
.get_text() if self
.batteryPadY
.get_text() else BATTERY_PADDING_Y
))
2150 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "battery_background_id = %s\n" % (self
.batteryBg
.get_active()))
2152 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# End of config")
2154 def getColorButton(self
, widget
):
2155 """Returns the color button associated with widget."""
2156 if widget
.get_name() == "fontCol":
2157 return self
.fontColButton
2158 elif widget
.get_name() == "fontActiveCol":
2159 return self
.fontActiveColButton
2160 elif widget
.get_name() == "fontUrgentCol":
2161 return self
.fontUrgentColButton
2162 elif widget
.get_name() == "fontIconifiedCol":
2163 return self
.fontIconifiedColButton
2164 elif widget
.get_name() == "clockFontCol":
2165 return self
.clockFontColButton
2166 elif widget
.get_name() == "batteryFontCol":
2167 return self
.batteryFontColButton
2168 elif widget
.get_name() == "tooltipFontCol":
2169 return self
.tooltipFontColButton
2170 elif widget
.get_name() == "bgColEntry":
2171 bgID
= self
.bgNotebook
.get_current_page()
2173 for child
in self
.bgs
[bgID
].get_children():
2174 if child
.get_name() == "bgCol":
2177 elif widget
.get_name() == "borderColEntry":
2178 bgID
= self
.bgNotebook
.get_current_page()
2180 for child
in self
.bgs
[bgID
].get_children():
2181 if child
.get_name() == "borderCol":
2185 # No button found which matches label
2188 def getColorLabel(self
, widget
):
2189 """Gets the color label associated with a color button."""
2190 if widget
.get_name() == "fontCol":
2192 elif widget
.get_name() == "fontActiveCol":
2193 return self
.fontActiveCol
2194 elif widget
.get_name() == "fontUrgentCol":
2195 return self
.fontUrgentCol
2196 elif widget
.get_name() == "fontIconifiedCol":
2197 return self
.fontIconifiedCol
2198 elif widget
.get_name() == "clockFontCol":
2199 return self
.clockFontCol
2200 elif widget
.get_name() == "batteryFontCol":
2201 return self
.batteryFontCol
2202 elif widget
.get_name() == "tooltipFontCol":
2203 return self
.tooltipFontCol
2204 elif widget
.get_name() == "bgCol":
2205 bgID
= self
.bgNotebook
.get_current_page()
2207 for child
in self
.bgs
[bgID
].get_children():
2208 if child
.get_name() == "bgColEntry":
2211 elif widget
.get_name() == "borderCol":
2212 bgID
= self
.bgNotebook
.get_current_page()
2214 for child
in self
.bgs
[bgID
].get_children():
2215 if child
.get_name() == "borderColEntry":
2219 # No label found which matches color button
2222 def getHexFromWidget(self
, widget
):
2223 """Returns the #RRGGBB value of a widget."""
2224 r
= widget
.get_color().red
2225 g
= widget
.get_color().green
2226 b
= widget
.get_color().blue
2228 return rgbToHex(r
, g
, b
)
2230 def help(self
, action
=None):
2231 """Opens the Help wiki page in the default web browser."""
2233 webbrowser
.open("http://code.google.com/p/tintwizard/wiki/Help")
2235 errorDialog(self
, "Your default web-browser could not be opened.\nPlease visit http://code.google.com/p/tintwizard/wiki/Help")
2238 """Enters the main loop."""
2241 def new(self
, action
=None):
2242 """Prepares a new config."""
2247 self
.filename
= None
2251 self
.generateConfig()
2252 self
.updateStatusBar("New Config File [*]")
2254 def openDef(self
, widget
=None):
2255 """Opens the default tint2 config."""
2256 self
.openFile(default
=True)
2258 def openFile(self
, widget
=None, default
=False):
2259 """Reads from a config file. If default=True, open the tint2 default config."""
2263 chooser
= gtk
.FileChooserDialog("Open Config File", self
, gtk
.FILE_CHOOSER_ACTION_OPEN
, (gtk
.STOCK_CANCEL
, gtk
.RESPONSE_CANCEL
, gtk
.STOCK_OPEN
, gtk
.RESPONSE_OK
))
2264 chooser
.set_default_response(gtk
.RESPONSE_OK
)
2266 if self
.curDir
!= None:
2267 chooser
.set_current_folder(self
.curDir
)
2269 chooserFilter
= gtk
.FileFilter()
2270 chooserFilter
.set_name("All files")
2271 chooserFilter
.add_pattern("*")
2272 chooser
.add_filter(chooserFilter
)
2275 response
= chooser
.run()
2277 if response
== gtk
.RESPONSE_OK
:
2278 self
.filename
= chooser
.get_filename()
2279 self
.curDir
= os
.path
.dirname(self
.filename
)
2286 self
.filename
= os
.path
.expandvars("$HOME/.config/tint2/tint2rc")
2287 self
.curDir
= os
.path
.expandvars("$HOME/.config/tint2")
2289 self
.readTint2Config()
2290 self
.generateConfig()
2291 self
.updateStatusBar()
2293 def parseBgs(self
, string
):
2294 """Parses the background definitions from a string."""
2295 s
= string
.split("\n")
2299 bgKeys
= ["border_width", "background_color", "border_color"]
2303 data
= [token
.strip() for token
in line
.split("=")]
2305 if data
[0] == "rounded": # It may be considered bad practice to
2306 bgDefs
+= [{"rounded": data[1]}
] # find each style definition with an
2307 elif data
[0] in bgKeys
: # arbitrary value, but tint2 does the same.
2308 bgDefs
[cur
][data
[0]] = data
[1] # This means that any existing configs must
2309 else: # start with 'rounded'.
2310 newString
+= "%s\n" % line
2312 self
.addBgDefs(bgDefs
)
2316 def parseConfig(self
, string
):
2317 """Parses the contents of a config file."""
2318 for line
in string
.split("\n"):
2319 s
= line
.split("=") # Create a list with KEY and VALUE
2321 e
= s
[0].strip() # Strip whitespace from KEY
2323 if e
== "time1_format": # Set the VALUE of KEY
2324 self
.parseProp(self
.propUI
[e
], s
[1], True, "time1")
2325 elif e
== "time2_format":
2326 self
.parseProp(self
.propUI
[e
], s
[1], True, "time2")
2327 elif e
== "clock_tooltip":
2328 self
.parseProp(self
.propUI
[e
], s
[1], True, "clock_tooltip")
2329 elif e
== "time1_timezone":
2330 self
.parseProp(self
.propUI
[e
], s
[1], True, "time1_timezone")
2331 elif e
== "time2_timezone":
2332 self
.parseProp(self
.propUI
[e
], s
[1], True, "time2_timezone")
2333 elif e
== "clock_tooltip_timezone":
2334 self
.parseProp(self
.propUI
[e
], s
[1], True, "tooltip_timezone")
2335 elif e
== "systray_padding":
2336 self
.parseProp(self
.propUI
[e
], s
[1], True, "tray")
2337 elif e
== "taskbar_active_background_id":
2338 self
.parseProp(self
.propUI
[e
], s
[1], True, "activeBg")
2340 if self
.propUI
.has_key(e
):
2341 self
.parseProp(self
.propUI
[e
], s
[1])
2343 def parseProp(self
, prop
, string
, special
=False, propType
=""):
2344 """Parses a variable definition from the conf file and updates the correct UI widget."""
2345 string
= string
.strip() # Remove whitespace from the VALUE
2346 eType
= type(prop
) # Get widget type
2348 if special
: # 'Special' properties are those which are optional
2349 if propType
== "time1":
2350 self
.clockCheckButton
.set_active(True)
2351 self
.clock1CheckButton
.set_active(True)
2352 elif propType
== "time2":
2353 self
.clockCheckButton
.set_active(True)
2354 self
.clock2CheckButton
.set_active(True)
2355 elif propType
== "clock_tooltip":
2356 self
.clockCheckButton
.set_active(True)
2357 self
.clockTooltipCheckButton
.set_active(True)
2358 elif propType
== "time1_timezone":
2359 self
.clockTimezone1CheckButton
.set_active(True)
2360 elif propType
== "time2_timezone":
2361 self
.clockTimezone2CheckButton
.set_active(True)
2362 elif propType
== "tooltip_timezone":
2363 self
.clockTimezoneTooltipCheckButton
.set_active(True)
2364 elif propType
== "tray":
2365 self
.trayShow
.set_active(True)
2366 elif propType
== "activeBg":
2367 self
.taskbarActiveBgEnable
.set_active(True)
2369 if eType
== gtk
.Entry
:
2370 prop
.set_text(string
)
2372 elif eType
== gtk
.ComboBox
:
2373 # This allows us to select the correct combo-box value.
2374 if string
in ["bottom", "top", "left", "right", "center", "single_desktop", "multi_desktop", "single_monitor",
2375 "none", "close", "shade", "iconify", "toggle", "toggle_iconify", "maximize_restore",
2376 "desktop_left", "desktop_right", "horizontal", "vertical", "ascending", "descending",
2377 "left2right", "right2left", "next_task", "prev_task", "minimum", "follow_size", "normal"]:
2378 if string
in ["bottom", "left", "single_desktop", "none", "horizontal", "ascending"]:
2380 elif string
in ["top", "right", "multi_desktop", "close", "vertical", "descending", "minimum"]:
2382 elif string
in ["center", "single_monitor", "toggle", "left2right", "follow_size", "normal"]:
2384 elif string
in ["right2left"]:
2387 i
= ["none", "close", "toggle", "iconify", "shade", "toggle_iconify", "maximize_restore",
2388 "desktop_left", "desktop_right", "next_task", "prev_task"].index(string
)
2392 prop
.set_active(int(string
))
2393 elif eType
== gtk
.CheckButton
:
2394 prop
.set_active(bool(int(string
)))
2395 elif eType
== gtk
.FontButton
:
2396 prop
.set_font_name(string
)
2397 elif eType
== gtk
.ColorButton
:
2398 prop
.set_alpha(int(int(string
) * 65535 / 100.0))
2399 elif eType
== tuple: # If a property has more than 1 value, for example the x and y co-ords
2400 s
= string
.split(" ") # of the padding properties, then just we use recursion to set the
2401 for i
in range(len(prop
)): # value of each associated widget.
2403 self
.parseProp(prop
[i
], "0")
2405 self
.parseProp(prop
[i
], s
[i
])
2407 def quit(self
, widget
, event
=None):
2408 """Asks if user would like to save file before quitting, then quits the program."""
2410 if self
.oneConfigFile
:
2411 response
= gtk
.RESPONSE_YES
2413 dialog
= gtk
.Dialog("Save config?", self
, gtk
.DIALOG_MODAL
, (gtk
.STOCK_YES
, gtk
.RESPONSE_YES
, gtk
.STOCK_NO
, gtk
.RESPONSE_NO
, gtk
.STOCK_CANCEL
, gtk
.RESPONSE_CANCEL
))
2414 dialog
.get_content_area().add(gtk
.Label("Save config before quitting?"))
2415 dialog
.get_content_area().set_size_request(300, 100)
2417 response
= dialog
.run()
2420 if response
== gtk
.RESPONSE_CANCEL
:
2421 return True # Return True to stop it quitting when we hit "Cancel"
2422 elif response
== gtk
.RESPONSE_NO
:
2424 elif response
== gtk
.RESPONSE_YES
:
2431 """Reads the tintwizard configuration file - NOT tint2 config files."""
2432 self
.defaults
= {"font": None, "bgColor": None, "fgColor": None, "borderColor": None, "bgCount": None, "dir": None}
2434 if self
.oneConfigFile
:
2435 # don't need tintwizard.conf
2438 pathName
= os
.path
.dirname(sys
.argv
[0])
2443 if not os
.path
.exists(pathName
+ "tintwizard.conf"):
2447 f
= open(pathName
+ "tintwizard.conf", "r")
2453 if self
.defaults
.has_key(l
[0].strip()):
2454 self
.defaults
[l
[0].strip()] = l
[1].strip()
2456 def readTint2Config(self
):
2457 """Reads in from a config file."""
2458 f
= open(self
.filename
, "r")
2463 if (line
[0] != "#") and (len(line
) > 2):
2468 # Deselect the optional stuff, and we'll re-check them if the config has them enabled
2469 self
.clockCheckButton
.set_active(False)
2470 self
.clock1CheckButton
.set_active(False)
2471 self
.clock2CheckButton
.set_active(False)
2472 self
.clockTooltipCheckButton
.set_active(False)
2473 self
.clockTimezone1CheckButton
.set_active(False)
2474 self
.clockTimezone2CheckButton
.set_active(False)
2475 self
.clockTimezoneTooltipCheckButton
.set_active(False)
2476 self
.trayShow
.set_active(False)
2477 self
.taskbarActiveBgEnable
.set_active(False)
2479 # Remove all background styles so we can create new ones as we read them
2480 for i
in range(len(self
.bgs
)):
2481 self
.delBgClick(None, False)
2483 # As we parse background definitions, we build a new string
2484 # without the background related stuff. This means we don't
2485 # have to read through background defs AGAIN when parsing
2487 noBgDefs
= self
.parseBgs(string
)
2489 self
.parseConfig(noBgDefs
)
2491 def reportBug(self
, action
=None):
2492 """Opens the bug report page in the default web browser."""
2494 webbrowser
.open("http://code.google.com/p/tintwizard/issues/entry")
2496 errorDialog(self
, "Your default web-browser could not be opened.\nPlease visit http://code.google.com/p/tintwizard/issues/entry")
2499 def resetConfig(self
):
2500 """Resets all the widgets to their default values."""
2502 for i
in range(len(self
.bgs
)):
2503 self
.delBgClick(prompt
=False, init
=True)
2505 for i
in range(self
.defaults
["bgCount"]):
2506 self
.addBgClick(init
=True)
2508 self
.bgNotebook
.set_current_page(0)
2511 self
.panelPosY
.set_active(0)
2512 self
.panelPosX
.set_active(0)
2513 self
.panelOrientation
.set_active(0)
2514 self
.panelSizeX
.set_text(PANEL_SIZE_X
)
2515 self
.panelSizeY
.set_text(PANEL_SIZE_Y
)
2516 self
.panelMarginX
.set_text(PANEL_MARGIN_X
)
2517 self
.panelMarginY
.set_text(PANEL_MARGIN_Y
)
2518 self
.panelPadX
.set_text(PANEL_PADDING_Y
)
2519 self
.panelPadY
.set_text(PANEL_PADDING_Y
)
2520 self
.panelSpacing
.set_text(TASKBAR_SPACING
)
2521 self
.panelBg
.set_active(0)
2522 self
.panelMenu
.set_active(0)
2523 self
.panelDock
.set_active(0)
2524 self
.panelLayer
.set_active(0)
2525 self
.panelMonitor
.set_text(PANEL_MONITOR
)
2526 self
.panelAutohide
.set_active(0)
2527 self
.panelAutohideShow
.set_text(PANEL_AUTOHIDE_SHOW
)
2528 self
.panelAutohideHide
.set_text(PANEL_AUTOHIDE_HIDE
)
2529 self
.panelAutohideHeight
.set_text(PANEL_AUTOHIDE_HEIGHT
)
2530 self
.panelAutohideStrut
.set_active(0)
2532 self
.taskbarMode
.set_active(0)
2533 self
.taskbarPadX
.set_text(TASKBAR_PADDING_X
)
2534 self
.taskbarPadY
.set_text(TASKBAR_PADDING_Y
)
2535 self
.taskbarSpacing
.set_text(TASK_SPACING
)
2536 self
.taskbarBg
.set_active(0)
2537 self
.taskbarActiveBg
.set_active(0)
2538 self
.taskbarActiveBgEnable
.set_active(0)
2540 self
.taskBlinks
.set_text(TASK_BLINKS
)
2541 self
.taskCentreCheckButton
.set_active(True)
2542 self
.taskTextCheckButton
.set_active(True)
2543 self
.taskIconCheckButton
.set_active(True)
2544 self
.taskMaxSizeX
.set_text(TASK_MAXIMUM_SIZE_X
)
2545 self
.taskMaxSizeY
.set_text(TASK_MAXIMUM_SIZE_Y
)
2546 self
.taskPadX
.set_text(TASK_PADDING_X
)
2547 self
.taskPadY
.set_text(TASK_PADDING_Y
)
2548 self
.taskBg
.set_active(0)
2549 self
.taskActiveBg
.set_active(0)
2550 self
.taskUrgentBg
.set_active(0)
2551 self
.taskIconifiedBg
.set_active(0)
2553 self
.iconHue
.set_text(ICON_ALPHA
)
2554 self
.iconSat
.set_text(ICON_SAT
)
2555 self
.iconBri
.set_text(ICON_BRI
)
2556 self
.activeIconHue
.set_text(ACTIVE_ICON_ALPHA
)
2557 self
.activeIconSat
.set_text(ACTIVE_ICON_SAT
)
2558 self
.activeIconBri
.set_text(ACTIVE_ICON_BRI
)
2559 self
.urgentIconHue
.set_text(URGENT_ICON_ALPHA
)
2560 self
.urgentIconSat
.set_text(URGENT_ICON_SAT
)
2561 self
.urgentIconBri
.set_text(URGENT_ICON_BRI
)
2562 self
.iconifiedIconHue
.set_text(ICONIFIED_ICON_ALPHA
)
2563 self
.iconifiedIconSat
.set_text(ICONIFIED_ICON_SAT
)
2564 self
.iconifiedIconBri
.set_text(ICONIFIED_ICON_BRI
)
2566 self
.fontButton
.set_font_name(self
.defaults
["font"])
2567 self
.fontColButton
.set_alpha(65535)
2568 self
.fontColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2569 self
.fontCol
.set_text(self
.defaults
["fgColor"])
2570 self
.fontActiveColButton
.set_alpha(65535)
2571 self
.fontActiveColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2572 self
.fontActiveCol
.set_text(self
.defaults
["fgColor"])
2573 self
.fontUrgentColButton
.set_alpha(65535)
2574 self
.fontUrgentColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2575 self
.fontUrgentCol
.set_text(self
.defaults
["fgColor"])
2576 self
.fontIconifiedColButton
.set_alpha(65535)
2577 self
.fontIconifiedColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2578 self
.fontIconifiedCol
.set_text(self
.defaults
["fgColor"])
2579 self
.fontShadowCheckButton
.set_active(False)
2581 self
.trayShow
.set_active(True)
2582 self
.trayPadX
.set_text(TRAY_PADDING_X
)
2583 self
.trayPadY
.set_text(TRAY_PADDING_X
)
2584 self
.traySpacing
.set_text(TRAY_SPACING
)
2585 self
.trayOrder
.set_active(0)
2586 self
.trayBg
.set_active(0)
2587 self
.trayMaxIconSize
.set_text(TRAY_MAX_ICON_SIZE
)
2588 self
.trayIconHue
.set_text(TRAY_ICON_ALPHA
)
2589 self
.trayIconSat
.set_text(TRAY_ICON_SAT
)
2590 self
.trayIconBri
.set_text(TRAY_ICON_BRI
)
2592 self
.clockCheckButton
.set_active(True)
2593 self
.clock1Format
.set_text(CLOCK_FMT_1
)
2594 self
.clock1CheckButton
.set_active(True)
2595 self
.clock1FontButton
.set_font_name(self
.defaults
["font"])
2596 self
.clock2Format
.set_text(CLOCK_FMT_2
)
2597 self
.clock2CheckButton
.set_active(True)
2598 self
.clockTooltipFormat
.set_text(CLOCK_TOOLTIP
)
2599 self
.clockTooltipCheckButton
.set_active(False)
2600 self
.clock2FontButton
.set_font_name(self
.defaults
["font"])
2601 self
.clockFontColButton
.set_alpha(65535)
2602 self
.clockFontColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2603 self
.clockFontCol
.set_text(self
.defaults
["fgColor"])
2604 self
.clockPadX
.set_text(CLOCK_PADDING_X
)
2605 self
.clockPadY
.set_text(CLOCK_PADDING_Y
)
2606 self
.clockBg
.set_active(0)
2607 self
.clockLClick
.set_text(CLOCK_LCLICK
)
2608 self
.clockRClick
.set_text(CLOCK_RCLICK
)
2609 self
.clockTime1Timezone
.set_text(CLOCK_TIME1_TIMEZONE
)
2610 self
.clockTimezone1CheckButton
.set_active(False)
2611 self
.clockTime2Timezone
.set_text(CLOCK_TIME2_TIMEZONE
)
2612 self
.clockTimezone2CheckButton
.set_active(False)
2613 self
.clockTooltipTimezone
.set_text(CLOCK_TOOLTIP_TIMEZONE
)
2614 self
.clockTimezoneTooltipCheckButton
.set_active(False)
2616 self
.tooltipShow
.set_active(False)
2617 self
.tooltipPadX
.set_text(TOOLTIP_PADDING_X
)
2618 self
.tooltipPadY
.set_text(TOOLTIP_PADDING_Y
)
2619 self
.tooltipShowTime
.set_text(TOOLTIP_SHOW_TIMEOUT
)
2620 self
.tooltipHideTime
.set_text(TOOLTIP_HIDE_TIMEOUT
)
2621 self
.tooltipBg
.set_active(0)
2622 self
.tooltipFont
.set_font_name(self
.defaults
["font"])
2623 self
.tooltipFontColButton
.set_alpha(65535)
2624 self
.tooltipFontColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2625 self
.tooltipFontCol
.set_text(self
.defaults
["fgColor"])
2627 self
.mouseMiddle
.set_active(0)
2628 self
.mouseRight
.set_active(0)
2629 self
.mouseUp
.set_active(0)
2630 self
.mouseDown
.set_active(0)
2632 self
.batteryCheckButton
.set_active(False)
2633 self
.batteryLow
.set_text(BATTERY_LOW
)
2634 self
.batteryLowAction
.set_text(BATTERY_ACTION
)
2635 self
.batteryHide
.set_text(BATTERY_HIDE
)
2636 self
.bat1FontButton
.set_font_name(self
.defaults
["font"])
2637 self
.bat2FontButton
.set_font_name(self
.defaults
["font"])
2638 self
.batteryFontColButton
.set_alpha(65535)
2639 self
.batteryFontColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2640 self
.batteryFontCol
.set_text(self
.defaults
["fgColor"])
2641 self
.batteryPadX
.set_text(BATTERY_PADDING_Y
)
2642 self
.batteryPadY
.set_text(BATTERY_PADDING_Y
)
2643 self
.batteryBg
.set_active(0)
2645 def save(self
, widget
=None, event
=None):
2646 """Saves the generated config file."""
2648 # This function returns the boolean status of whether or not the
2649 # file saved, so that the apply() function knows if it should
2650 # kill the tint2 process and apply the new config.
2652 # If no file has been selected, force the user to "Save As..."
2653 if self
.filename
== None:
2654 return self
.saveAs()
2656 self
.generateConfig()
2661 def saveAs(self
, widget
=None, event
=None):
2662 """Prompts the user to select a file and then saves the generated config file."""
2663 self
.generateConfig()
2665 chooser
= gtk
.FileChooserDialog("Save Config File As...", self
, gtk
.FILE_CHOOSER_ACTION_SAVE
, (gtk
.STOCK_CANCEL
, gtk
.RESPONSE_CANCEL
, gtk
.STOCK_SAVE
, gtk
.RESPONSE_OK
))
2666 chooser
.set_default_response(gtk
.RESPONSE_OK
)
2668 if self
.curDir
!= None:
2669 chooser
.set_current_folder(self
.curDir
)
2671 chooserFilter
= gtk
.FileFilter()
2672 chooserFilter
.set_name("All files")
2673 chooserFilter
.add_pattern("*")
2674 chooser
.add_filter(chooserFilter
)
2677 response
= chooser
.run()
2679 if response
== gtk
.RESPONSE_OK
:
2680 self
.filename
= chooser
.get_filename()
2682 if os
.path
.exists(self
.filename
):
2683 overwrite
= confirmDialog(self
, "This file already exists. Overwrite this file?")
2685 if overwrite
== gtk
.RESPONSE_YES
:
2690 self
.filename
= None
2698 self
.filename
= None
2702 def saveAsDef(self
, widget
=None, event
=None):
2703 """Saves the config as the default tint2 config."""
2704 if confirmDialog(self
, "Overwrite current tint2 default config?") == gtk
.RESPONSE_YES
:
2705 self
.filename
= os
.path
.expandvars("${HOME}") + "/.config/tint2/tint2rc"
2706 self
.curDir
= os
.path
.expandvars("${HOME}") + "/.config/tint2"
2708 # If, for whatever reason, tint2 has no default config - create one.
2709 if not os
.path
.isfile(self
.filename
):
2710 f
= open(self
.filename
, "w")
2711 f
.write("# tint2rc")
2714 self
.generateConfig()
2719 def savePrompt(self
):
2720 """Prompt the user to save before creating a new file."""
2721 if confirmDialog(self
, "Save current config?") == gtk
.RESPONSE_YES
:
2724 def switchPage(self
, notebook
, page
, page_num
):
2725 """Handles notebook page switch events."""
2727 # If user selects the 'View Config' tab, update the textarea within this tab.
2728 if notebook
.get_tab_label_text(notebook
.get_nth_page(page_num
)) == "View Config":
2729 self
.generateConfig()
2731 def updateComboBoxes(self
, i
, action
="add"):
2732 """Updates the contents of a combo box when a background style has been added/removed."""
2733 cbs
= [self
.batteryBg
, self
.clockBg
, self
.taskbarBg
, self
.taskbarActiveBg
, self
.trayBg
, self
.taskActiveBg
, self
.taskBg
, self
.panelBg
, self
.tooltipBg
, self
.taskUrgentBg
, self
.taskIconifiedBg
]
2737 cb
.append_text(str(i
+1))
2740 if cb
.get_active() == i
: # If background is selected, set to a different value
2745 def updateStatusBar(self
, message
="", change
=False):
2746 """Updates the message on the statusbar. A message can be provided,
2747 and if change is set to True (i.e. something has been modified) then
2748 an appropriate symbol [*] is shown beside filename."""
2749 contextID
= self
.statusBar
.get_context_id("")
2751 self
.statusBar
.pop(contextID
)
2754 message
= "%s %s" % (self
.filename
or "New Config File", "[*]" if change
else "")
2756 self
.statusBar
.push(contextID
, message
)
2758 def writeConf(self
):
2759 """Writes the tintwizard configuration file."""
2760 confStr
= "#Start\n[defaults]\n"
2762 for key
in self
.defaults
:
2763 confStr
+= "%s = %s\n" % (key
, str(self
.defaults
[key
]))
2767 pathName
= os
.path
.dirname(sys
.argv
[0])
2770 f
= open("tintwizard.conf", "w")
2772 f
= open(pathName
+"/tintwizard.conf", "w")
2778 def writeFile(self
):
2779 """Writes the contents of the config text buffer to file."""
2781 f
= open(self
.filename
, "w")
2783 f
.write(self
.configBuf
.get_text(self
.configBuf
.get_start_iter(), self
.configBuf
.get_end_iter()))
2789 self
.curDir
= os
.path
.dirname(self
.filename
)
2791 self
.updateStatusBar()
2793 errorDialog(self
, "Could not save file")
2795 # General use functions
2796 def confirmDialog(parent
, message
):
2797 """Creates a confirmation dialog and returns the response."""
2798 dialog
= gtk
.MessageDialog(parent
, gtk
.DIALOG_MODAL
, gtk
.MESSAGE_QUESTION
, gtk
.BUTTONS_YES_NO
, message
)
2800 response
= dialog
.run()
2804 def errorDialog(parent
=None, message
="An error has occured!"):
2805 """Creates an error dialog."""
2806 dialog
= gtk
.MessageDialog(parent
, gtk
.DIALOG_MODAL
, gtk
.MESSAGE_ERROR
, gtk
.BUTTONS_OK
, message
)
2812 """Convert integer n in range [0, 15] to hex."""
2814 return ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"][n
]
2818 def rgbToHex(r
, g
, b
):
2819 """Constructs a 6 digit hex representation of color (r, g, b)."""
2820 r2
= trunc(r
/ 65535.0 * 255)
2821 g2
= trunc(g
/ 65535.0 * 255)
2822 b2
= trunc(b
/ 65535.0 * 255)
2824 return "#%s%s%s%s%s%s" % (numToHex(r2
/ 16), numToHex(r2
% 16), numToHex(g2
/ 16), numToHex(g2
% 16), numToHex(b2
/ 16), numToHex(b2
% 16))
2827 """Truncate a floating point number, rounding up or down appropriately."""
2828 c
= math
.fabs(math
.ceil(n
) - n
)
2829 f
= math
.fabs(math
.floor(n
) - n
)
2832 return int(math
.ceil(n
))
2834 return int(math
.floor(n
))
2836 # Direct execution of application
2837 if __name__
== "__main__":
2838 if len(sys
.argv
) > 1 and sys
.argv
[1] == "-version":
2842 tw
= TintWizardGUI()