parent
8954b60857
commit
7c11b1b14d
1 changed files with 61 additions and 15 deletions
76
btn4ws.py
76
btn4ws.py
|
@ -2,7 +2,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# This is the main file of btn4ws.
|
# 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.
|
# This file is part of btn4ws.
|
||||||
#
|
#
|
||||||
|
@ -182,8 +182,8 @@ class Btn4wsDialog(gtk.Assistant):
|
||||||
gtk.Assistant.__init__(self)
|
gtk.Assistant.__init__(self)
|
||||||
|
|
||||||
self._addIntroPage()
|
self._addIntroPage()
|
||||||
#self._addPathSelectionPage()
|
self._addPathSelectionPage()
|
||||||
#self._addBasicSettingsPage()
|
self._addBasicSettingsPage()
|
||||||
self._addLayoutPage()
|
self._addLayoutPage()
|
||||||
self._addEffectsPage()
|
self._addEffectsPage()
|
||||||
self._addLastPage()
|
self._addLastPage()
|
||||||
|
@ -330,7 +330,7 @@ class Btn4wsDialog(gtk.Assistant):
|
||||||
label.show()
|
label.show()
|
||||||
page.pack_start(label, True, True, 0)
|
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()
|
table.show()
|
||||||
|
|
||||||
#roundradius
|
#roundradius
|
||||||
|
@ -355,13 +355,23 @@ class Btn4wsDialog(gtk.Assistant):
|
||||||
table.attach(label, 0, 1, 1, 2)
|
table.attach(label, 0, 1, 1, 2)
|
||||||
table.attach(entry, 1, 2, 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
|
#transparency
|
||||||
transp = gtk.CheckButton("Transparent button background")
|
transp = gtk.CheckButton("Transparent button background")
|
||||||
transp.set_active(self.data["transparency"])
|
transp.set_active(self.data["transparency"])
|
||||||
transp.show()
|
transp.show()
|
||||||
transp.connect("toggled", self._cb_toggle_simple, "transparency",
|
transp.connect("toggled", self._cb_toggle_simple, "transparency",
|
||||||
"layout")
|
"layout")
|
||||||
table.attach(transp, 1, 2, 2, 3)
|
table.attach(transp, 1, 2, 3, 4)
|
||||||
|
|
||||||
#bgcolor
|
#bgcolor
|
||||||
label = gtk.Label("Background color")
|
label = gtk.Label("Background color")
|
||||||
|
@ -372,8 +382,8 @@ class Btn4wsDialog(gtk.Assistant):
|
||||||
colorsel.connect("color-changed", self._cb_set_color, "bgcolor",
|
colorsel.connect("color-changed", self._cb_set_color, "bgcolor",
|
||||||
"layout")
|
"layout")
|
||||||
colorsel.show()
|
colorsel.show()
|
||||||
table.attach(label, 0, 1, 3, 4)
|
table.attach(label, 0, 1, 4, 5)
|
||||||
table.attach(colorsel, 1, 2, 3, 4)
|
table.attach(colorsel, 1, 2, 4, 5)
|
||||||
|
|
||||||
page.pack_end(table)
|
page.pack_end(table)
|
||||||
|
|
||||||
|
@ -432,7 +442,24 @@ class Btn4wsDialog(gtk.Assistant):
|
||||||
novaradius, novasparkles)
|
novaradius, novasparkles)
|
||||||
|
|
||||||
#glow
|
#glow
|
||||||
|
glowtoggle = gtk.CheckButton("Enable glow effect")
|
||||||
|
glowtoggle.set_active(self.data["glow"])
|
||||||
|
glowtoggle.show()
|
||||||
|
table.attach(glowtoggle, 1, 2, 4, 5)
|
||||||
|
|
||||||
#glowcolor
|
#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)
|
page.pack_end(table)
|
||||||
|
|
||||||
|
@ -491,19 +518,28 @@ class Btn4wsDialog(gtk.Assistant):
|
||||||
page.pack_start(toggle)
|
page.pack_start(toggle)
|
||||||
|
|
||||||
def checkcompletion(self, pagename):
|
def checkcompletion(self, pagename):
|
||||||
logging.debug(str(self.data))
|
|
||||||
criteriamatched = False
|
criteriamatched = False
|
||||||
if pagename == "pathselection":
|
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":
|
elif pagename == "basicsettings":
|
||||||
criteriamatched = self.data["font"] and self.data["strcolor"] \
|
criteriamatched = self.data["font"] is not None and \
|
||||||
and ((self.data["usepattern"] and self.data["pattern"]) or \
|
self.data["strcolor"] is not None and \
|
||||||
(not self.data["usepattern"] and \
|
((self.data["usepattern"] and self.data["pattern"]) or \
|
||||||
self.data["buttoncolor"]))
|
(not self.data["usepattern"] and \
|
||||||
|
self.data["buttoncolor"]))
|
||||||
elif pagename == "layout":
|
elif pagename == "layout":
|
||||||
criteriamatched = self.data["roundradius"] is not None and \
|
criteriamatched = self.data["roundradius"] is not None and \
|
||||||
self.data["bevelwidth"] 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)
|
(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":
|
elif pagename == "output":
|
||||||
criteriamatched = self.data["makejscript"] is not None and \
|
criteriamatched = self.data["makejscript"] is not None and \
|
||||||
self.data["makeinactive"] 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.data[datafield] = w.get_active()
|
||||||
self.checkcompletion(pagename)
|
self.checkcompletion(pagename)
|
||||||
|
|
||||||
def _cb_file_selected(self, w, filesel):
|
def _cb_file_selected(self, w):
|
||||||
self.data["filename"] = w.get_filename()
|
self.data["filename"] = w.get_filename()
|
||||||
self.checkcompletion("pathselection")
|
self.checkcompletion("pathselection")
|
||||||
|
|
||||||
def _cb_dir_selected(self, w, dirsel):
|
def _cb_dir_selected(self, w):
|
||||||
self.data["outdir"] = w.get_filename()
|
self.data["outdir"] = w.get_filename()
|
||||||
self.checkcompletion("pathselection")
|
self.checkcompletion("pathselection")
|
||||||
|
|
||||||
|
@ -574,6 +610,15 @@ class Btn4wsDialog(gtk.Assistant):
|
||||||
sparksfield.set_sensitive(False)
|
sparksfield.set_sensitive(False)
|
||||||
self.checkcompletion("effects")
|
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):
|
class btn4wsplugin(gimpplugin.plugin):
|
||||||
"""This is the btn4ws gimp plugin."""
|
"""This is the btn4ws gimp plugin."""
|
||||||
def gimp2html_color(color):
|
def gimp2html_color(color):
|
||||||
|
@ -699,6 +744,7 @@ class btn4wsplugin(gimpplugin.plugin):
|
||||||
|
|
||||||
def _cb_apply(self, widget):
|
def _cb_apply(self, widget):
|
||||||
self.data = widget.data
|
self.data = widget.data
|
||||||
|
logging.debug(str(self.data))
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.data = {}
|
self.data = {}
|
||||||
|
|
Loading…
Reference in a new issue