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: 6th 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"
95 BATTERY_ACTION
= 'notify-send "battery low"'
96 BATTERY_PADDING_X
= "0"
97 BATTERY_PADDING_Y
= "0"
99 class TintWizardPrefGUI(gtk
.Window
):
100 """The dialog window which lets the user change the default preferences."""
101 def __init__(self
, tw
):
102 """Create and shows the window."""
105 # Create top-level window
106 gtk
.Window
.__init
__(self
, gtk
.WINDOW_TOPLEVEL
)
108 self
.set_title("Preferences")
109 self
.connect("delete_event", self
.quit
)
111 self
.layout
= gtk
.Table(2, 2, False)
113 self
.table
= gtk
.Table(5, 2, False)
114 self
.table
.set_row_spacings(5)
115 self
.table
.set_col_spacings(5)
117 temp
= gtk
.Label("Default Font")
118 temp
.set_alignment(0, 0.5)
119 self
.table
.attach(temp
, 0, 1, 0, 1)
120 self
.font
= gtk
.FontButton(self
.tw
.defaults
["font"])
121 self
.font
.set_alignment(0, 0.5)
122 self
.table
.attach(self
.font
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
124 temp
= gtk
.Label("Default Background Color")
125 temp
.set_alignment(0, 0.5)
126 self
.table
.attach(temp
, 0, 1, 1, 2)
127 self
.bgColor
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.tw
.defaults
["bgColor"]))
128 self
.bgColor
.set_alignment(0, 0.5)
129 self
.table
.attach(self
.bgColor
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
131 temp
= gtk
.Label("Default Foreground Color")
132 temp
.set_alignment(0, 0.5)
133 self
.table
.attach(temp
, 0, 1, 2, 3)
134 self
.fgColor
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.tw
.defaults
["fgColor"]))
135 self
.fgColor
.set_alignment(0, 0.5)
136 self
.table
.attach(self
.fgColor
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
138 temp
= gtk
.Label("Default Border Color")
139 temp
.set_alignment(0, 0.5)
140 self
.table
.attach(temp
, 0, 1, 3, 4)
141 self
.borderColor
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.tw
.defaults
["borderColor"]))
142 self
.borderColor
.set_alignment(0, 0.5)
143 self
.table
.attach(self
.borderColor
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
145 temp
= gtk
.Label("Number of Background Styles")
146 temp
.set_alignment(0, 0.5)
147 self
.table
.attach(temp
, 0, 1, 4, 5)
148 self
.bgCount
= gtk
.Entry(6)
149 self
.bgCount
.set_width_chars(8)
150 self
.bgCount
.set_text(str(self
.tw
.defaults
["bgCount"]))
151 self
.table
.attach(self
.bgCount
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
153 temp
= gtk
.Label("Default directory")
154 temp
.set_alignment(0, 0.5)
155 self
.table
.attach(temp
, 0, 1, 5, 6)
156 self
.dir = gtk
.Button(self
.tw
.defaults
["dir"])
157 self
.dir.connect("clicked", self
.chooseFolder
)
158 self
.table
.attach(self
.dir, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
160 self
.layout
.attach(self
.table
, 0, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
, xpadding
=20, ypadding
=5)
162 temp
= gtk
.Button("Save", gtk
.STOCK_SAVE
)
163 temp
.set_name("save")
164 temp
.connect("clicked", self
.save
)
165 self
.layout
.attach(temp
, 0, 1, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
, ypadding
=20)
166 temp
= gtk
.Button("Cancel", gtk
.STOCK_CANCEL
)
167 temp
.set_name("cancel")
168 temp
.connect("clicked", self
.quit
)
169 self
.layout
.attach(temp
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
, ypadding
=20)
171 self
.add(self
.layout
)
175 def chooseFolder(self
, widget
=None, direction
=None):
176 """Called every time the folder button is clicked. Shows a file chooser."""
177 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
))
178 chooser
.set_default_response(gtk
.RESPONSE_OK
)
180 if self
.tw
.curDir
!= None:
181 chooser
.set_current_folder(self
.tw
.curDir
)
185 response
= chooser
.run()
187 if response
== gtk
.RESPONSE_OK
:
188 self
.dir.set_label(chooser
.get_filename())
195 def quit(self
, widget
=None, event
=None):
196 """Destroys the window."""
199 def save(self
, action
=None):
200 """Called when the Save button is clicked."""
201 if confirmDialog(self
, "Overwrite configuration file?") == gtk
.RESPONSE_YES
:
202 self
.tw
.defaults
["font"] = self
.font
.get_font_name()
203 self
.tw
.defaults
["bgColor"] = rgbToHex(self
.bgColor
.get_color().red
, self
.bgColor
.get_color().green
, self
.bgColor
.get_color().blue
)
204 self
.tw
.defaults
["fgColor"] = rgbToHex(self
.fgColor
.get_color().red
, self
.fgColor
.get_color().green
, self
.fgColor
.get_color().blue
)
205 self
.tw
.defaults
["borderColor"] = rgbToHex(self
.borderColor
.get_color().red
, self
.borderColor
.get_color().green
, self
.borderColor
.get_color().blue
)
208 self
.tw
.defaults
["bgCount"] = int(self
.bgCount
.get_text())
210 errorDialog(self
, "Invalid value for background count")
213 self
.tw
.defaults
["dir"] = self
.dir.get_label()
214 self
.curDir
= self
.tw
.defaults
["dir"]
220 class TintWizardGUI(gtk
.Window
):
221 """The main window for the application."""
223 """Create and show the window."""
228 if len(sys
.argv
) > 1:
229 self
.filename
= sys
.argv
[1]
230 self
.oneConfigFile
= True
232 self
.oneConfigFile
= False
234 # Read conf file and set default values
237 if self
.defaults
["bgColor"] in [None, "None"]:
238 self
.defaults
["bgColor"] = "#000000"
240 if self
.defaults
["fgColor"] in [None, "None"]:
241 self
.defaults
["fgColor"] = "#ffffff"
243 if self
.defaults
["borderColor"] in [None, "None"]:
244 self
.defaults
["borderColor"] = "#ffffff"
246 if self
.defaults
["dir"] in [None, "None"]:
247 if os
.path
.exists(os
.path
.expandvars("${HOME}") + "/.config/tint2"):
248 self
.curDir
= os
.path
.expandvars("${HOME}") + "/.config/tint2"
252 self
.curDir
= os
.path
.expandvars(self
.defaults
["dir"])
254 if not os
.path
.exists(os
.path
.expandvars(self
.curDir
)):
255 if os
.path
.exists(os
.path
.expandvars("${HOME}") + "/.config/tint2"):
256 self
.curDir
= os
.path
.expandvars("${HOME}") + "/.config/tint2"
261 self
.defaults
["bgCount"] = int(self
.defaults
["bgCount"])
263 self
.defaults
["bgCount"] = 2
265 # Get the full location of the tint2 binary
266 which
= os
.popen('which tint2')
268 self
.tint2Bin
= which
.readline().strip()
272 if len(self
.tint2Bin
) == 0:
273 errorDialog(self
, "tint2 could not be found. Are you sure it is installed?")
276 # Create top-level window
277 gtk
.Window
.__init
__(self
, gtk
.WINDOW_TOPLEVEL
)
279 self
.set_title("tintwizard")
281 self
.connect("delete_event", self
.quit
)
283 # self.table is our main layout manager
284 self
.table
= gtk
.Table(4, 1, False)
286 # Create menus and toolbar items
289 <menubar name="MenuBar">
291 <menuitem action="New" />
292 <menuitem action="Open" />
294 <menuitem action="Save" />
295 <menuitem action="Save As..." />
297 <menuitem action="Quit" />
299 <menu action="Tint2">
300 <menuitem action="OpenDefault" />
301 <menuitem action="SaveDefault" />
303 <menuitem action="Apply" />
305 <menu action="Tools">
306 <menuitem action="FontChange" />
308 <menuitem action="Defaults" />
310 <menu action="HelpMenu">
311 <menuitem action="Help" />
312 <menuitem action="Report Bug" />
314 <menuitem action="About" />
317 <toolbar name="ToolBar">
318 <toolitem action="New" />
319 <toolitem action="Open" />
320 <toolitem action="Save" />
322 <toolitem action="Apply" />
328 self
.uiManager
= gtk
.UIManager()
330 accelGroup
= self
.uiManager
.get_accel_group()
331 self
.add_accel_group(accelGroup
)
333 self
.ag
= gtk
.ActionGroup("File")
334 self
.ag
.add_actions([("File", None, "_File"),
335 ("New",gtk
.STOCK_NEW
, "_New", None, "Create a new config", self
.new
),
336 ("Open", gtk
.STOCK_OPEN
, "_Open", None, "Open an existing config", self
.openFile
),
337 ("Save", gtk
.STOCK_SAVE
, "_Save", None, "Save the current config", self
.save
),
338 ("Save As...", gtk
.STOCK_SAVE_AS
, "Save As", None, "Save the current config as...", self
.saveAs
),
339 ("SaveDefault", None, "Save As tint2 Default", None, "Save the current config as the tint2 default", self
.saveAsDef
),
340 ("OpenDefault", None, "Open tint2 Default", None, "Open the current tint2 default config", self
.openDef
),
341 ("Apply", gtk
.STOCK_APPLY
, "Apply Config", None, "Apply the current config to tint2", self
.apply),
342 ("Quit", gtk
.STOCK_QUIT
, "_Quit", None, "Quit the program", self
.quit
),
343 ("Tools", None, "_Tools"),
344 ("Tint2", None, "Tint_2"),
345 ("HelpMenu", None, "_Help"),
346 ("FontChange",gtk
.STOCK_SELECT_FONT
, "Change All Fonts", None, "Change all fonts at once.", self
.changeAllFonts
),
347 ("Defaults",gtk
.STOCK_PREFERENCES
, "Change Defaults", None, "Change tintwizard defaults.", self
.changeDefaults
),
348 ("Help",gtk
.STOCK_HELP
, "_Help", None, "Get help with tintwizard", self
.help),
349 ("Report Bug",None, "Report Bug", None, "Report a problem with tintwizard", self
.reportBug
),
350 ("About",gtk
.STOCK_ABOUT
, "_About Tint Wizard", None, "Find out more about Tint Wizard", self
.about
)])
353 self
.uiManager
.insert_action_group(self
.ag
, -1)
354 self
.uiManager
.add_ui_from_string(ui
)
356 if not self
.oneConfigFile
:
357 # Attach menubar and toolbar to main window
358 self
.table
.attach(self
.uiManager
.get_widget("/MenuBar"), 0, 4, 0, 1)
359 self
.table
.attach(self
.uiManager
.get_widget("/ToolBar"), 0, 4, 1, 2)
362 self
.notebook
= gtk
.Notebook()
363 self
.notebook
.set_tab_pos(gtk
.POS_TOP
)
365 # Create notebook pages
367 self
.tableBgs
= gtk
.Table(rows
=1, columns
=1, homogeneous
=False)
368 self
.tableBgs
.set_row_spacings(5)
369 self
.tableBgs
.set_col_spacings(5)
371 self
.bgNotebook
= gtk
.Notebook()
372 self
.bgNotebook
.set_scrollable(True)
374 self
.tableBgs
.attach(self
.bgNotebook
, 0, 2, 0, 1)
378 # Add buttons for adding/deleting background styles
379 temp
= gtk
.Button("New Background", gtk
.STOCK_NEW
)
380 temp
.set_name("addBg")
381 temp
.connect("clicked", self
.addBgClick
)
382 self
.tableBgs
.attach(temp
, 0, 1, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
383 temp
= gtk
.Button("Delete Background", gtk
.STOCK_DELETE
)
384 temp
.set_name("delBg")
385 temp
.connect("clicked", self
.delBgClick
)
386 self
.tableBgs
.attach(temp
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
389 self
.tablePanelDisplay
= gtk
.Table(rows
=6, columns
=3, homogeneous
=False)
390 self
.tablePanelDisplay
.set_row_spacings(5)
391 self
.tablePanelDisplay
.set_col_spacings(5)
393 temp
= gtk
.Label("Position")
394 temp
.set_alignment(0, 0.5)
395 self
.tablePanelDisplay
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
396 self
.panelPosY
= gtk
.combo_box_new_text()
397 self
.panelPosY
.append_text("bottom")
398 self
.panelPosY
.append_text("top")
399 self
.panelPosY
.append_text("center")
400 self
.panelPosY
.set_active(0)
401 self
.panelPosY
.connect("changed", self
.changeOccurred
)
402 self
.tablePanelDisplay
.attach(self
.panelPosY
, 2, 3, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
403 self
.panelPosX
= gtk
.combo_box_new_text()
404 self
.panelPosX
.append_text("left")
405 self
.panelPosX
.append_text("right")
406 self
.panelPosX
.append_text("center")
407 self
.panelPosX
.set_active(0)
408 self
.panelPosX
.connect("changed", self
.changeOccurred
)
409 self
.tablePanelDisplay
.attach(self
.panelPosX
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
411 temp
= gtk
.Label("Panel Orientation")
412 temp
.set_alignment(0, 0.5)
413 self
.tablePanelDisplay
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
414 self
.panelOrientation
= gtk
.combo_box_new_text()
415 self
.panelOrientation
.append_text("horizontal")
416 self
.panelOrientation
.append_text("vertical")
417 self
.panelOrientation
.set_active(0)
418 self
.panelOrientation
.connect("changed", self
.changeOccurred
)
419 self
.tablePanelDisplay
.attach(self
.panelOrientation
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
421 self
.panelSizeLabel
= gtk
.Label("Size (width, height)")
422 self
.panelSizeLabel
.set_alignment(0, 0.5)
423 self
.tablePanelDisplay
.attach(self
.panelSizeLabel
, 0, 1, 2, 3, xpadding
=10)
424 self
.panelSizeX
= gtk
.Entry(6)
425 self
.panelSizeX
.set_width_chars(8)
426 self
.panelSizeX
.set_text(PANEL_SIZE_X
)
427 self
.panelSizeX
.connect("changed", self
.changeOccurred
)
428 self
.tablePanelDisplay
.attach(self
.panelSizeX
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
429 self
.panelSizeY
= gtk
.Entry(6)
430 self
.panelSizeY
.set_width_chars(8)
431 self
.panelSizeY
.set_text(PANEL_SIZE_Y
)
432 self
.panelSizeY
.connect("changed", self
.changeOccurred
)
433 self
.tablePanelDisplay
.attach(self
.panelSizeY
, 2, 3, 2, 3, xoptions
=gtk
.EXPAND
)
435 temp
= gtk
.Label("Margin (x, y)")
436 temp
.set_alignment(0, 0.5)
437 self
.tablePanelDisplay
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
438 self
.panelMarginX
= gtk
.Entry(6)
439 self
.panelMarginX
.set_width_chars(8)
440 self
.panelMarginX
.set_text(PANEL_MARGIN_X
)
441 self
.panelMarginX
.connect("changed", self
.changeOccurred
)
442 self
.tablePanelDisplay
.attach(self
.panelMarginX
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
443 self
.panelMarginY
= gtk
.Entry(6)
444 self
.panelMarginY
.set_width_chars(8)
445 self
.panelMarginY
.set_text(PANEL_MARGIN_Y
)
446 self
.panelMarginY
.connect("changed", self
.changeOccurred
)
447 self
.tablePanelDisplay
.attach(self
.panelMarginY
, 2, 3, 3, 4, xoptions
=gtk
.EXPAND
)
449 temp
= gtk
.Label("Padding (x, y)")
450 temp
.set_alignment(0, 0.5)
451 self
.tablePanelDisplay
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
452 self
.panelPadX
= gtk
.Entry(6)
453 self
.panelPadX
.set_width_chars(8)
454 self
.panelPadX
.set_text(PANEL_PADDING_Y
)
455 self
.panelPadX
.connect("changed", self
.changeOccurred
)
456 self
.tablePanelDisplay
.attach(self
.panelPadX
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
457 self
.panelPadY
= gtk
.Entry(6)
458 self
.panelPadY
.set_width_chars(8)
459 self
.panelPadY
.set_text(PANEL_PADDING_Y
)
460 self
.panelPadY
.connect("changed", self
.changeOccurred
)
461 self
.tablePanelDisplay
.attach(self
.panelPadY
, 2, 3, 4, 5, xoptions
=gtk
.EXPAND
)
463 temp
= gtk
.Label("Panel Background ID")
464 temp
.set_alignment(0, 0.5)
465 self
.tablePanelDisplay
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
466 self
.panelBg
= gtk
.combo_box_new_text()
467 self
.panelBg
.append_text("0 (fully transparent)")
468 for i
in range(len(self
.bgs
)):
469 self
.panelBg
.append_text(str(i
+1))
470 self
.panelBg
.set_active(0)
471 self
.panelBg
.connect("changed", self
.changeOccurred
)
472 self
.tablePanelDisplay
.attach(self
.panelBg
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
475 self
.tablePanelSettings
= gtk
.Table(rows
=5, columns
=3, homogeneous
=False)
476 self
.tablePanelSettings
.set_row_spacings(5)
477 self
.tablePanelSettings
.set_col_spacings(5)
479 temp
= gtk
.Label("Window Manager Menu")
480 temp
.set_alignment(0, 0.5)
481 self
.tablePanelSettings
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
482 self
.panelMenu
= gtk
.CheckButton()
483 self
.panelMenu
.set_active(False)
484 self
.panelMenu
.connect("toggled", self
.changeOccurred
)
485 self
.tablePanelSettings
.attach(self
.panelMenu
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
487 temp
= gtk
.Label("Place In Window Manager Dock")
488 temp
.set_alignment(0, 0.5)
489 self
.tablePanelSettings
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
490 self
.panelDock
= gtk
.CheckButton()
491 self
.panelDock
.set_active(False)
492 self
.panelDock
.connect("toggled", self
.changeOccurred
)
493 self
.tablePanelSettings
.attach(self
.panelDock
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
495 temp
= gtk
.Label("Panel Layer")
496 temp
.set_alignment(0, 0.5)
497 self
.tablePanelSettings
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
498 self
.panelLayer
= gtk
.combo_box_new_text()
499 self
.panelLayer
.append_text("bottom")
500 self
.panelLayer
.append_text("top")
501 self
.panelLayer
.append_text("normal")
502 self
.panelLayer
.set_active(0)
503 self
.panelLayer
.connect("changed", self
.changeOccurred
)
504 self
.tablePanelSettings
.attach(self
.panelLayer
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
506 temp
= gtk
.Label("Strut Policy")
507 temp
.set_alignment(0, 0.5)
508 self
.tablePanelSettings
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
509 self
.panelAutohideStrut
= gtk
.combo_box_new_text()
510 self
.panelAutohideStrut
.append_text("none")
511 self
.panelAutohideStrut
.append_text("minimum")
512 self
.panelAutohideStrut
.append_text("follow_size")
513 self
.panelAutohideStrut
.set_active(0)
514 self
.panelAutohideStrut
.connect("changed", self
.changeOccurred
)
515 self
.tablePanelSettings
.attach(self
.panelAutohideStrut
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
517 temp
= gtk
.Label("Panel Monitor (all, 1, 2...)")
518 temp
.set_alignment(0, 0.5)
519 self
.tablePanelSettings
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
520 self
.panelMonitor
= gtk
.Entry(6)
521 self
.panelMonitor
.set_width_chars(8)
522 self
.panelMonitor
.set_text(PANEL_MONITOR
)
523 self
.panelMonitor
.connect("changed", self
.changeOccurred
)
524 self
.tablePanelSettings
.attach(self
.panelMonitor
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
527 self
.tablePanelAutohide
= gtk
.Table(rows
=4, columns
=3, homogeneous
=False)
528 self
.tablePanelAutohide
.set_row_spacings(5)
529 self
.tablePanelAutohide
.set_col_spacings(5)
531 temp
= gtk
.Label("Autohide Panel")
532 temp
.set_alignment(0, 0.5)
533 self
.tablePanelAutohide
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
534 self
.panelAutohide
= gtk
.CheckButton()
535 self
.panelAutohide
.set_active(False)
536 self
.panelAutohide
.connect("toggled", self
.changeOccurred
)
537 self
.tablePanelAutohide
.attach(self
.panelAutohide
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
539 temp
= gtk
.Label("Autohide Show Timeout (seconds)")
540 temp
.set_alignment(0, 0.5)
541 self
.tablePanelAutohide
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
542 self
.panelAutohideShow
= gtk
.Entry(6)
543 self
.panelAutohideShow
.set_width_chars(8)
544 self
.panelAutohideShow
.set_text(PANEL_AUTOHIDE_SHOW
)
545 self
.panelAutohideShow
.connect("changed", self
.changeOccurred
)
546 self
.tablePanelAutohide
.attach(self
.panelAutohideShow
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
548 temp
= gtk
.Label("Autohide Hide Timeout (seconds)")
549 temp
.set_alignment(0, 0.5)
550 self
.tablePanelAutohide
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
551 self
.panelAutohideHide
= gtk
.Entry(6)
552 self
.panelAutohideHide
.set_width_chars(8)
553 self
.panelAutohideHide
.set_text(PANEL_AUTOHIDE_HIDE
)
554 self
.panelAutohideHide
.connect("changed", self
.changeOccurred
)
555 self
.tablePanelAutohide
.attach(self
.panelAutohideHide
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
557 temp
= gtk
.Label("Autohide Hidden Height")
558 temp
.set_alignment(0, 0.5)
559 self
.tablePanelAutohide
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
560 self
.panelAutohideHeight
= gtk
.Entry(6)
561 self
.panelAutohideHeight
.set_width_chars(8)
562 self
.panelAutohideHeight
.set_text(PANEL_AUTOHIDE_HEIGHT
)
563 self
.panelAutohideHeight
.connect("changed", self
.changeOccurred
)
564 self
.tablePanelAutohide
.attach(self
.panelAutohideHeight
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
569 self
.tableTaskbar
= gtk
.Table(rows
=5, columns
=3, homogeneous
=False)
570 self
.tableTaskbar
.set_row_spacings(5)
571 self
.tableTaskbar
.set_col_spacings(5)
573 temp
= gtk
.Label("Taskbar Mode")
574 temp
.set_alignment(0, 0.5)
575 self
.tableTaskbar
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
576 self
.taskbarMode
= gtk
.combo_box_new_text()
577 self
.taskbarMode
.append_text("single_desktop")
578 self
.taskbarMode
.append_text("multi_desktop")
579 self
.taskbarMode
.set_active(0)
580 self
.taskbarMode
.connect("changed", self
.changeOccurred
)
581 self
.tableTaskbar
.attach(self
.taskbarMode
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
583 temp
= gtk
.Label("Padding (x, y)")
584 temp
.set_alignment(0, 0.5)
585 self
.tableTaskbar
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
586 self
.taskbarPadX
= gtk
.Entry(6)
587 self
.taskbarPadX
.set_width_chars(8)
588 self
.taskbarPadX
.set_text(TASKBAR_PADDING_X
)
589 self
.taskbarPadX
.connect("changed", self
.changeOccurred
)
590 self
.tableTaskbar
.attach(self
.taskbarPadX
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
591 self
.taskbarPadY
= gtk
.Entry(6)
592 self
.taskbarPadY
.set_width_chars(8)
593 self
.taskbarPadY
.set_text(TASKBAR_PADDING_Y
)
594 self
.taskbarPadY
.connect("changed", self
.changeOccurred
)
595 self
.tableTaskbar
.attach(self
.taskbarPadY
, 2, 3, 1, 2, xoptions
=gtk
.EXPAND
)
597 temp
= gtk
.Label("Horizontal Spacing")
598 temp
.set_alignment(0, 0.5)
599 self
.tableTaskbar
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
600 self
.panelSpacing
= gtk
.Entry(6)
601 self
.panelSpacing
.set_width_chars(8)
602 self
.panelSpacing
.set_text(TASKBAR_SPACING
)
603 self
.panelSpacing
.connect("changed", self
.changeOccurred
)
604 self
.tableTaskbar
.attach(self
.panelSpacing
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
606 temp
= gtk
.Label("Taskbar Background ID")
607 temp
.set_alignment(0, 0.5)
608 self
.tableTaskbar
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
609 self
.taskbarBg
= gtk
.combo_box_new_text()
610 self
.taskbarBg
.append_text("0 (fully transparent)")
611 for i
in range(len(self
.bgs
)):
612 self
.taskbarBg
.append_text(str(i
+1))
613 self
.taskbarBg
.set_active(0)
614 self
.taskbarBg
.connect("changed", self
.changeOccurred
)
615 self
.tableTaskbar
.attach(self
.taskbarBg
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
617 temp
= gtk
.Label("Active Taskbar Background ID")
618 temp
.set_alignment(0, 0.5)
619 self
.tableTaskbar
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
620 self
.taskbarActiveBg
= gtk
.combo_box_new_text()
621 self
.taskbarActiveBg
.append_text("0 (fully transparent)")
622 for i
in range(len(self
.bgs
)):
623 self
.taskbarActiveBg
.append_text(str(i
+1))
624 self
.taskbarActiveBg
.set_active(0)
625 self
.taskbarActiveBg
.connect("changed", self
.changeOccurred
)
626 self
.tableTaskbar
.attach(self
.taskbarActiveBg
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
627 self
.taskbarActiveBgEnable
= gtk
.CheckButton("Enable")
628 self
.taskbarActiveBgEnable
.set_active(False)
629 self
.taskbarActiveBgEnable
.connect("toggled", self
.changeOccurred
)
630 self
.tableTaskbar
.attach(self
.taskbarActiveBgEnable
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
)
633 self
.tableTask
= gtk
.Table(rows
=12, columns
=3, homogeneous
=False)
634 self
.tableTask
.set_row_spacings(5)
635 self
.tableTask
.set_col_spacings(5)
637 temp
= gtk
.Label("Number of 'Blinks' on Urgent Event")
638 temp
.set_alignment(0, 0.5)
639 self
.tableTask
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
640 self
.taskBlinks
= gtk
.Entry(6)
641 self
.taskBlinks
.set_width_chars(8)
642 self
.taskBlinks
.set_text(TASK_BLINKS
)
643 self
.taskBlinks
.connect("changed", self
.changeOccurred
)
644 self
.tableTask
.attach(self
.taskBlinks
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
646 temp
= gtk
.Label("Show Icons")
647 temp
.set_alignment(0, 0.5)
648 self
.tableTask
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
649 self
.taskIconCheckButton
= gtk
.CheckButton()
650 self
.taskIconCheckButton
.set_active(True)
651 self
.taskIconCheckButton
.connect("toggled", self
.changeOccurred
)
652 self
.tableTask
.attach(self
.taskIconCheckButton
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
654 temp
= gtk
.Label("Show Text")
655 temp
.set_alignment(0, 0.5)
656 self
.tableTask
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
657 self
.taskTextCheckButton
= gtk
.CheckButton()
658 self
.taskTextCheckButton
.set_active(True)
659 self
.taskTextCheckButton
.connect("toggled", self
.changeOccurred
)
660 self
.tableTask
.attach(self
.taskTextCheckButton
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
662 temp
= gtk
.Label("Centre Text")
663 temp
.set_alignment(0, 0.5)
664 self
.tableTask
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
665 self
.taskCentreCheckButton
= gtk
.CheckButton()
666 self
.taskCentreCheckButton
.set_active(True)
667 self
.taskCentreCheckButton
.connect("toggled", self
.changeOccurred
)
668 self
.tableTask
.attach(self
.taskCentreCheckButton
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
670 temp
= gtk
.Label("Font")
671 temp
.set_alignment(0, 0.5)
672 self
.tableTask
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
673 self
.fontButton
= gtk
.FontButton()
675 if self
.defaults
["font"] in [None, "None"]: # If there was no font specified in the config file
676 self
.defaults
["font"] = self
.fontButton
.get_font_name() # Use the gtk default
678 self
.fontButton
.set_font_name(self
.defaults
["font"])
679 self
.fontButton
.connect("font-set", self
.changeOccurred
)
680 self
.tableTask
.attach(self
.fontButton
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
682 temp
= gtk
.Label("Show Font Shadow")
683 temp
.set_alignment(0, 0.5)
684 self
.tableTask
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
685 self
.fontShadowCheckButton
= gtk
.CheckButton()
686 self
.fontShadowCheckButton
.set_active(False)
687 self
.fontShadowCheckButton
.connect("toggled", self
.changeOccurred
)
688 self
.tableTask
.attach(self
.fontShadowCheckButton
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
690 temp
= gtk
.Label("Maximum Size (x, y)")
691 temp
.set_alignment(0, 0.5)
692 self
.tableTask
.attach(temp
, 0, 1, 6, 7, xpadding
=10)
693 self
.taskMaxSizeX
= gtk
.Entry(6)
694 self
.taskMaxSizeX
.set_width_chars(8)
695 self
.taskMaxSizeX
.set_text(TASK_MAXIMUM_SIZE_X
)
696 self
.taskMaxSizeX
.connect("changed", self
.changeOccurred
)
697 self
.tableTask
.attach(self
.taskMaxSizeX
, 1, 2, 6, 7, xoptions
=gtk
.EXPAND
)
698 self
.taskMaxSizeY
= gtk
.Entry(6)
699 self
.taskMaxSizeY
.set_width_chars(8)
700 self
.taskMaxSizeY
.set_text(TASK_MAXIMUM_SIZE_Y
)
701 self
.taskMaxSizeY
.connect("changed", self
.changeOccurred
)
702 self
.tableTask
.attach(self
.taskMaxSizeY
, 2, 3, 6, 7, xoptions
=gtk
.EXPAND
)
704 temp
= gtk
.Label("Padding (x, y)")
705 temp
.set_alignment(0, 0.5)
706 self
.tableTask
.attach(temp
, 0, 1, 7, 8, xpadding
=10)
707 self
.taskPadX
= gtk
.Entry(6)
708 self
.taskPadX
.set_width_chars(8)
709 self
.taskPadX
.set_text(TASK_PADDING_X
)
710 self
.taskPadX
.connect("changed", self
.changeOccurred
)
711 self
.tableTask
.attach(self
.taskPadX
, 1, 2, 7, 8, xoptions
=gtk
.EXPAND
)
712 self
.taskPadY
= gtk
.Entry(6)
713 self
.taskPadY
.set_width_chars(8)
714 self
.taskPadY
.set_text(TASK_PADDING_Y
)
715 self
.taskPadY
.connect("changed", self
.changeOccurred
)
716 self
.tableTask
.attach(self
.taskPadY
, 2, 3, 7, 8, xoptions
=gtk
.EXPAND
)
718 temp
= gtk
.Label("Horizontal Spacing")
719 temp
.set_alignment(0, 0.5)
720 self
.tableTask
.attach(temp
, 0, 1, 8, 9, xpadding
=10)
721 self
.taskbarSpacing
= gtk
.Entry(6)
722 self
.taskbarSpacing
.set_width_chars(8)
723 self
.taskbarSpacing
.set_text(TASK_SPACING
)
724 self
.taskbarSpacing
.connect("changed", self
.changeOccurred
)
725 self
.tableTask
.attach(self
.taskbarSpacing
, 1, 2, 8, 9, xoptions
=gtk
.EXPAND
)
728 self
.tableTaskDefault
= gtk
.Table(rows
=6, columns
=3, homogeneous
=False)
729 self
.tableTaskDefault
.set_row_spacings(5)
730 self
.tableTaskDefault
.set_col_spacings(5)
732 temp
= gtk
.Label("Normal Task Background ID")
733 temp
.set_alignment(0, 0.5)
734 self
.tableTaskDefault
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
735 self
.taskBg
= gtk
.combo_box_new_text()
736 self
.taskBg
.append_text("0 (fully transparent)")
737 for i
in range(len(self
.bgs
)):
738 self
.taskBg
.append_text(str(i
+1))
739 self
.taskBg
.set_active(0)
740 self
.taskBg
.connect("changed", self
.changeOccurred
)
741 self
.tableTaskDefault
.attach(self
.taskBg
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
743 temp
= gtk
.Label("Note: Default values of 0 for each of these settings leaves icons unchanged!")
744 temp
.set_alignment(0, 0.5)
745 self
.tableTaskDefault
.attach(temp
, 0, 3, 1, 2, xpadding
=10)
747 temp
= gtk
.Label("Normal Icon Alpha (0 to 100)")
748 temp
.set_alignment(0, 0.5)
749 self
.tableTaskDefault
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
750 self
.iconHue
= gtk
.Entry(6)
751 self
.iconHue
.set_width_chars(8)
752 self
.iconHue
.set_text(ICON_ALPHA
)
753 self
.iconHue
.connect("changed", self
.changeOccurred
)
754 self
.tableTaskDefault
.attach(self
.iconHue
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
756 temp
= gtk
.Label("Normal Icon Saturation (-100 to 100)")
757 temp
.set_alignment(0, 0.5)
758 self
.tableTaskDefault
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
759 self
.iconSat
= gtk
.Entry(6)
760 self
.iconSat
.set_width_chars(8)
761 self
.iconSat
.set_text(ICON_SAT
)
762 self
.iconSat
.connect("changed", self
.changeOccurred
)
763 self
.tableTaskDefault
.attach(self
.iconSat
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
765 temp
= gtk
.Label("Normal Icon Brightness (-100 to 100)")
766 temp
.set_alignment(0, 0.5)
767 self
.tableTaskDefault
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
768 self
.iconBri
= gtk
.Entry(6)
769 self
.iconBri
.set_width_chars(8)
770 self
.iconBri
.set_text(ICON_BRI
)
771 self
.iconBri
.connect("changed", self
.changeOccurred
)
772 self
.tableTaskDefault
.attach(self
.iconBri
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
774 temp
= gtk
.Label("Normal Font Color")
775 temp
.set_alignment(0, 0.5)
776 self
.tableTaskDefault
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
777 self
.fontCol
= gtk
.Entry(7)
778 self
.fontCol
.set_width_chars(9)
779 self
.fontCol
.set_name("fontCol")
780 self
.fontCol
.connect("activate", self
.colorTyped
)
781 self
.tableTaskDefault
.attach(self
.fontCol
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
782 self
.fontColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
783 self
.fontColButton
.set_use_alpha(True)
784 self
.fontColButton
.set_name("fontCol")
785 self
.fontColButton
.connect("color-set", self
.colorChange
)
786 self
.tableTaskDefault
.attach(self
.fontColButton
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
787 self
.fontCol
.set_text(self
.defaults
["fgColor"])
788 # Add this AFTER we set color to avoid "changed" event
789 self
.fontCol
.connect("changed", self
.changeOccurred
)
792 self
.tableTaskActive
= gtk
.Table(rows
=6, columns
=3, homogeneous
=False)
793 self
.tableTaskActive
.set_row_spacings(5)
794 self
.tableTaskActive
.set_col_spacings(5)
796 temp
= gtk
.Label("Active Task Background ID")
797 temp
.set_alignment(0, 0.5)
798 self
.tableTaskActive
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
799 self
.taskActiveBg
= gtk
.combo_box_new_text()
800 self
.taskActiveBg
.append_text("0 (fully transparent)")
801 for i
in range(len(self
.bgs
)):
802 self
.taskActiveBg
.append_text(str(i
+1))
803 self
.taskActiveBg
.set_active(0)
804 self
.taskActiveBg
.connect("changed", self
.changeOccurred
)
805 self
.tableTaskActive
.attach(self
.taskActiveBg
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
807 temp
= gtk
.Label("Note: Default values of 0 for each of these settings leaves icons unchanged!")
808 temp
.set_alignment(0, 0.5)
809 self
.tableTaskActive
.attach(temp
, 0, 3, 1, 2, xpadding
=10)
811 temp
= gtk
.Label("Active Icon Alpha (0 to 100)")
812 temp
.set_alignment(0, 0.5)
813 self
.tableTaskActive
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
814 self
.activeIconHue
= gtk
.Entry(6)
815 self
.activeIconHue
.set_width_chars(8)
816 self
.activeIconHue
.set_text(ACTIVE_ICON_ALPHA
)
817 self
.activeIconHue
.connect("changed", self
.changeOccurred
)
818 self
.tableTaskActive
.attach(self
.activeIconHue
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
820 temp
= gtk
.Label("Active Icon Saturation (-100 to 100)")
821 temp
.set_alignment(0, 0.5)
822 self
.tableTaskActive
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
823 self
.activeIconSat
= gtk
.Entry(6)
824 self
.activeIconSat
.set_width_chars(8)
825 self
.activeIconSat
.set_text(ACTIVE_ICON_SAT
)
826 self
.activeIconSat
.connect("changed", self
.changeOccurred
)
827 self
.tableTaskActive
.attach(self
.activeIconSat
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
829 temp
= gtk
.Label("Active Icon Brightness (-100 to 100)")
830 temp
.set_alignment(0, 0.5)
831 self
.tableTaskActive
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
832 self
.activeIconBri
= gtk
.Entry(6)
833 self
.activeIconBri
.set_width_chars(8)
834 self
.activeIconBri
.set_text(ACTIVE_ICON_BRI
)
835 self
.activeIconBri
.connect("changed", self
.changeOccurred
)
836 self
.tableTaskActive
.attach(self
.activeIconBri
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
838 temp
= gtk
.Label("Active Font Color")
839 temp
.set_alignment(0, 0.5)
840 self
.tableTaskActive
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
841 self
.fontActiveCol
= gtk
.Entry(7)
842 self
.fontActiveCol
.set_width_chars(9)
843 self
.fontActiveCol
.set_name("fontActiveCol")
844 self
.fontActiveCol
.connect("activate", self
.colorTyped
)
845 self
.tableTaskActive
.attach(self
.fontActiveCol
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
846 self
.fontActiveColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
847 self
.fontActiveColButton
.set_use_alpha(True)
848 self
.fontActiveColButton
.set_name("fontActiveCol")
849 self
.fontActiveColButton
.connect("color-set", self
.colorChange
)
850 self
.tableTaskActive
.attach(self
.fontActiveColButton
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
851 self
.fontActiveCol
.set_text(self
.defaults
["fgColor"])
852 # Add this AFTER we set color to avoid "changed" event
853 self
.fontActiveCol
.connect("changed", self
.changeOccurred
)
856 self
.tableTaskUrgent
= gtk
.Table(rows
=6, columns
=3, homogeneous
=False)
857 self
.tableTaskUrgent
.set_row_spacings(5)
858 self
.tableTaskUrgent
.set_col_spacings(5)
860 temp
= gtk
.Label("Urgent Task Background ID")
861 temp
.set_alignment(0, 0.5)
862 self
.tableTaskUrgent
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
863 self
.taskUrgentBg
= gtk
.combo_box_new_text()
864 self
.taskUrgentBg
.append_text("0 (fully transparent)")
865 for i
in range(len(self
.bgs
)):
866 self
.taskUrgentBg
.append_text(str(i
+1))
867 self
.taskUrgentBg
.set_active(0)
868 self
.taskUrgentBg
.connect("changed", self
.changeOccurred
)
869 self
.tableTaskUrgent
.attach(self
.taskUrgentBg
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
871 temp
= gtk
.Label("Note: Default values of 0 for each of these settings leaves icons unchanged!")
872 temp
.set_alignment(0, 0.5)
873 self
.tableTaskUrgent
.attach(temp
, 0, 3, 1, 2, xpadding
=10)
875 temp
= gtk
.Label("Urgent Icon Alpha (0 to 100)")
876 temp
.set_alignment(0, 0.5)
877 self
.tableTaskUrgent
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
878 self
.urgentIconHue
= gtk
.Entry(6)
879 self
.urgentIconHue
.set_width_chars(8)
880 self
.urgentIconHue
.set_text(URGENT_ICON_ALPHA
)
881 self
.urgentIconHue
.connect("changed", self
.changeOccurred
)
882 self
.tableTaskUrgent
.attach(self
.urgentIconHue
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
884 temp
= gtk
.Label("Urgent Icon Saturation (-100 to 100)")
885 temp
.set_alignment(0, 0.5)
886 self
.tableTaskUrgent
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
887 self
.urgentIconSat
= gtk
.Entry(6)
888 self
.urgentIconSat
.set_width_chars(8)
889 self
.urgentIconSat
.set_text(URGENT_ICON_SAT
)
890 self
.urgentIconSat
.connect("changed", self
.changeOccurred
)
891 self
.tableTaskUrgent
.attach(self
.urgentIconSat
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
893 temp
= gtk
.Label("Urgent Icon Brightness (-100 to 100)")
894 temp
.set_alignment(0, 0.5)
895 self
.tableTaskUrgent
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
896 self
.urgentIconBri
= gtk
.Entry(6)
897 self
.urgentIconBri
.set_width_chars(8)
898 self
.urgentIconBri
.set_text(URGENT_ICON_BRI
)
899 self
.urgentIconBri
.connect("changed", self
.changeOccurred
)
900 self
.tableTaskUrgent
.attach(self
.urgentIconBri
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
902 temp
= gtk
.Label("Urgent Font Color")
903 temp
.set_alignment(0, 0.5)
904 self
.tableTaskUrgent
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
905 self
.fontUrgentCol
= gtk
.Entry(7)
906 self
.fontUrgentCol
.set_width_chars(9)
907 self
.fontUrgentCol
.set_name("fontUrgentCol")
908 self
.fontUrgentCol
.connect("activate", self
.colorTyped
)
909 self
.tableTaskUrgent
.attach(self
.fontUrgentCol
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
910 self
.fontUrgentColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
911 self
.fontUrgentColButton
.set_use_alpha(True)
912 self
.fontUrgentColButton
.set_name("fontUrgentCol")
913 self
.fontUrgentColButton
.connect("color-set", self
.colorChange
)
914 self
.tableTaskUrgent
.attach(self
.fontUrgentColButton
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
915 self
.fontUrgentCol
.set_text(self
.defaults
["fgColor"])
916 # Add this AFTER we set color to avoid "changed" event
917 self
.fontUrgentCol
.connect("changed", self
.changeOccurred
)
919 # Iconified Appearance
920 self
.tableTaskIconified
= gtk
.Table(rows
=6, columns
=3, homogeneous
=False)
921 self
.tableTaskIconified
.set_row_spacings(5)
922 self
.tableTaskIconified
.set_col_spacings(5)
924 temp
= gtk
.Label("Iconified Task Background ID")
925 temp
.set_alignment(0, 0.5)
926 self
.tableTaskIconified
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
927 self
.taskIconifiedBg
= gtk
.combo_box_new_text()
928 self
.taskIconifiedBg
.append_text("0 (fully transparent)")
929 for i
in range(len(self
.bgs
)):
930 self
.taskIconifiedBg
.append_text(str(i
+1))
931 self
.taskIconifiedBg
.set_active(0)
932 self
.taskIconifiedBg
.connect("changed", self
.changeOccurred
)
933 self
.tableTaskIconified
.attach(self
.taskIconifiedBg
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
935 temp
= gtk
.Label("Note: Default values of 0 for each of these settings leaves icons unchanged!")
936 temp
.set_alignment(0, 0.5)
937 self
.tableTaskIconified
.attach(temp
, 0, 3, 1, 2, xpadding
=10)
939 temp
= gtk
.Label("Iconified Icon Alpha (0 to 100)")
940 temp
.set_alignment(0, 0.5)
941 self
.tableTaskIconified
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
942 self
.iconifiedIconHue
= gtk
.Entry(6)
943 self
.iconifiedIconHue
.set_width_chars(8)
944 self
.iconifiedIconHue
.set_text(ICONIFIED_ICON_ALPHA
)
945 self
.iconifiedIconHue
.connect("changed", self
.changeOccurred
)
946 self
.tableTaskIconified
.attach(self
.iconifiedIconHue
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
948 temp
= gtk
.Label("Iconified Icon Saturation (-100 to 100)")
949 temp
.set_alignment(0, 0.5)
950 self
.tableTaskIconified
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
951 self
.iconifiedIconSat
= gtk
.Entry(6)
952 self
.iconifiedIconSat
.set_width_chars(8)
953 self
.iconifiedIconSat
.set_text(ICONIFIED_ICON_SAT
)
954 self
.iconifiedIconSat
.connect("changed", self
.changeOccurred
)
955 self
.tableTaskIconified
.attach(self
.iconifiedIconSat
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
957 temp
= gtk
.Label("Iconified Icon Brightness (-100 to 100)")
958 temp
.set_alignment(0, 0.5)
959 self
.tableTaskIconified
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
960 self
.iconifiedIconBri
= gtk
.Entry(6)
961 self
.iconifiedIconBri
.set_width_chars(8)
962 self
.iconifiedIconBri
.set_text(ICONIFIED_ICON_BRI
)
963 self
.iconifiedIconBri
.connect("changed", self
.changeOccurred
)
964 self
.tableTaskIconified
.attach(self
.iconifiedIconBri
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
966 temp
= gtk
.Label("Iconified Font Color")
967 temp
.set_alignment(0, 0.5)
968 self
.tableTaskIconified
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
969 self
.fontIconifiedCol
= gtk
.Entry(7)
970 self
.fontIconifiedCol
.set_width_chars(9)
971 self
.fontIconifiedCol
.set_name("fontIconifiedCol")
972 self
.fontIconifiedCol
.connect("activate", self
.colorTyped
)
973 self
.tableTaskIconified
.attach(self
.fontIconifiedCol
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
974 self
.fontIconifiedColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
975 self
.fontIconifiedColButton
.set_use_alpha(True)
976 self
.fontIconifiedColButton
.set_name("fontIconifiedCol")
977 self
.fontIconifiedColButton
.connect("color-set", self
.colorChange
)
978 self
.tableTaskIconified
.attach(self
.fontIconifiedColButton
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
979 self
.fontIconifiedCol
.set_text(self
.defaults
["fgColor"])
980 # Add this AFTER we set color to avoid "changed" event
981 self
.fontIconifiedCol
.connect("changed", self
.changeOccurred
)
983 # System Tray Options
984 self
.tableTray
= gtk
.Table(rows
=9, columns
=3, homogeneous
=False)
985 self
.tableTray
.set_row_spacings(5)
986 self
.tableTray
.set_col_spacings(5)
988 temp
= gtk
.Label("Show System Tray")
989 temp
.set_alignment(0, 0.5)
990 self
.tableTray
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
991 self
.trayShow
= gtk
.CheckButton()
992 self
.trayShow
.set_active(True)
993 self
.trayShow
.connect("toggled", self
.changeOccurred
)
994 self
.tableTray
.attach(self
.trayShow
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
996 temp
= gtk
.Label("Padding (x, y)")
997 temp
.set_alignment(0, 0.5)
998 self
.tableTray
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
999 self
.trayPadX
= gtk
.Entry(6)
1000 self
.trayPadX
.set_width_chars(8)
1001 self
.trayPadX
.set_text(TRAY_PADDING_X
)
1002 self
.trayPadX
.connect("changed", self
.changeOccurred
)
1003 self
.tableTray
.attach(self
.trayPadX
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
1004 self
.trayPadY
= gtk
.Entry(6)
1005 self
.trayPadY
.set_width_chars(8)
1006 self
.trayPadY
.set_text(TRAY_PADDING_Y
)
1007 self
.trayPadY
.connect("changed", self
.changeOccurred
)
1008 self
.tableTray
.attach(self
.trayPadY
, 2, 3, 1, 2, xoptions
=gtk
.EXPAND
)
1010 temp
= gtk
.Label("Horizontal Spacing")
1011 temp
.set_alignment(0, 0.5)
1012 self
.tableTray
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
1013 self
.traySpacing
= gtk
.Entry(6)
1014 self
.traySpacing
.set_width_chars(8)
1015 self
.traySpacing
.set_text(TRAY_SPACING
)
1016 self
.traySpacing
.connect("changed", self
.changeOccurred
)
1017 self
.tableTray
.attach(self
.traySpacing
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
1019 temp
= gtk
.Label("System Tray Background ID")
1020 temp
.set_alignment(0, 0.5)
1021 self
.tableTray
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
1022 self
.trayBg
= gtk
.combo_box_new_text()
1023 self
.trayBg
.append_text("0 (fully transparent)")
1024 for i
in range(len(self
.bgs
)):
1025 self
.trayBg
.append_text(str(i
+1))
1026 self
.trayBg
.set_active(0)
1027 self
.trayBg
.connect("changed", self
.changeOccurred
)
1028 self
.tableTray
.attach(self
.trayBg
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1030 temp
= gtk
.Label("Icon Ordering")
1031 temp
.set_alignment(0, 0.5)
1032 self
.tableTray
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
1033 self
.trayOrder
= gtk
.combo_box_new_text()
1034 self
.trayOrder
.append_text("ascending")
1035 self
.trayOrder
.append_text("descending")
1036 self
.trayOrder
.append_text("left2right")
1037 self
.trayOrder
.append_text("right2left")
1038 self
.trayOrder
.set_active(0)
1039 self
.trayOrder
.connect("changed", self
.changeOccurred
)
1040 self
.tableTray
.attach(self
.trayOrder
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1042 temp
= gtk
.Label("Maximum Icon Size (0 for automatic size)")
1043 temp
.set_alignment(0, 0.5)
1044 self
.tableTray
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
1045 self
.trayMaxIconSize
= gtk
.Entry(6)
1046 self
.trayMaxIconSize
.set_width_chars(8)
1047 self
.trayMaxIconSize
.set_text(TRAY_MAX_ICON_SIZE
)
1048 self
.trayMaxIconSize
.connect("changed", self
.changeOccurred
)
1049 self
.tableTray
.attach(self
.trayMaxIconSize
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
1051 temp
= gtk
.Label("System Tray Icon Alpha (0 to 100)")
1052 temp
.set_alignment(0, 0.5)
1053 self
.tableTray
.attach(temp
, 0, 1, 6, 7, xpadding
=10)
1054 self
.trayIconHue
= gtk
.Entry(6)
1055 self
.trayIconHue
.set_width_chars(8)
1056 self
.trayIconHue
.set_text(TRAY_ICON_ALPHA
)
1057 self
.trayIconHue
.connect("changed", self
.changeOccurred
)
1058 self
.tableTray
.attach(self
.trayIconHue
, 1, 2, 6, 7, xoptions
=gtk
.EXPAND
)
1060 temp
= gtk
.Label("System Tray Icon Saturation (-100 to 100)")
1061 temp
.set_alignment(0, 0.5)
1062 self
.tableTray
.attach(temp
, 0, 1, 7, 8, xpadding
=10)
1063 self
.trayIconSat
= gtk
.Entry(6)
1064 self
.trayIconSat
.set_width_chars(8)
1065 self
.trayIconSat
.set_text(TRAY_ICON_SAT
)
1066 self
.trayIconSat
.connect("changed", self
.changeOccurred
)
1067 self
.tableTray
.attach(self
.trayIconSat
, 1, 2, 7, 8, xoptions
=gtk
.EXPAND
)
1069 temp
= gtk
.Label("System Tray Icon Brightness (-100 to 100)")
1070 temp
.set_alignment(0, 0.5)
1071 self
.tableTray
.attach(temp
, 0, 1, 8, 9, xpadding
=10)
1072 self
.trayIconBri
= gtk
.Entry(6)
1073 self
.trayIconBri
.set_width_chars(8)
1074 self
.trayIconBri
.set_text(TRAY_ICON_BRI
)
1075 self
.trayIconBri
.connect("changed", self
.changeOccurred
)
1076 self
.tableTray
.attach(self
.trayIconBri
, 1, 2, 8, 9, xoptions
=gtk
.EXPAND
)
1079 self
.tableClockDisplays
= gtk
.Table(rows
=3, columns
=3, homogeneous
=False)
1080 self
.tableClockDisplays
.set_row_spacings(5)
1081 self
.tableClockDisplays
.set_col_spacings(5)
1083 temp
= gtk
.Label("Show Clock")
1084 temp
.set_alignment(0, 0.5)
1085 self
.tableClockDisplays
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
1086 self
.clockCheckButton
= gtk
.CheckButton()
1087 self
.clockCheckButton
.set_active(True)
1088 self
.clockCheckButton
.connect("toggled", self
.changeOccurred
)
1089 self
.tableClockDisplays
.attach(self
.clockCheckButton
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
1091 temp
= gtk
.Label("Time 1 Format")
1092 temp
.set_alignment(0, 0.5)
1093 self
.tableClockDisplays
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
1094 self
.clock1Format
= gtk
.Entry(50)
1095 self
.clock1Format
.set_width_chars(20)
1096 self
.clock1Format
.set_text(CLOCK_FMT_1
)
1097 self
.clock1Format
.connect("changed", self
.changeOccurred
)
1098 self
.tableClockDisplays
.attach(self
.clock1Format
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
1099 self
.clock1CheckButton
= gtk
.CheckButton("Show")
1100 self
.clock1CheckButton
.set_active(True)
1101 self
.clock1CheckButton
.connect("toggled", self
.changeOccurred
)
1102 self
.tableClockDisplays
.attach(self
.clock1CheckButton
, 2, 3, 1, 2, xoptions
=gtk
.EXPAND
)
1104 temp
= gtk
.Label("Time 1 Font")
1105 temp
.set_alignment(0, 0.5)
1106 self
.tableClockDisplays
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
1107 self
.clock1FontButton
= gtk
.FontButton()
1108 self
.clock1FontButton
.set_font_name(self
.defaults
["font"])
1109 self
.clock1FontButton
.connect("font-set", self
.changeOccurred
)
1110 self
.tableClockDisplays
.attach(self
.clock1FontButton
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1112 temp
= gtk
.Label("Time 2 Format")
1113 temp
.set_alignment(0, 0.5)
1114 self
.tableClockDisplays
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
1115 self
.clock2Format
= gtk
.Entry(50)
1116 self
.clock2Format
.set_width_chars(20)
1117 self
.clock2Format
.set_text(CLOCK_FMT_2
)
1118 self
.clock2Format
.connect("changed", self
.changeOccurred
)
1119 self
.tableClockDisplays
.attach(self
.clock2Format
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
1120 self
.clock2CheckButton
= gtk
.CheckButton("Show")
1121 self
.clock2CheckButton
.set_active(True)
1122 self
.clock2CheckButton
.connect("toggled", self
.changeOccurred
)
1123 self
.tableClockDisplays
.attach(self
.clock2CheckButton
, 2, 3, 3, 4, xoptions
=gtk
.EXPAND
)
1125 temp
= gtk
.Label("Time 2 Font")
1126 temp
.set_alignment(0, 0.5)
1127 self
.tableClockDisplays
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
1128 self
.clock2FontButton
= gtk
.FontButton()
1129 self
.clock2FontButton
.set_font_name(self
.defaults
["font"])
1130 self
.clock2FontButton
.connect("font-set", self
.changeOccurred
)
1131 self
.tableClockDisplays
.attach(self
.clock2FontButton
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1133 temp
= gtk
.Label("Tooltip Format")
1134 temp
.set_alignment(0, 0.5)
1135 self
.tableClockDisplays
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
1136 self
.clockTooltipFormat
= gtk
.Entry(50)
1137 self
.clockTooltipFormat
.set_width_chars(20)
1138 self
.clockTooltipFormat
.set_text(CLOCK_TOOLTIP
)
1139 self
.clockTooltipFormat
.connect("changed", self
.changeOccurred
)
1140 self
.tableClockDisplays
.attach(self
.clockTooltipFormat
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
1141 self
.clockTooltipCheckButton
= gtk
.CheckButton("Show")
1142 self
.clockTooltipCheckButton
.set_active(True)
1143 self
.clockTooltipCheckButton
.connect("toggled", self
.changeOccurred
)
1144 self
.tableClockDisplays
.attach(self
.clockTooltipCheckButton
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
)
1146 self
.clockArea
= gtk
.ScrolledWindow()
1147 self
.clockBuf
= gtk
.TextBuffer()
1148 self
.clockTextView
= gtk
.TextView(self
.clockBuf
)
1149 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")
1150 self
.clockTextView
.set_editable(False)
1151 self
.clockArea
.add_with_viewport(self
.clockTextView
)
1152 self
.tableClockDisplays
.attach(self
.clockArea
, 0, 3, 6, 7, xpadding
=10)
1154 self
.tableClockSettings
= gtk
.Table(rows
=3, columns
=3, homogeneous
=False)
1155 self
.tableClockSettings
.set_row_spacings(5)
1156 self
.tableClockSettings
.set_col_spacings(5)
1158 temp
= gtk
.Label("Clock Font Color")
1159 temp
.set_alignment(0, 0.5)
1160 self
.tableClockSettings
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
1161 self
.clockFontCol
= gtk
.Entry(7)
1162 self
.clockFontCol
.set_width_chars(9)
1163 self
.clockFontCol
.set_name("clockFontCol")
1164 self
.clockFontCol
.connect("activate", self
.colorTyped
)
1165 self
.tableClockSettings
.attach(self
.clockFontCol
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
1166 self
.clockFontColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
1167 self
.clockFontColButton
.set_use_alpha(True)
1168 self
.clockFontColButton
.set_name("clockFontCol")
1169 self
.clockFontColButton
.connect("color-set", self
.colorChange
)
1170 self
.tableClockSettings
.attach(self
.clockFontColButton
, 2, 3, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1171 self
.clockFontCol
.set_text(self
.defaults
["fgColor"])
1172 # Add this AFTER we set color to avoid "changed" event
1173 self
.clockFontCol
.connect("changed", self
.changeOccurred
)
1175 temp
= gtk
.Label("Padding (x, y)")
1176 temp
.set_alignment(0, 0.5)
1177 self
.tableClockSettings
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
1178 self
.clockPadX
= gtk
.Entry(6)
1179 self
.clockPadX
.set_width_chars(8)
1180 self
.clockPadX
.set_text(CLOCK_PADDING_X
)
1181 self
.clockPadX
.connect("changed", self
.changeOccurred
)
1182 self
.tableClockSettings
.attach(self
.clockPadX
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
1183 self
.clockPadY
= gtk
.Entry(6)
1184 self
.clockPadY
.set_width_chars(8)
1185 self
.clockPadY
.set_text(CLOCK_PADDING_Y
)
1186 self
.clockPadY
.connect("changed", self
.changeOccurred
)
1187 self
.tableClockSettings
.attach(self
.clockPadY
, 2, 3, 1, 2, xoptions
=gtk
.EXPAND
)
1189 temp
= gtk
.Label("Clock Background ID")
1190 temp
.set_alignment(0, 0.5)
1191 self
.tableClockSettings
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
1192 self
.clockBg
= gtk
.combo_box_new_text()
1193 self
.clockBg
.append_text("0 (fully transparent)")
1194 for i
in range(len(self
.bgs
)):
1195 self
.clockBg
.append_text(str(i
+1))
1196 self
.clockBg
.set_active(0)
1197 self
.clockBg
.connect("changed", self
.changeOccurred
)
1198 self
.tableClockSettings
.attach(self
.clockBg
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1200 temp
= gtk
.Label("Left Click Command")
1201 temp
.set_alignment(0, 0.5)
1202 self
.tableClockSettings
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
1203 self
.clockLClick
= gtk
.Entry(50)
1204 self
.clockLClick
.set_width_chars(20)
1205 self
.clockLClick
.set_text(CLOCK_LCLICK
)
1206 self
.clockLClick
.connect("changed", self
.changeOccurred
)
1207 self
.tableClockSettings
.attach(self
.clockLClick
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
1209 temp
= gtk
.Label("Right Click Command")
1210 temp
.set_alignment(0, 0.5)
1211 self
.tableClockSettings
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
1212 self
.clockRClick
= gtk
.Entry(50)
1213 self
.clockRClick
.set_width_chars(20)
1214 self
.clockRClick
.set_text(CLOCK_RCLICK
)
1215 self
.clockRClick
.connect("changed", self
.changeOccurred
)
1216 self
.tableClockSettings
.attach(self
.clockRClick
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
)
1218 temp
= gtk
.Label("Time 1 Timezone")
1219 temp
.set_alignment(0, 0.5)
1220 self
.tableClockSettings
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
1221 self
.clockTime1Timezone
= gtk
.Entry(50)
1222 self
.clockTime1Timezone
.set_width_chars(20)
1223 self
.clockTime1Timezone
.set_text(CLOCK_TIME1_TIMEZONE
)
1224 self
.clockTime1Timezone
.connect("changed", self
.changeOccurred
)
1225 self
.tableClockSettings
.attach(self
.clockTime1Timezone
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
1226 self
.clockTimezone1CheckButton
= gtk
.CheckButton("Enable")
1227 self
.clockTimezone1CheckButton
.set_active(False)
1228 self
.clockTimezone1CheckButton
.connect("toggled", self
.changeOccurred
)
1229 self
.tableClockSettings
.attach(self
.clockTimezone1CheckButton
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
)
1231 temp
= gtk
.Label("Time 2 Timezone")
1232 temp
.set_alignment(0, 0.5)
1233 self
.tableClockSettings
.attach(temp
, 0, 1, 6, 7, xpadding
=10)
1234 self
.clockTime2Timezone
= gtk
.Entry(50)
1235 self
.clockTime2Timezone
.set_width_chars(20)
1236 self
.clockTime2Timezone
.set_text(CLOCK_TIME2_TIMEZONE
)
1237 self
.clockTime2Timezone
.connect("changed", self
.changeOccurred
)
1238 self
.tableClockSettings
.attach(self
.clockTime2Timezone
, 1, 2, 6, 7, xoptions
=gtk
.EXPAND
)
1239 self
.clockTimezone2CheckButton
= gtk
.CheckButton("Enable")
1240 self
.clockTimezone2CheckButton
.set_active(False)
1241 self
.clockTimezone2CheckButton
.connect("toggled", self
.changeOccurred
)
1242 self
.tableClockSettings
.attach(self
.clockTimezone2CheckButton
, 2, 3, 6, 7, xoptions
=gtk
.EXPAND
)
1244 temp
= gtk
.Label("Tooltip Timezone")
1245 temp
.set_alignment(0, 0.5)
1246 self
.tableClockSettings
.attach(temp
, 0, 1, 7, 8, xpadding
=10)
1247 self
.clockTooltipTimezone
= gtk
.Entry(50)
1248 self
.clockTooltipTimezone
.set_width_chars(20)
1249 self
.clockTooltipTimezone
.set_text(CLOCK_TOOLTIP_TIMEZONE
)
1250 self
.clockTooltipTimezone
.connect("changed", self
.changeOccurred
)
1251 self
.tableClockSettings
.attach(self
.clockTooltipTimezone
, 1, 2, 7, 8, xoptions
=gtk
.EXPAND
)
1252 self
.clockTimezoneTooltipCheckButton
= gtk
.CheckButton("Enable")
1253 self
.clockTimezoneTooltipCheckButton
.set_active(False)
1254 self
.clockTimezoneTooltipCheckButton
.connect("toggled", self
.changeOccurred
)
1255 self
.tableClockSettings
.attach(self
.clockTimezoneTooltipCheckButton
, 2, 3, 7, 8, xoptions
=gtk
.EXPAND
)
1258 self
.tableTooltip
= gtk
.Table(rows
=7, columns
=3, homogeneous
=False)
1259 self
.tableTooltip
.set_row_spacings(5)
1260 self
.tableTooltip
.set_col_spacings(5)
1262 temp
= gtk
.Label("Show Tooltips")
1263 temp
.set_alignment(0, 0.5)
1264 self
.tableTooltip
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
1265 self
.tooltipShow
= gtk
.CheckButton()
1266 self
.tooltipShow
.set_active(False)
1267 self
.tooltipShow
.connect("toggled", self
.changeOccurred
)
1268 self
.tableTooltip
.attach(self
.tooltipShow
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
1270 temp
= gtk
.Label("Padding (x, y)")
1271 temp
.set_alignment(0, 0.5)
1272 self
.tableTooltip
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
1273 self
.tooltipPadX
= gtk
.Entry(6)
1274 self
.tooltipPadX
.set_width_chars(8)
1275 self
.tooltipPadX
.set_text(TOOLTIP_PADDING_X
)
1276 self
.tooltipPadX
.connect("changed", self
.changeOccurred
)
1277 self
.tableTooltip
.attach(self
.tooltipPadX
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
1278 self
.tooltipPadY
= gtk
.Entry(6)
1279 self
.tooltipPadY
.set_width_chars(8)
1280 self
.tooltipPadY
.set_text(TOOLTIP_PADDING_Y
)
1281 self
.tooltipPadY
.connect("changed", self
.changeOccurred
)
1282 self
.tableTooltip
.attach(self
.tooltipPadY
, 2, 3, 1, 2, xoptions
=gtk
.EXPAND
)
1284 temp
= gtk
.Label("Tooltip Show Timeout (seconds)")
1285 temp
.set_alignment(0, 0.5)
1286 self
.tableTooltip
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
1287 self
.tooltipShowTime
= gtk
.Entry(6)
1288 self
.tooltipShowTime
.set_width_chars(8)
1289 self
.tooltipShowTime
.set_text(TOOLTIP_SHOW_TIMEOUT
)
1290 self
.tooltipShowTime
.connect("changed", self
.changeOccurred
)
1291 self
.tableTooltip
.attach(self
.tooltipShowTime
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
1293 temp
= gtk
.Label("Tooltip Hide Timeout (seconds)")
1294 temp
.set_alignment(0, 0.5)
1295 self
.tableTooltip
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
1296 self
.tooltipHideTime
= gtk
.Entry(6)
1297 self
.tooltipHideTime
.set_width_chars(8)
1298 self
.tooltipHideTime
.set_text(TOOLTIP_HIDE_TIMEOUT
)
1299 self
.tooltipHideTime
.connect("changed", self
.changeOccurred
)
1300 self
.tableTooltip
.attach(self
.tooltipHideTime
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
1302 temp
= gtk
.Label("Tooltip Background ID")
1303 temp
.set_alignment(0, 0.5)
1304 self
.tableTooltip
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
1305 self
.tooltipBg
= gtk
.combo_box_new_text()
1306 self
.tooltipBg
.append_text("0 (fully transparent)")
1307 for i
in range(len(self
.bgs
)):
1308 self
.tooltipBg
.append_text(str(i
+1))
1309 self
.tooltipBg
.set_active(0)
1310 self
.tooltipBg
.connect("changed", self
.changeOccurred
)
1311 self
.tableTooltip
.attach(self
.tooltipBg
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1313 temp
= gtk
.Label("Tooltip Font")
1314 temp
.set_alignment(0, 0.5)
1315 self
.tableTooltip
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
1316 self
.tooltipFont
= gtk
.FontButton()
1317 self
.tooltipFont
.set_font_name(self
.defaults
["font"])
1318 self
.tooltipFont
.connect("font-set", self
.changeOccurred
)
1319 self
.tableTooltip
.attach(self
.tooltipFont
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1321 temp
= gtk
.Label("Tooltip Font Color")
1322 temp
.set_alignment(0, 0.5)
1323 self
.tableTooltip
.attach(temp
, 0, 1, 6, 7, xpadding
=10)
1324 self
.tooltipFontCol
= gtk
.Entry(7)
1325 self
.tooltipFontCol
.set_width_chars(9)
1326 self
.tooltipFontCol
.set_name("tooltipFontCol")
1327 self
.tooltipFontCol
.connect("activate", self
.colorTyped
)
1328 self
.tableTooltip
.attach(self
.tooltipFontCol
, 1, 2, 6, 7, xoptions
=gtk
.EXPAND
)
1329 self
.tooltipFontColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
1330 self
.tooltipFontColButton
.set_use_alpha(True)
1331 self
.tooltipFontColButton
.set_name("tooltipFontCol")
1332 self
.tooltipFontColButton
.connect("color-set", self
.colorChange
)
1333 self
.tableTooltip
.attach(self
.tooltipFontColButton
, 2, 3, 6, 7, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1334 self
.tooltipFontCol
.set_text(self
.defaults
["fgColor"])
1335 # Add this AFTER we set color to avoid "changed" event
1336 self
.clockFontCol
.connect("changed", self
.changeOccurred
)
1339 self
.tableMouse
= gtk
.Table(rows
=4, columns
=3, homogeneous
=False)
1340 self
.tableMouse
.set_row_spacings(5)
1341 self
.tableMouse
.set_col_spacings(5)
1343 temp
= gtk
.Label("Middle Mouse Click Action")
1344 temp
.set_alignment(0, 0.5)
1345 self
.tableMouse
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
1346 self
.mouseMiddle
= gtk
.combo_box_new_text()
1347 self
.mouseMiddle
.append_text("none")
1348 self
.mouseMiddle
.append_text("close")
1349 self
.mouseMiddle
.append_text("toggle")
1350 self
.mouseMiddle
.append_text("iconify")
1351 self
.mouseMiddle
.append_text("shade")
1352 self
.mouseMiddle
.append_text("toggle_iconify")
1353 self
.mouseMiddle
.append_text("maximize_restore")
1354 self
.mouseMiddle
.append_text("desktop_left")
1355 self
.mouseMiddle
.append_text("desktop_right")
1356 self
.mouseMiddle
.append_text("next_task")
1357 self
.mouseMiddle
.append_text("prev_task")
1358 self
.mouseMiddle
.set_active(0)
1359 self
.mouseMiddle
.connect("changed", self
.changeOccurred
)
1360 self
.tableMouse
.attach(self
.mouseMiddle
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1362 temp
= gtk
.Label("Right Mouse Click Action")
1363 temp
.set_alignment(0, 0.5)
1364 self
.tableMouse
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
1365 self
.mouseRight
= gtk
.combo_box_new_text()
1366 self
.mouseRight
.append_text("none")
1367 self
.mouseRight
.append_text("close")
1368 self
.mouseRight
.append_text("toggle")
1369 self
.mouseRight
.append_text("iconify")
1370 self
.mouseRight
.append_text("shade")
1371 self
.mouseRight
.append_text("toggle_iconify")
1372 self
.mouseRight
.append_text("maximize_restore")
1373 self
.mouseRight
.append_text("desktop_left")
1374 self
.mouseRight
.append_text("desktop_right")
1375 self
.mouseRight
.append_text("next_task")
1376 self
.mouseRight
.append_text("prev_task")
1377 self
.mouseRight
.set_active(0)
1378 self
.mouseRight
.connect("changed", self
.changeOccurred
)
1379 self
.tableMouse
.attach(self
.mouseRight
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1381 temp
= gtk
.Label("Mouse Wheel Scroll Up Action")
1382 temp
.set_alignment(0, 0.5)
1383 self
.tableMouse
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
1384 self
.mouseUp
= gtk
.combo_box_new_text()
1385 self
.mouseUp
.append_text("none")
1386 self
.mouseUp
.append_text("close")
1387 self
.mouseUp
.append_text("toggle")
1388 self
.mouseUp
.append_text("iconify")
1389 self
.mouseUp
.append_text("shade")
1390 self
.mouseUp
.append_text("toggle_iconify")
1391 self
.mouseUp
.append_text("maximize_restore")
1392 self
.mouseUp
.append_text("desktop_left")
1393 self
.mouseUp
.append_text("desktop_right")
1394 self
.mouseUp
.append_text("next_task")
1395 self
.mouseUp
.append_text("prev_task")
1396 self
.mouseUp
.set_active(0)
1397 self
.mouseUp
.connect("changed", self
.changeOccurred
)
1398 self
.tableMouse
.attach(self
.mouseUp
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1400 temp
= gtk
.Label("Mouse Wheel Scroll Down Action")
1401 temp
.set_alignment(0, 0.5)
1402 self
.tableMouse
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
1403 self
.mouseDown
= gtk
.combo_box_new_text()
1404 self
.mouseDown
.append_text("none")
1405 self
.mouseDown
.append_text("close")
1406 self
.mouseDown
.append_text("toggle")
1407 self
.mouseDown
.append_text("iconify")
1408 self
.mouseDown
.append_text("shade")
1409 self
.mouseDown
.append_text("toggle_iconify")
1410 self
.mouseDown
.append_text("maximize_restore")
1411 self
.mouseDown
.append_text("desktop_left")
1412 self
.mouseDown
.append_text("desktop_right")
1413 self
.mouseDown
.append_text("next_task")
1414 self
.mouseDown
.append_text("prev_task")
1415 self
.mouseDown
.set_active(0)
1416 self
.mouseDown
.connect("changed", self
.changeOccurred
)
1417 self
.tableMouse
.attach(self
.mouseDown
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1420 self
.tableBattery
= gtk
.Table(rows
=8, columns
=3, homogeneous
=False)
1421 self
.tableBattery
.set_row_spacings(5)
1422 self
.tableBattery
.set_col_spacings(5)
1424 temp
= gtk
.Label("Show Battery Applet")
1425 temp
.set_alignment(0, 0.5)
1426 self
.tableBattery
.attach(temp
, 0, 1, 0, 1, xpadding
=10)
1427 self
.batteryCheckButton
= gtk
.CheckButton()
1428 self
.batteryCheckButton
.set_active(False)
1429 self
.batteryCheckButton
.connect("toggled", self
.changeOccurred
)
1430 self
.tableBattery
.attach(self
.batteryCheckButton
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
1432 temp
= gtk
.Label("Battery Low Status (%)")
1433 temp
.set_alignment(0, 0.5)
1434 self
.tableBattery
.attach(temp
, 0, 1, 1, 2, xpadding
=10)
1435 self
.batteryLow
= gtk
.Entry(6)
1436 self
.batteryLow
.set_width_chars(8)
1437 self
.batteryLow
.set_text(BATTERY_LOW
)
1438 self
.batteryLow
.connect("changed", self
.changeOccurred
)
1439 self
.tableBattery
.attach(self
.batteryLow
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
1441 temp
= gtk
.Label("Battery Low Action")
1442 temp
.set_alignment(0, 0.5)
1443 self
.tableBattery
.attach(temp
, 0, 1, 2, 3, xpadding
=10)
1444 self
.batteryLowAction
= gtk
.Entry(150)
1445 self
.batteryLowAction
.set_width_chars(32)
1446 self
.batteryLowAction
.set_text(BATTERY_ACTION
)
1447 self
.batteryLowAction
.connect("changed", self
.changeOccurred
)
1448 self
.tableBattery
.attach(self
.batteryLowAction
, 1, 3, 2, 3, xoptions
=gtk
.EXPAND
)
1450 temp
= gtk
.Label("Battery 1 Font")
1451 temp
.set_alignment(0, 0.5)
1452 self
.tableBattery
.attach(temp
, 0, 1, 3, 4, xpadding
=10)
1453 self
.bat1FontButton
= gtk
.FontButton()
1454 self
.bat1FontButton
.set_font_name(self
.defaults
["font"])
1455 self
.bat1FontButton
.connect("font-set", self
.changeOccurred
)
1456 self
.tableBattery
.attach(self
.bat1FontButton
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1458 temp
= gtk
.Label("Battery 2 Font")
1459 temp
.set_alignment(0, 0.5)
1460 self
.tableBattery
.attach(temp
, 0, 1, 4, 5, xpadding
=10)
1461 self
.bat2FontButton
= gtk
.FontButton()
1462 self
.bat2FontButton
.set_font_name(self
.defaults
["font"])
1463 self
.bat2FontButton
.connect("font-set", self
.changeOccurred
)
1464 self
.tableBattery
.attach(self
.bat2FontButton
, 1, 2, 4, 5, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1466 temp
= gtk
.Label("Battery Font Color")
1467 temp
.set_alignment(0, 0.5)
1468 self
.tableBattery
.attach(temp
, 0, 1, 5, 6, xpadding
=10)
1469 self
.batteryFontCol
= gtk
.Entry(7)
1470 self
.batteryFontCol
.set_width_chars(9)
1471 self
.batteryFontCol
.set_name("batteryFontCol")
1472 self
.batteryFontCol
.connect("activate", self
.colorTyped
)
1473 self
.tableBattery
.attach(self
.batteryFontCol
, 1, 2, 5, 6, xoptions
=gtk
.EXPAND
)
1474 self
.batteryFontColButton
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
1475 self
.batteryFontColButton
.set_use_alpha(True)
1476 self
.batteryFontColButton
.set_name("batteryFontCol")
1477 self
.batteryFontColButton
.connect("color-set", self
.colorChange
)
1478 self
.tableBattery
.attach(self
.batteryFontColButton
, 2, 3, 5, 6, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1479 self
.batteryFontCol
.set_text(self
.defaults
["fgColor"])
1480 # Add this AFTER we set color to avoid "changed" event
1481 self
.batteryFontCol
.connect("changed", self
.changeOccurred
)
1483 temp
= gtk
.Label("Padding (x, y)")
1484 temp
.set_alignment(0, 0.5)
1485 self
.tableBattery
.attach(temp
, 0, 1, 6, 7, xpadding
=10)
1486 self
.batteryPadX
= gtk
.Entry(6)
1487 self
.batteryPadX
.set_width_chars(8)
1488 self
.batteryPadX
.set_text(BATTERY_PADDING_X
)
1489 self
.batteryPadX
.connect("changed", self
.changeOccurred
)
1490 self
.tableBattery
.attach(self
.batteryPadX
, 1, 2, 6, 7, xoptions
=gtk
.EXPAND
)
1491 self
.batteryPadY
= gtk
.Entry(6)
1492 self
.batteryPadY
.set_width_chars(8)
1493 self
.batteryPadY
.set_text(BATTERY_PADDING_Y
)
1494 self
.batteryPadY
.connect("changed", self
.changeOccurred
)
1495 self
.tableBattery
.attach(self
.batteryPadY
, 2, 3, 6, 7, xoptions
=gtk
.EXPAND
)
1497 temp
= gtk
.Label("Battery Background ID")
1498 temp
.set_alignment(0, 0.5)
1499 self
.tableBattery
.attach(temp
, 0, 1, 7, 8, xpadding
=10)
1500 self
.batteryBg
= gtk
.combo_box_new_text()
1501 self
.batteryBg
.append_text("0 (fully transparent)")
1502 for i
in range(len(self
.bgs
)):
1503 self
.batteryBg
.append_text(str(i
+1))
1504 self
.batteryBg
.set_active(0)
1505 self
.batteryBg
.connect("changed", self
.changeOccurred
)
1506 self
.tableBattery
.attach(self
.batteryBg
, 1, 2, 7, 8, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1509 self
.configArea
= gtk
.ScrolledWindow()
1510 self
.configBuf
= gtk
.TextBuffer()
1511 self
.configTextView
= gtk
.TextView(self
.configBuf
)
1512 self
.configArea
.add_with_viewport(self
.configTextView
)
1514 # Add backgrounds to notebooks
1515 for i
in range(self
.defaults
["bgCount"]):
1516 self
.addBgClick(None, init
=True)
1518 self
.bgNotebook
.set_current_page(0)
1520 # Create sub-notebooks
1521 self
.panelNotebook
= gtk
.Notebook()
1522 self
.panelNotebook
.set_tab_pos(gtk
.POS_TOP
)
1523 self
.panelNotebook
.set_current_page(0)
1525 self
.panelNotebook
.append_page(self
.tablePanelDisplay
, gtk
.Label("Panel Display"))
1526 self
.panelNotebook
.append_page(self
.tablePanelSettings
, gtk
.Label("Panel Settings"))
1527 self
.panelNotebook
.append_page(self
.tablePanelAutohide
, gtk
.Label("Panel Autohide"))
1529 self
.taskNotebook
= gtk
.Notebook()
1530 self
.taskNotebook
.set_tab_pos(gtk
.POS_TOP
)
1531 self
.taskNotebook
.set_current_page(0)
1533 self
.taskNotebook
.append_page(self
.tableTask
, gtk
.Label("Task Settings"))
1534 self
.taskNotebook
.append_page(self
.tableTaskDefault
, gtk
.Label("Normal Tasks"))
1535 self
.taskNotebook
.append_page(self
.tableTaskActive
, gtk
.Label("Active Tasks"))
1536 self
.taskNotebook
.append_page(self
.tableTaskUrgent
, gtk
.Label("Urgent Tasks"))
1537 self
.taskNotebook
.append_page(self
.tableTaskIconified
, gtk
.Label("Iconified Tasks"))
1539 self
.clockNotebook
= gtk
.Notebook()
1540 self
.clockNotebook
.set_tab_pos(gtk
.POS_TOP
)
1541 self
.clockNotebook
.set_current_page(0)
1543 self
.clockNotebook
.append_page(self
.tableClockDisplays
, gtk
.Label("Clock Display"))
1544 self
.clockNotebook
.append_page(self
.tableClockSettings
, gtk
.Label("Clock Settings"))
1546 # Add pages to notebook
1547 self
.notebook
.append_page(self
.tableBgs
, gtk
.Label("Backgrounds"))
1548 self
.notebook
.append_page(self
.panelNotebook
, gtk
.Label("Panel"))
1549 self
.notebook
.append_page(self
.tableTaskbar
, gtk
.Label("Taskbar"))
1550 self
.notebook
.append_page(self
.taskNotebook
, gtk
.Label("Tasks"))
1551 self
.notebook
.append_page(self
.tableTray
, gtk
.Label("System Tray"))
1552 self
.notebook
.append_page(self
.clockNotebook
, gtk
.Label("Clock"))
1553 self
.notebook
.append_page(self
.tableMouse
, gtk
.Label("Mouse"))
1554 self
.notebook
.append_page(self
.tableTooltip
, gtk
.Label("Tooltips"))
1555 self
.notebook
.append_page(self
.tableBattery
, gtk
.Label("Battery"))
1556 self
.notebook
.append_page(self
.configArea
, gtk
.Label("View Config"))
1558 self
.notebook
.connect("switch-page", self
.switchPage
)
1560 # Add notebook to window and show
1561 self
.table
.attach(self
.notebook
, 0, 4, 2, 3, xpadding
=5, ypadding
=5)
1563 if self
.oneConfigFile
:
1564 # Add button Apply and Close
1565 self
.box1
= gtk
.HBox(False, 20)
1566 self
.table
.attach(self
.box1
, 0, 4, 3, 4, xpadding
=5, ypadding
=5)
1567 temp
= gtk
.Button("Apply", gtk
.STOCK_APPLY
)
1568 temp
.set_name("applyBg")
1569 temp
.connect("clicked", self
.apply)
1570 self
.box1
.pack_start(temp
, True, True, 0)
1571 temp
= gtk
.Button("Close", gtk
.STOCK_CLOSE
)
1572 temp
.set_name("closeBg")
1573 temp
.connect("clicked", self
.quit
)
1574 self
.box1
.pack_start(temp
, True, True, 0)
1576 # Create and add the status bar to the bottom of the main window
1577 self
.statusBar
= gtk
.Statusbar()
1578 self
.statusBar
.set_has_resize_grip(True)
1579 self
.updateStatusBar("New Config File [*]")
1580 self
.table
.attach(self
.statusBar
, 0, 4, 4, 5)
1582 self
.add(self
.table
)
1586 # Create our property dictionary. This holds the widgets which correspond to each property
1588 "panel_monitor": self
.panelMonitor
,
1589 "panel_position": (self
.panelPosY
, self
.panelPosX
, self
.panelOrientation
),
1590 "panel_size": (self
.panelSizeX
, self
.panelSizeY
),
1591 "panel_margin": (self
.panelMarginX
, self
.panelMarginY
),
1592 "panel_padding": (self
.panelPadX
, self
.panelPadY
, self
.panelSpacing
),
1593 "wm_menu": self
.panelMenu
,
1594 "panel_layer": self
.panelLayer
,
1595 "panel_dock": self
.panelDock
,
1596 "panel_background_id": self
.panelBg
,
1597 "autohide": self
.panelAutohide
,
1598 "autohide_show_timeout": self
.panelAutohideShow
,
1599 "autohide_hide_timeout": self
.panelAutohideHide
,
1600 "autohide_height": self
.panelAutohideHeight
,
1601 "strut_policy": self
.panelAutohideStrut
,
1602 "taskbar_mode": self
.taskbarMode
,
1603 "taskbar_padding": (self
.taskbarPadX
, self
.taskbarPadY
, self
.taskbarSpacing
),
1604 "taskbar_background_id": self
.taskbarBg
,
1605 "taskbar_active_background_id": self
.taskbarActiveBg
,
1606 "task_icon": self
.taskIconCheckButton
,
1607 "task_text": self
.taskTextCheckButton
,
1608 "task_centered": self
.taskCentreCheckButton
,
1609 "task_maximum_size": (self
.taskMaxSizeX
, self
.taskMaxSizeY
),
1610 "task_padding": (self
.taskPadX
, self
.taskPadY
),
1611 "task_background_id": self
.taskBg
,
1612 "task_active_background_id": self
.taskActiveBg
,
1613 "task_urgent_background_id": self
.taskUrgentBg
,
1614 "task_iconified_background_id": self
.taskIconifiedBg
,
1615 "task_font": self
.fontButton
,
1616 "task_font_color": (self
.fontCol
, self
.fontColButton
),
1617 "task_active_font_color": (self
.fontActiveCol
, self
.fontActiveColButton
),
1618 "task_urgent_font_color": (self
.fontUrgentCol
, self
.fontUrgentColButton
),
1619 "task_iconified_font_color": (self
.fontIconifiedCol
, self
.fontIconifiedColButton
),
1620 "task_icon_asb": (self
.iconHue
, self
.iconSat
, self
.iconBri
),
1621 "task_active_icon_asb": (self
.activeIconHue
, self
.activeIconSat
, self
.activeIconBri
),
1622 "task_urgent_icon_asb": (self
.urgentIconHue
, self
.urgentIconSat
, self
.urgentIconBri
),
1623 "task_iconified_icon_asb": (self
.iconifiedIconHue
, self
.iconifiedIconSat
, self
.iconifiedIconBri
),
1624 "font_shadow": self
.fontShadowCheckButton
,
1625 "systray": self
.trayShow
,
1626 "systray_padding": (self
.trayPadX
, self
.trayPadY
, self
.traySpacing
),
1627 "systray_background_id": self
.trayBg
,
1628 "systray_sort": self
.trayOrder
,
1629 "systray_icon_size": self
.trayMaxIconSize
,
1630 "systray_icon_asb": (self
.trayIconHue
, self
.trayIconSat
, self
.trayIconBri
),
1631 "time1_format": self
.clock1Format
,
1632 "time2_format": self
.clock2Format
,
1633 "clock_tooltip": self
.clockTooltipFormat
,
1634 "time1_font": self
.clock1FontButton
,
1635 "time2_font": self
.clock2FontButton
,
1636 "clock_font_color": (self
.clockFontCol
, self
.clockFontColButton
),
1637 "clock_padding": (self
.clockPadX
, self
.clockPadY
),
1638 "clock_background_id": self
.clockBg
,
1639 "clock_lclick_command": self
.clockLClick
,
1640 "clock_rclick_command": self
.clockRClick
,
1641 "time1_timezone": self
.clockTime1Timezone
,
1642 "time2_timezone": self
.clockTime2Timezone
,
1643 "clock_tooltip_timezone": self
.clockTooltipTimezone
,
1644 "mouse_middle": self
.mouseMiddle
,
1645 "mouse_right": self
.mouseRight
,
1646 "mouse_scroll_up": self
.mouseUp
,
1647 "mouse_scroll_down": self
.mouseDown
,
1648 "tooltip": self
.tooltipShow
,
1649 "tooltip_padding": (self
.tooltipPadX
, self
.tooltipPadY
),
1650 "tooltip_show_timeout": self
.tooltipShowTime
,
1651 "tooltip_hide_timeout": self
.tooltipHideTime
,
1652 "tooltip_background_id": self
.tooltipBg
,
1653 "tooltip_font": self
.tooltipFont
,
1654 "tooltip_font_color": (self
.tooltipFontCol
, self
.tooltipFontColButton
),
1655 "battery": self
.batteryCheckButton
,
1656 "battery_low_status": self
.batteryLow
,
1657 "battery_low_cmd": self
.batteryLowAction
,
1658 "bat1_font": self
.bat1FontButton
,
1659 "bat2_font": self
.bat2FontButton
,
1660 "battery_font_color": (self
.batteryFontCol
, self
.batteryFontColButton
),
1661 "battery_padding": (self
.batteryPadX
, self
.batteryPadY
),
1662 "battery_background_id": self
.batteryBg
1665 if self
.oneConfigFile
:
1666 self
.readTint2Config()
1668 self
.generateConfig()
1670 def about(self
, action
=None):
1671 """Displays the About dialog."""
1672 about
= gtk
.AboutDialog()
1673 about
.set_program_name(NAME
)
1674 about
.set_version(VERSION
)
1675 about
.set_authors(AUTHORS
)
1676 about
.set_comments(COMMENTS
)
1677 about
.set_website(WEBSITE
)
1678 gtk
.about_dialog_set_url_hook(self
.aboutLinkCallback
)
1682 def aboutLinkCallback(dialog
, link
, data
=None):
1683 """Callback for when a URL is clicked in an About dialog."""
1685 webbrowser
.open(link
)
1687 errorDialog(self
, "Your default web-browser could not be opened.\nPlease visit %s" % link
)
1690 """Adds a new background to the list of backgrounds."""
1691 self
.bgs
+= [gtk
.Table(4, 3, False)]
1693 temp
= gtk
.Label("Corner Rounding (px)")
1694 temp
.set_alignment(0, 0.5)
1695 self
.bgs
[-1].attach(temp
, 0, 1, 0, 1, xpadding
=10)
1697 temp
.set_width_chars(9)
1698 temp
.set_name("rounded")
1699 temp
.set_text(BG_ROUNDING
)
1700 temp
.connect("changed", self
.changeOccurred
)
1701 self
.bgs
[-1].attach(temp
, 1, 2, 0, 1, xoptions
=gtk
.EXPAND
)
1703 temp
= gtk
.Label("Background Color")
1704 temp
.set_alignment(0, 0.5)
1705 self
.bgs
[-1].attach(temp
, 0, 1, 1, 2, xpadding
=10)
1707 temp
.set_width_chars(9)
1708 temp
.set_name("bgColEntry")
1709 temp
.set_text(self
.defaults
["bgColor"])
1710 temp
.connect("changed", self
.changeOccurred
)
1711 temp
.connect("activate", self
.colorTyped
)
1712 self
.bgs
[-1].attach(temp
, 1, 2, 1, 2, xoptions
=gtk
.EXPAND
)
1713 temp
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["bgColor"]))
1714 temp
.set_use_alpha(True)
1715 temp
.set_name("bgCol")
1716 temp
.connect("color-set", self
.colorChange
)
1717 self
.bgs
[-1].attach(temp
, 2, 3, 1, 2, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1719 temp
= gtk
.Label("Border Width (px)")
1720 temp
.set_alignment(0, 0.5)
1721 self
.bgs
[-1].attach(temp
, 0, 1, 2, 3, xpadding
=10)
1723 temp
.set_width_chars(9)
1724 temp
.set_name("border")
1725 temp
.set_text(BG_BORDER
)
1726 temp
.connect("changed", self
.changeOccurred
)
1727 self
.bgs
[-1].attach(temp
, 1, 2, 2, 3, xoptions
=gtk
.EXPAND
)
1729 temp
= gtk
.Label("Border Color")
1730 temp
.set_alignment(0, 0.5)
1731 self
.bgs
[-1].attach(temp
, 0, 1, 3, 4, xpadding
=10)
1733 temp
.set_width_chars(9)
1734 temp
.set_name("borderColEntry")
1735 temp
.connect("activate", self
.colorTyped
)
1736 temp
.set_text(self
.defaults
["borderColor"])
1737 temp
.connect("changed", self
.changeOccurred
)
1738 self
.bgs
[-1].attach(temp
, 1, 2, 3, 4, xoptions
=gtk
.EXPAND
)
1739 temp
= gtk
.ColorButton(gtk
.gdk
.color_parse(self
.defaults
["borderColor"]))
1740 temp
.set_use_alpha(True)
1741 temp
.set_name("borderCol")
1742 temp
.connect("color-set", self
.colorChange
)
1743 self
.bgs
[-1].attach(temp
, 2, 3, 3, 4, xoptions
=gtk
.EXPAND
, yoptions
=gtk
.EXPAND
)
1745 # Note: Only set init to True when initialising background styles.
1746 # This prevents unwanted calls to changeOccurred()
1747 def addBgClick(self
, widget
=None, init
=False):
1748 """Creates a new background and adds a new tab to the notebook."""
1749 n
= self
.bgNotebook
.get_n_pages()
1751 if n
> (self
.defaults
["bgCount"] + 2):
1752 if confirmDialog(self
, "You already have %d background styles. Are you sure you would like another?" % n
) == gtk
.RESPONSE_NO
:
1757 newId
= len(self
.bgs
)
1759 self
.bgNotebook
.append_page(self
.bgs
[newId
-1], gtk
.Label("Background ID %d" % (newId
)))
1761 self
.bgNotebook
.show_all()
1763 self
.updateComboBoxes(n
, "add")
1765 self
.bgNotebook
.set_current_page(n
)
1768 self
.changeOccurred()
1770 def addBgDefs(self
, bgDefs
):
1771 """Add interface elements for a list of background style definitions. bgDefs
1772 should be a list containing dictionaries with the following keys: rounded,
1773 border_width, background_color, border_color"""
1777 for child
in self
.bgs
[-1].get_children():
1778 if child
.get_name() == "rounded":
1779 child
.set_text(d
["rounded"])
1780 elif child
.get_name() == "border":
1781 child
.set_text(d
["border_width"])
1782 elif child
.get_name() == "bgColEntry":
1783 child
.set_text(d
["background_color"].split(" ")[0].strip())
1785 elif child
.get_name() == "borderColEntry":
1786 child
.set_text(d
["border_color"].split(" ")[0].strip())
1788 elif child
.get_name() == "bgCol":
1789 list = d
["background_color"].split(" ")
1791 child
.set_alpha(int(int(list[1].strip()) * 65535 / 100.0))
1793 child
.set_alpha(65535)
1794 elif child
.get_name() == "borderCol":
1795 list = d
["border_color"].split(" ")
1797 child
.set_alpha(int(int(list[1].strip()) * 65535 / 100.0))
1799 child
.set_alpha(65535)
1801 newId
= len(self
.bgs
)
1803 self
.bgNotebook
.append_page(self
.bgs
[newId
-1], gtk
.Label("Background ID %d" % (newId
)))
1805 self
.bgNotebook
.show_all()
1807 self
.updateComboBoxes(newId
-1, "add")
1809 self
.bgNotebook
.set_current_page(newId
)
1811 def apply(self
, widget
, event
=None, confirmChange
=True):
1812 """Applies the current config to tint2."""
1813 # Check if tint2 is running
1814 procs
= os
.popen('pidof "tint2"') # Check list of active processes for tint2
1815 pids
= [] # List of process ids for tint2
1817 for proc
in procs
.readlines():
1818 pids
+= [int(proc
.strip().split(" ")[0])]
1822 if self
.oneConfigFile
:
1823 # Save and copy as default
1825 tmpSrc
= self
.filename
1826 tmpDest
= os
.path
.expandvars("${HOME}") + "/.config/tint2/tint2rc"
1828 shutil
.copyfile(tmpSrc
, tmpDest
)
1829 except shutil
.Error
:
1831 # Ask tint2 to reload config
1833 os
.kill(pid
, signal
.SIGUSR1
)
1835 if confirmDialog(self
, "This will terminate all currently running instances of tint2 before applying config. Continue?") == gtk
.RESPONSE_YES
:
1839 #shutil.copyfile(self.filename, self.filename+".backup") # Create backup
1841 # If it is - kill it
1843 os
.kill(pid
, signal
.SIGTERM
)
1846 os
.spawnv(os
.P_NOWAIT
, self
.tint2Bin
, [self
.tint2Bin
, "-c" + self
.filename
])
1848 if confirmChange
and self
.filename
!= (os
.path
.expandvars("${HOME}") + "/.config/tint2/tint2rc") and confirmDialog(self
, "Use this as default tint2 config?") == gtk
.RESPONSE_YES
:
1850 self
.filename
= os
.path
.expandvars("${HOME}") + "/.config/tint2/tint2rc"
1852 shutil
.copyfile(tmp
, self
.filename
)
1853 except shutil
.Error
:
1856 #if confirmChange and confirmDialog(self, "Keep this config?") == gtk.RESPONSE_NO:
1857 # shutil.copyfile(self.filename+".backup", self.filename) # Create backup
1858 # self.apply(widget, event, False)
1860 def changeAllFonts(self
, widget
):
1861 """Changes all fonts at once."""
1862 dialog
= gtk
.FontSelectionDialog("Select Font")
1864 dialog
.set_font_name(self
.defaults
["font"])
1866 if dialog
.run() == gtk
.RESPONSE_OK
:
1867 newFont
= dialog
.get_font_name()
1869 self
.clock1FontButton
.set_font_name(newFont
)
1870 self
.clock2FontButton
.set_font_name(newFont
)
1871 self
.bat1FontButton
.set_font_name(newFont
)
1872 self
.bat2FontButton
.set_font_name(newFont
)
1873 self
.fontButton
.set_font_name(newFont
)
1877 self
.generateConfig()
1878 self
.changeOccurred()
1880 def changeDefaults(self
, widget
=None):
1881 """Shows the style preferences widget."""
1882 TintWizardPrefGUI(self
)
1884 def changeOccurred(self
, widget
=None):
1885 """Called when the user changes something, i.e. entry value"""
1888 self
.updateStatusBar(change
=True)
1890 if widget
== self
.panelOrientation
:
1891 if self
.panelOrientation
.get_active_text() == "horizontal":
1892 self
.panelSizeLabel
.set_text("Size (width, height)")
1894 self
.panelSizeLabel
.set_text("Size (height, width)")
1896 def colorChange(self
, widget
):
1897 """Update the text entry when a color button is updated."""
1898 r
= widget
.get_color().red
1899 g
= widget
.get_color().green
1900 b
= widget
.get_color().blue
1902 label
= self
.getColorLabel(widget
)
1908 label
.set_text(rgbToHex(r
, g
, b
))
1910 self
.changeOccurred()
1912 def colorTyped(self
, widget
):
1913 """Update the color button when a valid value is typed into the entry."""
1914 s
= widget
.get_text()
1916 # The color button associated with this widget.
1917 colorButton
= self
.getColorButton(widget
)
1919 # Just a precautionary check - this situation should never arise.
1921 #print "Error in colorTyped() -- unrecognised entry widget."
1924 # If the entered value is invalid, set textbox to the current
1925 # hex value of the associated color button.
1926 buttonHex
= self
.getHexFromWidget(colorButton
)
1929 errorDialog(self
, "Invalid color specification: [%s]" % s
)
1930 widget
.set_text(buttonHex
)
1934 col
= gtk
.gdk
.Color(s
)
1936 errorDialog(self
, "Invalid color specification: [%s]" % s
)
1937 widget
.set_text(buttonHex
)
1940 colorButton
.set_color(col
)
1942 # Note: only set init to True when removing backgrounds for a new config
1943 # This prevents unwanted calls to changeOccurred()
1944 def delBgClick(self
, widget
=None, prompt
=True, init
=False):
1945 """Deletes the selected background after confirming with the user."""
1946 selected
= self
.bgNotebook
.get_current_page()
1948 if selected
== -1: # Nothing to remove
1952 if confirmDialog(self
, "Remove this background?") != gtk
.RESPONSE_YES
:
1955 self
.bgNotebook
.remove_page(selected
)
1956 self
.bgs
.pop(selected
)
1958 for i
in range(self
.bgNotebook
.get_n_pages()):
1959 self
.bgNotebook
.set_tab_label_text(self
.bgNotebook
.get_nth_page(i
), "Background ID %d" % (i
+1))
1961 self
.bgNotebook
.show_all()
1963 self
.updateComboBoxes(len(self
.bgs
) + 1, "remove")
1966 self
.changeOccurred()
1968 def generateConfig(self
):
1969 """Reads values from each widget and generates a config."""
1970 self
.configBuf
.delete(self
.configBuf
.get_start_iter(), self
.configBuf
.get_end_iter())
1971 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "# Tint2 config file\n")
1972 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "# Generated by tintwizard (http://code.google.com/p/tintwizard/)\n")
1973 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")
1974 if not self
.oneConfigFile
:
1975 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "# To use this as default tint2 config: save as $HOME/.config/tint2/tint2rc\n\n")
1977 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "# Background definitions\n")
1978 for i
in range(len(self
.bgs
)):
1979 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "# ID %d\n" % (i
+ 1))
1981 for child
in self
.bgs
[i
].get_children():
1982 if child
.get_name() == "rounded":
1983 rounded
= child
.get_text() if child
.get_text() else BG_ROUNDING
1984 elif child
.get_name() == "border":
1985 borderW
= child
.get_text() if child
.get_text() else BG_BORDER
1986 elif child
.get_name() == "bgCol":
1987 bgCol
= self
.getHexFromWidget(child
)
1988 bgAlpha
= int(child
.get_alpha() / 65535.0 * 100)
1989 elif child
.get_name() == "borderCol":
1990 borderCol
= self
.getHexFromWidget(child
)
1991 borderAlpha
= int(child
.get_alpha() / 65535.0 * 100)
1993 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "rounded = %s\n" % (rounded
))
1994 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "border_width = %s\n" % (borderW
))
1995 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "background_color = %s %d\n" % (bgCol
, bgAlpha
))
1996 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "border_color = %s %d\n\n" % (borderCol
, borderAlpha
))
1998 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "# Panel\n")
1999 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "panel_monitor = %s\n" % (self
.panelMonitor
.get_text() if self
.panelMonitor
.get_text() else PANEL_MONITOR
))
2000 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()))
2001 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
,
2002 self
.panelSizeY
.get_text() if self
.panelSizeY
.get_text() else PANEL_SIZE_Y
))
2003 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
,
2004 self
.panelMarginY
.get_text() if self
.panelMarginY
.get_text() else PANEL_MARGIN_Y
))
2005 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
,
2006 self
.panelPadY
.get_text() if self
.panelPadY
.get_text() else PANEL_PADDING_Y
,
2007 self
.panelSpacing
.get_text() if self
.panelSpacing
.get_text() else TASKBAR_SPACING
))
2008 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "panel_dock = %s\n" % int(self
.panelDock
.get_active()))
2009 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "wm_menu = %s\n" % int(self
.panelMenu
.get_active()))
2010 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "panel_layer = %s\n" % (self
.panelLayer
.get_active_text()))
2011 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "panel_background_id = %s\n" % (self
.panelBg
.get_active()))
2013 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Panel Autohide\n")
2014 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "autohide = %s\n" % int(self
.panelAutohide
.get_active()))
2015 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
))
2016 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
))
2017 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
))
2018 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
))
2020 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Taskbar\n")
2021 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "taskbar_mode = %s\n" % (self
.taskbarMode
.get_active_text()))
2022 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
,
2023 self
.taskbarPadY
.get_text() if self
.taskbarPadY
.get_text() else TASKBAR_PADDING_X
,
2024 self
.taskbarSpacing
.get_text() if self
.taskbarSpacing
.get_text() else TASK_SPACING
))
2025 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "taskbar_background_id = %s\n" % (self
.taskbarBg
.get_active()))
2026 # Comment out the taskbar_active_background_id if user has "disabled" it
2027 if self
.taskbarActiveBgEnable
.get_active() == 0:
2028 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "#")
2029 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "taskbar_active_background_id = %s\n" % (self
.taskbarActiveBg
.get_active()))
2031 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Tasks\n")
2032 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
))
2033 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_icon = %s\n" % int(self
.taskIconCheckButton
.get_active()))
2034 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_text = %s\n" % int(self
.taskTextCheckButton
.get_active()))
2035 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_centered = %s\n" % int(self
.taskCentreCheckButton
.get_active()))
2036 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
))
2037 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
,
2038 self
.taskPadY
.get_text() if self
.taskPadY
.get_text() else TASK_PADDING_Y
))
2039 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_background_id = %s\n" % (self
.taskBg
.get_active()))
2040 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_active_background_id = %s\n" % (self
.taskActiveBg
.get_active()))
2041 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_urgent_background_id = %s\n" % (self
.taskUrgentBg
.get_active()))
2042 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_iconified_background_id = %s\n" % (self
.taskIconifiedBg
.get_active()))
2044 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Task Icons\n")
2045 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
,
2046 self
.iconSat
.get_text() if self
.iconSat
.get_text() else ICON_SAT
,
2047 self
.iconBri
.get_text() if self
.iconBri
.get_text() else ICON_BRI
))
2048 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
,
2049 self
.activeIconSat
.get_text() if self
.activeIconSat
.get_text() else ACTIVE_ICON_SAT
,
2050 self
.activeIconBri
.get_text() if self
.activeIconBri
.get_text() else ACTIVE_ICON_BRI
))
2051 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
,
2052 self
.urgentIconSat
.get_text() if self
.urgentIconSat
.get_text() else URGENT_ICON_SAT
,
2053 self
.urgentIconBri
.get_text() if self
.urgentIconBri
.get_text() else URGENT_ICON_BRI
))
2054 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
,
2055 self
.iconifiedIconSat
.get_text() if self
.iconifiedIconSat
.get_text() else ICONIFIED_ICON_SAT
,
2056 self
.iconifiedIconBri
.get_text() if self
.iconifiedIconBri
.get_text() else ICONIFIED_ICON_BRI
))
2058 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Fonts\n")
2059 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_font = %s\n" % (self
.fontButton
.get_font_name()))
2060 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_font_color = %s %s\n" % (self
.getHexFromWidget(self
.fontColButton
),
2061 int(self
.fontColButton
.get_alpha() / 65535.0 * 100)))
2062 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_active_font_color = %s %s\n" % (self
.getHexFromWidget(self
.fontActiveColButton
),
2063 int(self
.fontActiveColButton
.get_alpha() / 65535.0 * 100)))
2064 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_urgent_font_color = %s %s\n" % (self
.getHexFromWidget(self
.fontUrgentColButton
),
2065 int(self
.fontUrgentColButton
.get_alpha() / 65535.0 * 100)))
2066 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "task_iconified_font_color = %s %s\n" % (self
.getHexFromWidget(self
.fontIconifiedColButton
),
2067 int(self
.fontIconifiedColButton
.get_alpha() / 65535.0 * 100)))
2068 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "font_shadow = %s\n" % int(self
.fontShadowCheckButton
.get_active()))
2070 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# System Tray\n")
2071 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "systray = %s\n" % int(self
.trayShow
.get_active()))
2072 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
,
2073 self
.trayPadY
.get_text() if self
.trayPadY
.get_text() else TRAY_PADDING_Y
,
2074 self
.traySpacing
.get_text() if self
.traySpacing
.get_text() else TRAY_SPACING
))
2075 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "systray_sort = %s\n" % (self
.trayOrder
.get_active_text()))
2076 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "systray_background_id = %s\n" % (self
.trayBg
.get_active()))
2077 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
))
2078 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
,
2079 self
.trayIconSat
.get_text() if self
.trayIconSat
.get_text() else TRAY_ICON_SAT
,
2080 self
.trayIconBri
.get_text() if self
.trayIconBri
.get_text() else TRAY_ICON_BRI
))
2082 if self
.clockCheckButton
.get_active():
2083 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Clock\n")
2084 if self
.clock1CheckButton
.get_active():
2085 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
))
2086 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "time1_font = %s\n" % (self
.clock1FontButton
.get_font_name()))
2087 if self
.clock2CheckButton
.get_active():
2088 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
))
2089 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "time2_font = %s\n" % (self
.clock2FontButton
.get_font_name()))
2091 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "clock_font_color = %s %s\n" % (self
.getHexFromWidget(self
.clockFontColButton
),
2092 int(self
.clockFontColButton
.get_alpha() / 65535.0 * 100)))
2094 if self
.clockTooltipCheckButton
.get_active():
2095 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "clock_tooltip = %s\n" % (self
.clockTooltipFormat
.get_text() if self
.clockTooltipFormat
.get_text() else CLOCK_TOOLTIP
))
2096 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
,
2097 self
.clockPadY
.get_text() if self
.clockPadY
.get_text() else CLOCK_PADDING_Y
))
2098 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "clock_background_id = %s\n" % (self
.clockBg
.get_active()))
2099 if self
.clockLClick
.get_text():
2100 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "clock_lclick_command = %s\n" % (self
.clockLClick
.get_text()))
2101 if self
.clockRClick
.get_text():
2102 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "clock_rclick_command = %s\n" % (self
.clockRClick
.get_text()))
2103 if self
.clockTimezone1CheckButton
.get_active():
2104 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
))
2105 if self
.clockTimezone2CheckButton
.get_active():
2106 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
))
2107 if self
.clockTimezoneTooltipCheckButton
.get_active():
2108 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
))
2111 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Tooltips\n")
2112 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "tooltip = %s\n" % int(self
.tooltipShow
.get_active()))
2113 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
,
2114 self
.tooltipPadY
.get_text() if self
.tooltipPadY
.get_text() else TOOLTIP_PADDING_Y
))
2115 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
))
2116 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
))
2117 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "tooltip_background_id = %s\n" % (self
.tooltipBg
.get_active()))
2118 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "tooltip_font = %s\n" % (self
.tooltipFont
.get_font_name()))
2119 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "tooltip_font_color = %s %s\n" % (self
.getHexFromWidget(self
.tooltipFontColButton
),
2120 int(self
.tooltipFontColButton
.get_alpha() / 65535.0 * 100)))
2122 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Mouse\n")
2123 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "mouse_middle = %s\n" % (self
.mouseMiddle
.get_active_text()))
2124 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "mouse_right = %s\n" % (self
.mouseRight
.get_active_text()))
2125 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "mouse_scroll_up = %s\n" % (self
.mouseUp
.get_active_text()))
2126 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "mouse_scroll_down = %s\n" % (self
.mouseDown
.get_active_text()))
2128 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# Battery\n")
2129 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "battery = %s\n" % int(self
.batteryCheckButton
.get_active()))
2130 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
))
2131 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
))
2132 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "bat1_font = %s\n" % (self
.bat1FontButton
.get_font_name()))
2133 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "bat2_font = %s\n" % (self
.bat2FontButton
.get_font_name()))
2134 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "battery_font_color = %s %s\n" % (self
.getHexFromWidget(self
.batteryFontColButton
),
2135 int(self
.batteryFontColButton
.get_alpha() / 65535.0 * 100)))
2136 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
,
2137 self
.batteryPadY
.get_text() if self
.batteryPadY
.get_text() else BATTERY_PADDING_Y
))
2138 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "battery_background_id = %s\n" % (self
.batteryBg
.get_active()))
2140 self
.configBuf
.insert(self
.configBuf
.get_end_iter(), "\n# End of config")
2142 def getColorButton(self
, widget
):
2143 """Returns the color button associated with widget."""
2144 if widget
.get_name() == "fontCol":
2145 return self
.fontColButton
2146 elif widget
.get_name() == "fontActiveCol":
2147 return self
.fontActiveColButton
2148 elif widget
.get_name() == "fontUrgentCol":
2149 return self
.fontUrgentColButton
2150 elif widget
.get_name() == "fontIconifiedCol":
2151 return self
.fontIconifiedColButton
2152 elif widget
.get_name() == "clockFontCol":
2153 return self
.clockFontColButton
2154 elif widget
.get_name() == "batteryFontCol":
2155 return self
.batteryFontColButton
2156 elif widget
.get_name() == "tooltipFontCol":
2157 return self
.tooltipFontColButton
2158 elif widget
.get_name() == "bgColEntry":
2159 bgID
= self
.bgNotebook
.get_current_page()
2161 for child
in self
.bgs
[bgID
].get_children():
2162 if child
.get_name() == "bgCol":
2165 elif widget
.get_name() == "borderColEntry":
2166 bgID
= self
.bgNotebook
.get_current_page()
2168 for child
in self
.bgs
[bgID
].get_children():
2169 if child
.get_name() == "borderCol":
2173 # No button found which matches label
2176 def getColorLabel(self
, widget
):
2177 """Gets the color label associated with a color button."""
2178 if widget
.get_name() == "fontCol":
2180 elif widget
.get_name() == "fontActiveCol":
2181 return self
.fontActiveCol
2182 elif widget
.get_name() == "fontUrgentCol":
2183 return self
.fontUrgentCol
2184 elif widget
.get_name() == "fontIconifiedCol":
2185 return self
.fontIconifiedCol
2186 elif widget
.get_name() == "clockFontCol":
2187 return self
.clockFontCol
2188 elif widget
.get_name() == "batteryFontCol":
2189 return self
.batteryFontCol
2190 elif widget
.get_name() == "tooltipFontCol":
2191 return self
.tooltipFontCol
2192 elif widget
.get_name() == "bgCol":
2193 bgID
= self
.bgNotebook
.get_current_page()
2195 for child
in self
.bgs
[bgID
].get_children():
2196 if child
.get_name() == "bgColEntry":
2199 elif widget
.get_name() == "borderCol":
2200 bgID
= self
.bgNotebook
.get_current_page()
2202 for child
in self
.bgs
[bgID
].get_children():
2203 if child
.get_name() == "borderColEntry":
2207 # No label found which matches color button
2210 def getHexFromWidget(self
, widget
):
2211 """Returns the #RRGGBB value of a widget."""
2212 r
= widget
.get_color().red
2213 g
= widget
.get_color().green
2214 b
= widget
.get_color().blue
2216 return rgbToHex(r
, g
, b
)
2218 def help(self
, action
=None):
2219 """Opens the Help wiki page in the default web browser."""
2221 webbrowser
.open("http://code.google.com/p/tintwizard/wiki/Help")
2223 errorDialog(self
, "Your default web-browser could not be opened.\nPlease visit http://code.google.com/p/tintwizard/wiki/Help")
2226 """Enters the main loop."""
2229 def new(self
, action
=None):
2230 """Prepares a new config."""
2235 self
.filename
= None
2239 self
.generateConfig()
2240 self
.updateStatusBar("New Config File [*]")
2242 def openDef(self
, widget
=None):
2243 """Opens the default tint2 config."""
2244 self
.openFile(default
=True)
2246 def openFile(self
, widget
=None, default
=False):
2247 """Reads from a config file. If default=True, open the tint2 default config."""
2251 chooser
= gtk
.FileChooserDialog("Open Config File", self
, gtk
.FILE_CHOOSER_ACTION_OPEN
, (gtk
.STOCK_CANCEL
, gtk
.RESPONSE_CANCEL
, gtk
.STOCK_OPEN
, gtk
.RESPONSE_OK
))
2252 chooser
.set_default_response(gtk
.RESPONSE_OK
)
2254 if self
.curDir
!= None:
2255 chooser
.set_current_folder(self
.curDir
)
2257 chooserFilter
= gtk
.FileFilter()
2258 chooserFilter
.set_name("All files")
2259 chooserFilter
.add_pattern("*")
2260 chooser
.add_filter(chooserFilter
)
2263 response
= chooser
.run()
2265 if response
== gtk
.RESPONSE_OK
:
2266 self
.filename
= chooser
.get_filename()
2267 self
.curDir
= os
.path
.dirname(self
.filename
)
2274 self
.filename
= os
.path
.expandvars("$HOME/.config/tint2/tint2rc")
2275 self
.curDir
= os
.path
.expandvars("$HOME/.config/tint2")
2277 self
.readTint2Config()
2278 self
.generateConfig()
2279 self
.updateStatusBar()
2281 def parseBgs(self
, string
):
2282 """Parses the background definitions from a string."""
2283 s
= string
.split("\n")
2287 bgKeys
= ["border_width", "background_color", "border_color"]
2291 data
= [token
.strip() for token
in line
.split("=")]
2293 if data
[0] == "rounded": # It may be considered bad practice to
2294 bgDefs
+= [{"rounded": data[1]}
] # find each style definition with an
2295 elif data
[0] in bgKeys
: # arbitrary value, but tint2 does the same.
2296 bgDefs
[cur
][data
[0]] = data
[1] # This means that any existing configs must
2297 else: # start with 'rounded'.
2298 newString
+= "%s\n" % line
2300 self
.addBgDefs(bgDefs
)
2304 def parseConfig(self
, string
):
2305 """Parses the contents of a config file."""
2306 for line
in string
.split("\n"):
2307 s
= line
.split("=") # Create a list with KEY and VALUE
2309 e
= s
[0].strip() # Strip whitespace from KEY
2311 if e
== "time1_format": # Set the VALUE of KEY
2312 self
.parseProp(self
.propUI
[e
], s
[1], True, "time1")
2313 elif e
== "time2_format":
2314 self
.parseProp(self
.propUI
[e
], s
[1], True, "time2")
2315 elif e
== "clock_tooltip":
2316 self
.parseProp(self
.propUI
[e
], s
[1], True, "clock_tooltip")
2317 elif e
== "time1_timezone":
2318 self
.parseProp(self
.propUI
[e
], s
[1], True, "time1_timezone")
2319 elif e
== "time2_timezone":
2320 self
.parseProp(self
.propUI
[e
], s
[1], True, "time2_timezone")
2321 elif e
== "clock_tooltip_timezone":
2322 self
.parseProp(self
.propUI
[e
], s
[1], True, "tooltip_timezone")
2323 elif e
== "systray_padding":
2324 self
.parseProp(self
.propUI
[e
], s
[1], True, "tray")
2325 elif e
== "taskbar_active_background_id":
2326 self
.parseProp(self
.propUI
[e
], s
[1], True, "activeBg")
2328 if self
.propUI
.has_key(e
):
2329 self
.parseProp(self
.propUI
[e
], s
[1])
2331 def parseProp(self
, prop
, string
, special
=False, propType
=""):
2332 """Parses a variable definition from the conf file and updates the correct UI widget."""
2333 string
= string
.strip() # Remove whitespace from the VALUE
2334 eType
= type(prop
) # Get widget type
2336 if special
: # 'Special' properties are those which are optional
2337 if propType
== "time1":
2338 self
.clockCheckButton
.set_active(True)
2339 self
.clock1CheckButton
.set_active(True)
2340 elif propType
== "time2":
2341 self
.clockCheckButton
.set_active(True)
2342 self
.clock2CheckButton
.set_active(True)
2343 elif propType
== "clock_tooltip":
2344 self
.clockCheckButton
.set_active(True)
2345 self
.clockTooltipCheckButton
.set_active(True)
2346 elif propType
== "time1_timezone":
2347 self
.clockTimezone1CheckButton
.set_active(True)
2348 elif propType
== "time2_timezone":
2349 self
.clockTimezone2CheckButton
.set_active(True)
2350 elif propType
== "tooltip_timezone":
2351 self
.clockTimezoneTooltipCheckButton
.set_active(True)
2352 elif propType
== "tray":
2353 self
.trayShow
.set_active(True)
2354 elif propType
== "activeBg":
2355 self
.taskbarActiveBgEnable
.set_active(True)
2357 if eType
== gtk
.Entry
:
2358 prop
.set_text(string
)
2360 elif eType
== gtk
.ComboBox
:
2361 # This allows us to select the correct combo-box value.
2362 if string
in ["bottom", "top", "left", "right", "center", "single_desktop", "multi_desktop", "single_monitor",
2363 "none", "close", "shade", "iconify", "toggle", "toggle_iconify", "maximize_restore",
2364 "desktop_left", "desktop_right", "horizontal", "vertical", "ascending", "descending",
2365 "left2right", "right2left", "next_task", "prev_task", "minimum", "follow_size", "normal"]:
2366 if string
in ["bottom", "left", "single_desktop", "none", "horizontal", "ascending"]:
2368 elif string
in ["top", "right", "multi_desktop", "close", "vertical", "descending", "minimum"]:
2370 elif string
in ["center", "single_monitor", "toggle", "left2right", "follow_size", "normal"]:
2372 elif string
in ["right2left"]:
2375 i
= ["none", "close", "toggle", "iconify", "shade", "toggle_iconify", "maximize_restore",
2376 "desktop_left", "desktop_right", "next_task", "prev_task"].index(string
)
2380 prop
.set_active(int(string
))
2381 elif eType
== gtk
.CheckButton
:
2382 prop
.set_active(bool(int(string
)))
2383 elif eType
== gtk
.FontButton
:
2384 prop
.set_font_name(string
)
2385 elif eType
== gtk
.ColorButton
:
2386 prop
.set_alpha(int(int(string
) * 65535 / 100.0))
2387 elif eType
== tuple: # If a property has more than 1 value, for example the x and y co-ords
2388 s
= string
.split(" ") # of the padding properties, then just we use recursion to set the
2389 for i
in range(len(prop
)): # value of each associated widget.
2391 self
.parseProp(prop
[i
], "0")
2393 self
.parseProp(prop
[i
], s
[i
])
2395 def quit(self
, widget
, event
=None):
2396 """Asks if user would like to save file before quitting, then quits the program."""
2398 if self
.oneConfigFile
:
2399 response
= gtk
.RESPONSE_YES
2401 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
))
2402 dialog
.get_content_area().add(gtk
.Label("Save config before quitting?"))
2403 dialog
.get_content_area().set_size_request(300, 100)
2405 response
= dialog
.run()
2408 if response
== gtk
.RESPONSE_CANCEL
:
2409 return True # Return True to stop it quitting when we hit "Cancel"
2410 elif response
== gtk
.RESPONSE_NO
:
2412 elif response
== gtk
.RESPONSE_YES
:
2419 """Reads the tintwizard configuration file - NOT tint2 config files."""
2420 self
.defaults
= {"font": None, "bgColor": None, "fgColor": None, "borderColor": None, "bgCount": None, "dir": None}
2422 if self
.oneConfigFile
:
2423 # don't need tintwizard.conf
2426 pathName
= os
.path
.dirname(sys
.argv
[0])
2431 if not os
.path
.exists(pathName
+ "tintwizard.conf"):
2435 f
= open(pathName
+ "tintwizard.conf", "r")
2441 if self
.defaults
.has_key(l
[0].strip()):
2442 self
.defaults
[l
[0].strip()] = l
[1].strip()
2444 def readTint2Config(self
):
2445 """Reads in from a config file."""
2446 f
= open(self
.filename
, "r")
2451 if (line
[0] != "#") and (len(line
) > 2):
2456 # Deselect the optional stuff, and we'll re-check them if the config has them enabled
2457 self
.clockCheckButton
.set_active(False)
2458 self
.clock1CheckButton
.set_active(False)
2459 self
.clock2CheckButton
.set_active(False)
2460 self
.clockTooltipCheckButton
.set_active(False)
2461 self
.clockTimezone1CheckButton
.set_active(False)
2462 self
.clockTimezone2CheckButton
.set_active(False)
2463 self
.clockTimezoneTooltipCheckButton
.set_active(False)
2464 self
.trayShow
.set_active(False)
2465 self
.taskbarActiveBgEnable
.set_active(False)
2467 # Remove all background styles so we can create new ones as we read them
2468 for i
in range(len(self
.bgs
)):
2469 self
.delBgClick(None, False)
2471 # As we parse background definitions, we build a new string
2472 # without the background related stuff. This means we don't
2473 # have to read through background defs AGAIN when parsing
2475 noBgDefs
= self
.parseBgs(string
)
2477 self
.parseConfig(noBgDefs
)
2479 def reportBug(self
, action
=None):
2480 """Opens the bug report page in the default web browser."""
2482 webbrowser
.open("http://code.google.com/p/tintwizard/issues/entry")
2484 errorDialog(self
, "Your default web-browser could not be opened.\nPlease visit http://code.google.com/p/tintwizard/issues/entry")
2487 def resetConfig(self
):
2488 """Resets all the widgets to their default values."""
2490 for i
in range(len(self
.bgs
)):
2491 self
.delBgClick(prompt
=False, init
=True)
2493 for i
in range(self
.defaults
["bgCount"]):
2494 self
.addBgClick(init
=True)
2496 self
.bgNotebook
.set_current_page(0)
2499 self
.panelPosY
.set_active(0)
2500 self
.panelPosX
.set_active(0)
2501 self
.panelOrientation
.set_active(0)
2502 self
.panelSizeX
.set_text(PANEL_SIZE_X
)
2503 self
.panelSizeY
.set_text(PANEL_SIZE_Y
)
2504 self
.panelMarginX
.set_text(PANEL_MARGIN_X
)
2505 self
.panelMarginY
.set_text(PANEL_MARGIN_Y
)
2506 self
.panelPadX
.set_text(PANEL_PADDING_Y
)
2507 self
.panelPadY
.set_text(PANEL_PADDING_Y
)
2508 self
.panelSpacing
.set_text(TASKBAR_SPACING
)
2509 self
.panelBg
.set_active(0)
2510 self
.panelMenu
.set_active(0)
2511 self
.panelDock
.set_active(0)
2512 self
.panelLayer
.set_active(0)
2513 self
.panelMonitor
.set_text(PANEL_MONITOR
)
2514 self
.panelAutohide
.set_active(0)
2515 self
.panelAutohideShow
.set_text(PANEL_AUTOHIDE_SHOW
)
2516 self
.panelAutohideHide
.set_text(PANEL_AUTOHIDE_HIDE
)
2517 self
.panelAutohideHeight
.set_text(PANEL_AUTOHIDE_HEIGHT
)
2518 self
.panelAutohideStrut
.set_active(0)
2520 self
.taskbarMode
.set_active(0)
2521 self
.taskbarPadX
.set_text(TASKBAR_PADDING_X
)
2522 self
.taskbarPadY
.set_text(TASKBAR_PADDING_Y
)
2523 self
.taskbarSpacing
.set_text(TASK_SPACING
)
2524 self
.taskbarBg
.set_active(0)
2525 self
.taskbarActiveBg
.set_active(0)
2526 self
.taskbarActiveBgEnable
.set_active(0)
2528 self
.taskBlinks
.set_text(TASK_BLINKS
)
2529 self
.taskCentreCheckButton
.set_active(True)
2530 self
.taskTextCheckButton
.set_active(True)
2531 self
.taskIconCheckButton
.set_active(True)
2532 self
.taskMaxSizeX
.set_text(TASK_MAXIMUM_SIZE_X
)
2533 self
.taskMaxSizeY
.set_text(TASK_MAXIMUM_SIZE_Y
)
2534 self
.taskPadX
.set_text(TASK_PADDING_X
)
2535 self
.taskPadY
.set_text(TASK_PADDING_Y
)
2536 self
.taskBg
.set_active(0)
2537 self
.taskActiveBg
.set_active(0)
2538 self
.taskUrgentBg
.set_active(0)
2539 self
.taskIconifiedBg
.set_active(0)
2541 self
.iconHue
.set_text(ICON_ALPHA
)
2542 self
.iconSat
.set_text(ICON_SAT
)
2543 self
.iconBri
.set_text(ICON_BRI
)
2544 self
.activeIconHue
.set_text(ACTIVE_ICON_ALPHA
)
2545 self
.activeIconSat
.set_text(ACTIVE_ICON_SAT
)
2546 self
.activeIconBri
.set_text(ACTIVE_ICON_BRI
)
2547 self
.urgentIconHue
.set_text(URGENT_ICON_ALPHA
)
2548 self
.urgentIconSat
.set_text(URGENT_ICON_SAT
)
2549 self
.urgentIconBri
.set_text(URGENT_ICON_BRI
)
2550 self
.iconifiedIconHue
.set_text(ICONIFIED_ICON_ALPHA
)
2551 self
.iconifiedIconSat
.set_text(ICONIFIED_ICON_SAT
)
2552 self
.iconifiedIconBri
.set_text(ICONIFIED_ICON_BRI
)
2554 self
.fontButton
.set_font_name(self
.defaults
["font"])
2555 self
.fontColButton
.set_alpha(65535)
2556 self
.fontColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2557 self
.fontCol
.set_text(self
.defaults
["fgColor"])
2558 self
.fontActiveColButton
.set_alpha(65535)
2559 self
.fontActiveColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2560 self
.fontActiveCol
.set_text(self
.defaults
["fgColor"])
2561 self
.fontUrgentColButton
.set_alpha(65535)
2562 self
.fontUrgentColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2563 self
.fontUrgentCol
.set_text(self
.defaults
["fgColor"])
2564 self
.fontIconifiedColButton
.set_alpha(65535)
2565 self
.fontIconifiedColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2566 self
.fontIconifiedCol
.set_text(self
.defaults
["fgColor"])
2567 self
.fontShadowCheckButton
.set_active(False)
2569 self
.trayShow
.set_active(True)
2570 self
.trayPadX
.set_text(TRAY_PADDING_X
)
2571 self
.trayPadY
.set_text(TRAY_PADDING_X
)
2572 self
.traySpacing
.set_text(TRAY_SPACING
)
2573 self
.trayOrder
.set_active(0)
2574 self
.trayBg
.set_active(0)
2575 self
.trayMaxIconSize
.set_text(TRAY_MAX_ICON_SIZE
)
2576 self
.trayIconHue
.set_text(TRAY_ICON_ALPHA
)
2577 self
.trayIconSat
.set_text(TRAY_ICON_SAT
)
2578 self
.trayIconBri
.set_text(TRAY_ICON_BRI
)
2580 self
.clockCheckButton
.set_active(True)
2581 self
.clock1Format
.set_text(CLOCK_FMT_1
)
2582 self
.clock1CheckButton
.set_active(True)
2583 self
.clock1FontButton
.set_font_name(self
.defaults
["font"])
2584 self
.clock2Format
.set_text(CLOCK_FMT_2
)
2585 self
.clock2CheckButton
.set_active(True)
2586 self
.clockTooltipFormat
.set_text(CLOCK_TOOLTIP
)
2587 self
.clockTooltipCheckButton
.set_active(False)
2588 self
.clock2FontButton
.set_font_name(self
.defaults
["font"])
2589 self
.clockFontColButton
.set_alpha(65535)
2590 self
.clockFontColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2591 self
.clockFontCol
.set_text(self
.defaults
["fgColor"])
2592 self
.clockPadX
.set_text(CLOCK_PADDING_X
)
2593 self
.clockPadY
.set_text(CLOCK_PADDING_Y
)
2594 self
.clockBg
.set_active(0)
2595 self
.clockLClick
.set_text(CLOCK_LCLICK
)
2596 self
.clockRClick
.set_text(CLOCK_RCLICK
)
2597 self
.clockTime1Timezone
.set_text(CLOCK_TIME1_TIMEZONE
)
2598 self
.clockTimezone1CheckButton
.set_active(False)
2599 self
.clockTime2Timezone
.set_text(CLOCK_TIME2_TIMEZONE
)
2600 self
.clockTimezone2CheckButton
.set_active(False)
2601 self
.clockTooltipTimezone
.set_text(CLOCK_TOOLTIP_TIMEZONE
)
2602 self
.clockTimezoneTooltipCheckButton
.set_active(False)
2604 self
.tooltipShow
.set_active(False)
2605 self
.tooltipPadX
.set_text(TOOLTIP_PADDING_X
)
2606 self
.tooltipPadY
.set_text(TOOLTIP_PADDING_Y
)
2607 self
.tooltipShowTime
.set_text(TOOLTIP_SHOW_TIMEOUT
)
2608 self
.tooltipHideTime
.set_text(TOOLTIP_HIDE_TIMEOUT
)
2609 self
.tooltipBg
.set_active(0)
2610 self
.tooltipFont
.set_font_name(self
.defaults
["font"])
2611 self
.tooltipFontColButton
.set_alpha(65535)
2612 self
.tooltipFontColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2613 self
.tooltipFontCol
.set_text(self
.defaults
["fgColor"])
2615 self
.mouseMiddle
.set_active(0)
2616 self
.mouseRight
.set_active(0)
2617 self
.mouseUp
.set_active(0)
2618 self
.mouseDown
.set_active(0)
2620 self
.batteryCheckButton
.set_active(False)
2621 self
.batteryLow
.set_text(BATTERY_LOW
)
2622 self
.batteryLowAction
.set_text(BATTERY_ACTION
)
2623 self
.bat1FontButton
.set_font_name(self
.defaults
["font"])
2624 self
.bat2FontButton
.set_font_name(self
.defaults
["font"])
2625 self
.batteryFontColButton
.set_alpha(65535)
2626 self
.batteryFontColButton
.set_color(gtk
.gdk
.color_parse(self
.defaults
["fgColor"]))
2627 self
.batteryFontCol
.set_text(self
.defaults
["fgColor"])
2628 self
.batteryPadX
.set_text(BATTERY_PADDING_Y
)
2629 self
.batteryPadY
.set_text(BATTERY_PADDING_Y
)
2630 self
.batteryBg
.set_active(0)
2632 def save(self
, widget
=None, event
=None):
2633 """Saves the generated config file."""
2635 # This function returns the boolean status of whether or not the
2636 # file saved, so that the apply() function knows if it should
2637 # kill the tint2 process and apply the new config.
2639 # If no file has been selected, force the user to "Save As..."
2640 if self
.filename
== None:
2641 return self
.saveAs()
2643 self
.generateConfig()
2648 def saveAs(self
, widget
=None, event
=None):
2649 """Prompts the user to select a file and then saves the generated config file."""
2650 self
.generateConfig()
2652 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
))
2653 chooser
.set_default_response(gtk
.RESPONSE_OK
)
2655 if self
.curDir
!= None:
2656 chooser
.set_current_folder(self
.curDir
)
2658 chooserFilter
= gtk
.FileFilter()
2659 chooserFilter
.set_name("All files")
2660 chooserFilter
.add_pattern("*")
2661 chooser
.add_filter(chooserFilter
)
2664 response
= chooser
.run()
2666 if response
== gtk
.RESPONSE_OK
:
2667 self
.filename
= chooser
.get_filename()
2669 if os
.path
.exists(self
.filename
):
2670 overwrite
= confirmDialog(self
, "This file already exists. Overwrite this file?")
2672 if overwrite
== gtk
.RESPONSE_YES
:
2677 self
.filename
= None
2685 self
.filename
= None
2689 def saveAsDef(self
, widget
=None, event
=None):
2690 """Saves the config as the default tint2 config."""
2691 if confirmDialog(self
, "Overwrite current tint2 default config?") == gtk
.RESPONSE_YES
:
2692 self
.filename
= os
.path
.expandvars("${HOME}") + "/.config/tint2/tint2rc"
2693 self
.curDir
= os
.path
.expandvars("${HOME}") + "/.config/tint2"
2695 # If, for whatever reason, tint2 has no default config - create one.
2696 if not os
.path
.isfile(self
.filename
):
2697 f
= open(self
.filename
, "w")
2698 f
.write("# tint2rc")
2701 self
.generateConfig()
2706 def savePrompt(self
):
2707 """Prompt the user to save before creating a new file."""
2708 if confirmDialog(self
, "Save current config?") == gtk
.RESPONSE_YES
:
2711 def switchPage(self
, notebook
, page
, page_num
):
2712 """Handles notebook page switch events."""
2714 # If user selects the 'View Config' tab, update the textarea within this tab.
2715 if notebook
.get_tab_label_text(notebook
.get_nth_page(page_num
)) == "View Config":
2716 self
.generateConfig()
2718 def updateComboBoxes(self
, i
, action
="add"):
2719 """Updates the contents of a combo box when a background style has been added/removed."""
2720 cbs
= [self
.batteryBg
, self
.clockBg
, self
.taskbarBg
, self
.taskbarActiveBg
, self
.trayBg
, self
.taskActiveBg
, self
.taskBg
, self
.panelBg
, self
.tooltipBg
, self
.taskUrgentBg
, self
.taskIconifiedBg
]
2724 cb
.append_text(str(i
+1))
2727 if cb
.get_active() == i
: # If background is selected, set to a different value
2732 def updateStatusBar(self
, message
="", change
=False):
2733 """Updates the message on the statusbar. A message can be provided,
2734 and if change is set to True (i.e. something has been modified) then
2735 an appropriate symbol [*] is shown beside filename."""
2736 contextID
= self
.statusBar
.get_context_id("")
2738 self
.statusBar
.pop(contextID
)
2741 message
= "%s %s" % (self
.filename
or "New Config File", "[*]" if change
else "")
2743 self
.statusBar
.push(contextID
, message
)
2745 def writeConf(self
):
2746 """Writes the tintwizard configuration file."""
2747 confStr
= "#Start\n[defaults]\n"
2749 for key
in self
.defaults
:
2750 confStr
+= "%s = %s\n" % (key
, str(self
.defaults
[key
]))
2754 pathName
= os
.path
.dirname(sys
.argv
[0])
2757 f
= open("tintwizard.conf", "w")
2759 f
= open(pathName
+"/tintwizard.conf", "w")
2765 def writeFile(self
):
2766 """Writes the contents of the config text buffer to file."""
2768 f
= open(self
.filename
, "w")
2770 f
.write(self
.configBuf
.get_text(self
.configBuf
.get_start_iter(), self
.configBuf
.get_end_iter()))
2776 self
.curDir
= os
.path
.dirname(self
.filename
)
2778 self
.updateStatusBar()
2780 errorDialog(self
, "Could not save file")
2782 # General use functions
2783 def confirmDialog(parent
, message
):
2784 """Creates a confirmation dialog and returns the response."""
2785 dialog
= gtk
.MessageDialog(parent
, gtk
.DIALOG_MODAL
, gtk
.MESSAGE_QUESTION
, gtk
.BUTTONS_YES_NO
, message
)
2787 response
= dialog
.run()
2791 def errorDialog(parent
=None, message
="An error has occured!"):
2792 """Creates an error dialog."""
2793 dialog
= gtk
.MessageDialog(parent
, gtk
.DIALOG_MODAL
, gtk
.MESSAGE_ERROR
, gtk
.BUTTONS_OK
, message
)
2799 """Convert integer n in range [0, 15] to hex."""
2801 return ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"][n
]
2805 def rgbToHex(r
, g
, b
):
2806 """Constructs a 6 digit hex representation of color (r, g, b)."""
2807 r2
= trunc(r
/ 65535.0 * 255)
2808 g2
= trunc(g
/ 65535.0 * 255)
2809 b2
= trunc(b
/ 65535.0 * 255)
2811 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))
2814 """Truncate a floating point number, rounding up or down appropriately."""
2815 c
= math
.fabs(math
.ceil(n
) - n
)
2816 f
= math
.fabs(math
.floor(n
) - n
)
2819 return int(math
.ceil(n
))
2821 return int(math
.floor(n
))
2823 # Direct execution of application
2824 if __name__
== "__main__":
2825 if len(sys
.argv
) > 1 and sys
.argv
[1] == "-version":
2829 tw
= TintWizardGUI()