* completed input GUI
This commit is contained in:
Jan Dittberner 2008-01-05 16:26:37 +00:00
parent 8954b60857
commit 7c11b1b14d

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# This is the main file of btn4ws.
#
# Copyright (c) 1999-2007 Jan Dittberner <jan@dittberner.info>
# Copyright (c) 1999-2008 Jan Dittberner <jan@dittberner.info>
#
# This file is part of btn4ws.
#
@ -182,8 +182,8 @@ class Btn4wsDialog(gtk.Assistant):
gtk.Assistant.__init__(self)
self._addIntroPage()
#self._addPathSelectionPage()
#self._addBasicSettingsPage()
self._addPathSelectionPage()
self._addBasicSettingsPage()
self._addLayoutPage()
self._addEffectsPage()
self._addLastPage()
@ -330,7 +330,7 @@ class Btn4wsDialog(gtk.Assistant):
label.show()
page.pack_start(label, True, True, 0)
table = gtk.Table(rows=4, columns=2, homogeneous=False)
table = gtk.Table(rows=5, columns=2, homogeneous=False)
table.show()
#roundradius
@ -355,13 +355,23 @@ class Btn4wsDialog(gtk.Assistant):
table.attach(label, 0, 1, 1, 2)
table.attach(entry, 1, 2, 1, 2)
#padding
label = gtk.Label("Padding")
label.show()
entry = IntEntry(max = 2)
entry.connect("changed", self._cb_set_intvalue, "padding",
"layout")
entry.show()
table.attach(label, 0, 1, 2, 3)
table.attach(entry, 1, 2, 2, 3)
#transparency
transp = gtk.CheckButton("Transparent button background")
transp.set_active(self.data["transparency"])
transp.show()
transp.connect("toggled", self._cb_toggle_simple, "transparency",
"layout")
table.attach(transp, 1, 2, 2, 3)
table.attach(transp, 1, 2, 3, 4)
#bgcolor
label = gtk.Label("Background color")
@ -372,8 +382,8 @@ class Btn4wsDialog(gtk.Assistant):
colorsel.connect("color-changed", self._cb_set_color, "bgcolor",
"layout")
colorsel.show()
table.attach(label, 0, 1, 3, 4)
table.attach(colorsel, 1, 2, 3, 4)
table.attach(label, 0, 1, 4, 5)
table.attach(colorsel, 1, 2, 4, 5)
page.pack_end(table)
@ -432,7 +442,24 @@ class Btn4wsDialog(gtk.Assistant):
novaradius, novasparkles)
#glow
glowtoggle = gtk.CheckButton("Enable glow effect")
glowtoggle.set_active(self.data["glow"])
glowtoggle.show()
table.attach(glowtoggle, 1, 2, 4, 5)
#glowcolor
label = gtk.Label("Glow color")
label.show()
glowcolor = gimpui.ColorSelector()
if self.data["glowcolor"]:
glowcolor.set_pattern(self.data["glowcolor"])
glowcolor.connect("color-changed", self._cb_set_color, "glowcolor",
"effects")
glowcolor.set_sensitive(self.data["glow"])
glowcolor.show()
table.attach(label, 0, 1, 5, 6)
table.attach(glowcolor, 1, 2, 5, 6)
glowtoggle.connect("toggled", self._cb_glow_toggle, glowcolor)
page.pack_end(table)
@ -491,19 +518,28 @@ class Btn4wsDialog(gtk.Assistant):
page.pack_start(toggle)
def checkcompletion(self, pagename):
logging.debug(str(self.data))
criteriamatched = False
if pagename == "pathselection":
criteriamatched = self.data["filename"] and self.data["outdir"]
criteriamatched = self.data["filename"] is not None and \
self.data["outdir"] is not None
elif pagename == "basicsettings":
criteriamatched = self.data["font"] and self.data["strcolor"] \
and ((self.data["usepattern"] and self.data["pattern"]) or \
(not self.data["usepattern"] and \
self.data["buttoncolor"]))
criteriamatched = self.data["font"] is not None and \
self.data["strcolor"] is not None and \
((self.data["usepattern"] and self.data["pattern"]) or \
(not self.data["usepattern"] and \
self.data["buttoncolor"]))
elif pagename == "layout":
criteriamatched = self.data["roundradius"] is not None and \
self.data["bevelwidth"] is not None and \
self.data["padding"] is not None and \
(self.data["transparency"] or self.data["bgcolor"] is not None)
elif pagename == "effects":
criteriamatched = (self.data["nova"] == False or ( \
self.data["novacolor"] is not None and \
self.data["novaradius"] is not None and \
self.data["novasparkles"] is not None)) and \
(self.data["glow"] == False or \
self.data["glowcolor"] is not None)
elif pagename == "output":
criteriamatched = self.data["makejscript"] is not None and \
self.data["makeinactive"] is not None and \
@ -525,11 +561,11 @@ class Btn4wsDialog(gtk.Assistant):
self.data[datafield] = w.get_active()
self.checkcompletion(pagename)
def _cb_file_selected(self, w, filesel):
def _cb_file_selected(self, w):
self.data["filename"] = w.get_filename()
self.checkcompletion("pathselection")
def _cb_dir_selected(self, w, dirsel):
def _cb_dir_selected(self, w):
self.data["outdir"] = w.get_filename()
self.checkcompletion("pathselection")
@ -574,6 +610,15 @@ class Btn4wsDialog(gtk.Assistant):
sparksfield.set_sensitive(False)
self.checkcompletion("effects")
def _cb_glow_toggle(self, w, colorfield):
if w.get_active():
self.data["glow"] = True
colorfield.set_sensitive(True)
else:
self.data["glow"] = False
colorfield.set_sensitive(False)
self.checkcompletion("effects")
class btn4wsplugin(gimpplugin.plugin):
"""This is the btn4ws gimp plugin."""
def gimp2html_color(color):
@ -699,6 +744,7 @@ class btn4wsplugin(gimpplugin.plugin):
def _cb_apply(self, widget):
self.data = widget.data
logging.debug(str(self.data))
def __init__(self):
self.data = {}