keyword generator frontend
This commit is contained in:
parent
efb77a790d
commit
86bfa4454a
6 changed files with 520 additions and 2 deletions
27
adstreme/glade/KeywordGenerator.py
Executable file
27
adstreme/glade/KeywordGenerator.py
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
class Main:
|
||||||
|
'run this class to see the keyword generator in action'
|
||||||
|
import sys
|
||||||
|
|
||||||
|
try:
|
||||||
|
import pygtk
|
||||||
|
pygtk.require("2.0") #we want to use gtk2
|
||||||
|
except:
|
||||||
|
print "\nYou need \"pygtk\" to get this working."
|
||||||
|
print "In Debian do: apt-get install python2.3-gtk2\n"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
try:
|
||||||
|
import gtk
|
||||||
|
from gtk import glade
|
||||||
|
except:
|
||||||
|
print "\nYou need \"libglade\" to get this working."
|
||||||
|
print "In Debian do: apt-get install python2.3-glade2\n"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
import kg_frontend
|
||||||
|
kgf = kg_frontend.KeywordGeneratorFrontend(gtk)
|
||||||
|
gtk.main()
|
||||||
|
|
||||||
|
|
340
adstreme/glade/kg-frontend/kg-frontend.glade
Normal file
340
adstreme/glade/kg-frontend/kg-frontend.glade
Normal file
|
@ -0,0 +1,340 @@
|
||||||
|
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||||
|
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||||
|
|
||||||
|
<glade-interface>
|
||||||
|
|
||||||
|
<widget class="GtkWindow" id="window1">
|
||||||
|
<property name="border_width">3</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="title" translatable="yes">Keyword Generator</property>
|
||||||
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
|
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||||
|
<property name="modal">False</property>
|
||||||
|
<property name="default_width">300</property>
|
||||||
|
<property name="default_height">500</property>
|
||||||
|
<property name="resizable">True</property>
|
||||||
|
<property name="destroy_with_parent">False</property>
|
||||||
|
<property name="icon_name">stock_filters</property>
|
||||||
|
<property name="decorated">True</property>
|
||||||
|
<property name="skip_taskbar_hint">False</property>
|
||||||
|
<property name="skip_pager_hint">False</property>
|
||||||
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||||
|
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||||
|
<property name="focus_on_map">True</property>
|
||||||
|
<signal name="destroy_event" handler="on_window1_destroy_event" last_modification_time="Wed, 05 Apr 2006 19:16:16 GMT"/>
|
||||||
|
<signal name="destroy" handler="on_window1_destroy" last_modification_time="Wed, 05 Apr 2006 19:22:48 GMT"/>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
<property name="spacing">0</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label4">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Keyword Generator 0.1</property>
|
||||||
|
<property name="use_underline">False</property>
|
||||||
|
<property name="use_markup">False</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||||
|
<property name="width_chars">-1</property>
|
||||||
|
<property name="single_line_mode">False</property>
|
||||||
|
<property name="angle">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">5</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">True</property>
|
||||||
|
<property name="spacing">5</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
<property name="spacing">0</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEntry" id="entry1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="has_focus">True</property>
|
||||||
|
<property name="editable">True</property>
|
||||||
|
<property name="visibility">True</property>
|
||||||
|
<property name="max_length">0</property>
|
||||||
|
<property name="text" translatable="yes"></property>
|
||||||
|
<property name="has_frame">True</property>
|
||||||
|
<property name="invisible_char">*</property>
|
||||||
|
<property name="activates_default">False</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">5</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="pack_type">GTK_PACK_END</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
<property name="spacing">0</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEntry" id="entry2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="editable">True</property>
|
||||||
|
<property name="visibility">True</property>
|
||||||
|
<property name="max_length">0</property>
|
||||||
|
<property name="text" translatable="yes"></property>
|
||||||
|
<property name="has_frame">True</property>
|
||||||
|
<property name="invisible_char">*</property>
|
||||||
|
<property name="activates_default">False</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">5</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="pack_type">GTK_PACK_END</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">True</property>
|
||||||
|
<property name="spacing">0</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEntry" id="entry3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="editable">True</property>
|
||||||
|
<property name="visibility">True</property>
|
||||||
|
<property name="max_length">0</property>
|
||||||
|
<property name="text" translatable="yes"></property>
|
||||||
|
<property name="has_frame">True</property>
|
||||||
|
<property name="invisible_char">*</property>
|
||||||
|
<property name="activates_default">False</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">5</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="pack_type">GTK_PACK_END</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEventBox" id="eventbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="visible_window">True</property>
|
||||||
|
<property name="above_child">False</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox4">
|
||||||
|
<property name="border_width">5</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">True</property>
|
||||||
|
<property name="spacing">0</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes"></property>
|
||||||
|
<property name="use_underline">False</property>
|
||||||
|
<property name="use_markup">False</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||||
|
<property name="width_chars">-1</property>
|
||||||
|
<property name="single_line_mode">False</property>
|
||||||
|
<property name="angle">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="bu_ok">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
|
<property name="focus_on_click">True</property>
|
||||||
|
<signal name="clicked" handler="on_bu_ok_clicked" last_modification_time="Wed, 05 Apr 2006 13:37:09 GMT"/>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkAlignment" id="alignment1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xscale">0</property>
|
||||||
|
<property name="yscale">0</property>
|
||||||
|
<property name="top_padding">0</property>
|
||||||
|
<property name="bottom_padding">0</property>
|
||||||
|
<property name="left_padding">0</property>
|
||||||
|
<property name="right_padding">0</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImage" id="image1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-apply</property>
|
||||||
|
<property name="icon_size">4</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">loslegen</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="use_markup">False</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||||
|
<property name="width_chars">-1</property>
|
||||||
|
<property name="single_line_mode">False</property>
|
||||||
|
<property name="angle">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||||
|
<property name="height_request">180</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
|
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||||
|
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkTextView" id="tf_output">
|
||||||
|
<property name="border_width">3</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="editable">False</property>
|
||||||
|
<property name="overwrite">False</property>
|
||||||
|
<property name="accepts_tab">True</property>
|
||||||
|
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||||
|
<property name="cursor_visible">False</property>
|
||||||
|
<property name="pixels_above_lines">0</property>
|
||||||
|
<property name="pixels_below_lines">0</property>
|
||||||
|
<property name="pixels_inside_wrap">0</property>
|
||||||
|
<property name="left_margin">0</property>
|
||||||
|
<property name="right_margin">0</property>
|
||||||
|
<property name="indent">0</property>
|
||||||
|
<property name="text" translatable="yes">In jedes der drei oberen Textfelder können kommaseparierte Wortlisten eingetragen werden. Daraus wird dann in dieser Textbox die Keywordliste generiert.
|
||||||
|
|
||||||
|
Aber das Beste ist, das funktioniert auch alles ohne Maus 8]</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
</glade-interface>
|
8
adstreme/glade/kg-frontend/kg-frontend.gladep
Normal file
8
adstreme/glade/kg-frontend/kg-frontend.gladep
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||||
|
<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
|
||||||
|
|
||||||
|
<glade-project>
|
||||||
|
<name>Kg-frontend</name>
|
||||||
|
<program_name>kg-frontend</program_name>
|
||||||
|
<gnome_support>FALSE</gnome_support>
|
||||||
|
</glade-project>
|
101
adstreme/glade/kg_calc.py
Normal file
101
adstreme/glade/kg_calc.py
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#TODO: funktion, die aus parametern schoene listen macht.
|
||||||
|
|
||||||
|
class KeywordGenerator:
|
||||||
|
def __init__(self):
|
||||||
|
import string,sys
|
||||||
|
return
|
||||||
|
|
||||||
|
def add_prefix_to_strings(self,prefix,stringlist):
|
||||||
|
"""gets a string and a list of strings
|
||||||
|
returns a list of strings each prefixed with given string."""
|
||||||
|
ret = []
|
||||||
|
for item in stringlist:
|
||||||
|
ret.append(prefix+item)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def quotes_and_braces(self,keywords):
|
||||||
|
"""gets a string with keywords, returns
|
||||||
|
given string
|
||||||
|
"given string"
|
||||||
|
[given string]
|
||||||
|
"""
|
||||||
|
ret = '%s\n' % keywords
|
||||||
|
#ret += '"%s"\n' % keywords
|
||||||
|
#ret += '[%s]\n' % keywords
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def arg_string_to_list(self,s):
|
||||||
|
"""gets a string.
|
||||||
|
removes all occurences of " and splits with , as separator."""
|
||||||
|
s = s.replace('"','')
|
||||||
|
ret = s.split(',')
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def generate_keywords(self,l1,l2,l3):
|
||||||
|
"""
|
||||||
|
gets 3 lists of keyword parts.
|
||||||
|
returns a string containing every possible combination of above
|
||||||
|
keywords and its generated variants from quotes_and_braces."
|
||||||
|
"""
|
||||||
|
ret = ""
|
||||||
|
list1 = self.arg_string_to_list(l1)
|
||||||
|
list2 = self.arg_string_to_list(l2)
|
||||||
|
list3 = self.arg_string_to_list(l3)
|
||||||
|
for list1item in list1:
|
||||||
|
tmplist1 = []
|
||||||
|
tmplist1 = self.add_prefix_to_strings(list1item+" ",list2)
|
||||||
|
for tmplist1item in tmplist1:
|
||||||
|
tmplist2 = []
|
||||||
|
tmplist2 = self.add_prefix_to_strings(tmplist1item+" ",list3)
|
||||||
|
for tmplist2item in tmplist2:
|
||||||
|
ret += self.quotes_and_braces(tmplist2item)
|
||||||
|
ret += "\n"
|
||||||
|
return ret[:-3] #cut the tailing '\n\n\n'
|
||||||
|
|
||||||
|
'''
|
||||||
|
def test():
|
||||||
|
#sample data
|
||||||
|
|
||||||
|
|
||||||
|
#test quotes_and_brace
|
||||||
|
keywords = "fair clothing"
|
||||||
|
expected_result = """fair clothing\n"fair clothing"\n[fair clothing]\n"""
|
||||||
|
if quotes_and_braces(keywords) != expected_result:
|
||||||
|
raise "test of quotes_and_braces() failed!"
|
||||||
|
|
||||||
|
#test add_prefix_to_strings
|
||||||
|
pref = "fair "
|
||||||
|
strlist = ["clothing","clothings"]
|
||||||
|
expected_result = ["fair clothing","fair clothings"]
|
||||||
|
if add_prefix_to_strings(pref,strlist) != expected_result:
|
||||||
|
raise "test of add_prefix_to_strings() failed!"
|
||||||
|
|
||||||
|
#test generate_keywords
|
||||||
|
list1 = ["fair"]
|
||||||
|
list2 = ["clothing","clothings"]
|
||||||
|
list3 = ["buy"]
|
||||||
|
expected_result = """fair clothing buy\n"fair clothing buy"\n[fair clothing buy]\n\n\nfair clothings buy\n"fair clothings buy"\n[fair clothings buy]\n\n\n"""
|
||||||
|
|
||||||
|
if generate_keywords(list1,list2,list3) != expected_result:
|
||||||
|
raise "test of generate_keywords() failed!"
|
||||||
|
|
||||||
|
#test arg_string_to_list(s)
|
||||||
|
s = '"clothing,clothings"'
|
||||||
|
expected_result = ['clothing', 'clothings']
|
||||||
|
if arg_string_to_list(s) != expected_result:
|
||||||
|
raise "test of arg_string_to_list() failed!"
|
||||||
|
|
||||||
|
#test get_arguments()
|
||||||
|
(list1,list2,list3) = get_arguments()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
#test()
|
||||||
|
if len(sys.argv) !=4 :
|
||||||
|
print ' %s is a script for generating keyword lists suitable for google adwords.' % sys.argv[0]
|
||||||
|
print ' usage: %s "part1,alterative part1" "part2, another part2" ",verb"' % sys.argv[0]
|
||||||
|
else:
|
||||||
|
(list1,list2,list3) = get_arguments()
|
||||||
|
print generate_keywords(list1,list2,list3)
|
||||||
|
'''
|
41
adstreme/glade/kg_frontend.py
Normal file
41
adstreme/glade/kg_frontend.py
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env python -v
|
||||||
|
|
||||||
|
class KeywordGeneratorFrontend:
|
||||||
|
'this class handles the gui'
|
||||||
|
|
||||||
|
import kg_calc
|
||||||
|
import sys,string
|
||||||
|
|
||||||
|
def __init__(self, gtkext):
|
||||||
|
# gtk is given, it has to be known in the whole class
|
||||||
|
self.gtk = gtkext
|
||||||
|
# define which gladefile to use for frontend
|
||||||
|
gladefile = "kg-frontend/kg-frontend.glade"
|
||||||
|
self.gui = self.gtk.glade.XML(gladefile)
|
||||||
|
# set button handlers
|
||||||
|
actions = { "on_bu_ok_clicked": self.clicked_ok,
|
||||||
|
"on_window1_destroy": self.exit }
|
||||||
|
# connect the actions to the events
|
||||||
|
self.gui.signal_autoconnect (actions)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
#### implementation of actions
|
||||||
|
|
||||||
|
def clicked_ok(self, widget):
|
||||||
|
'read input fields and print them'
|
||||||
|
#self.gui.get_widget("tf_output").set_text("saved to file")
|
||||||
|
entry1 = self.gui.get_widget("entry1").get_text()
|
||||||
|
entry2 = self.gui.get_widget("entry2").get_text()
|
||||||
|
entry3 = self.gui.get_widget("entry3").get_text()
|
||||||
|
kg = self.kg_calc.KeywordGenerator()
|
||||||
|
self.keywords = kg.generate_keywords(entry1,entry2,entry3)
|
||||||
|
self.outputfield = self.gui.get_widget("tf_output")
|
||||||
|
self.textbuffer = self.outputfield.get_buffer()
|
||||||
|
self.textbuffer.set_text(self.keywords)
|
||||||
|
|
||||||
|
def exit(self, widget):
|
||||||
|
print "schiss digga"
|
||||||
|
self.sys.exit(1)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
#TODO: funktion, die aus parametern schoene listen macht.
|
#TODO: funktion, die aus parametern schoene listen macht.
|
||||||
|
|
||||||
import string,sys
|
import string,sys
|
||||||
|
@ -107,7 +108,7 @@ def test():
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
#test()
|
#test()
|
||||||
if len(sys.argv) <=1:
|
if len(sys.argv) !=4 :
|
||||||
print ' %s is a script for generating keyword lists suitable for google adwords.' % sys.argv[0]
|
print ' %s is a script for generating keyword lists suitable for google adwords.' % sys.argv[0]
|
||||||
print ' usage: %s "part1,alterative part1" "part2, another part2" ",verb"' % sys.argv[0]
|
print ' usage: %s "part1,alterative part1" "part2, another part2" ",verb"' % sys.argv[0]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue