GtkDialog - tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

#881 Post by afifio »

Yep, its reinventing the wheel if compared to glade.
But why not, gtkdialog can call glade file, true, but look in the last 10 pages. We can count how many thats glade generated, pretty low
or is it people who use glade did not have issues with gtkdialog ? :o

I wonder why the whole Gnome community miss gtkdialog. It can be much more if people give it a thought and help extend it. Declarative programming is the future and people still stuck with C and C++.

Anyway since its backend is mostly bash/sh powered, we cant achieve much I guess. But the real problem is the widget, its quite primitive.

Yeah, I too looking for a real tree. gtkdialog treeview is NOT a tree, so frustrating.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#882 Post by sunburnt »

It use to have one, but I don`t know how to make it work anymore.
As technosaurus blogged, GTK sucks. My take... It sucks badly.
XML syntax is another suck arse item. It`s a crappy way to describe anything.

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#883 Post by disciple »

It use to have one
Are you sure you're not mixing gtkdialog up with something else? I don't think I've ever seen one.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#884 Post by SFR »

disciple wrote:
It use to have one
Are you sure you're not mixing gtkdialog up with something else? I don't think I've ever seen one.
Maybe it was Xdialog..?

Code: Select all

Xdialog --treeview "A tree" 0 0 5 tag1 item1 on 0 tag2 item2 on 1 tag3 item3 on 2
Greetings!
Attachments
Screenshot.png
(11.28 KiB) Downloaded 614 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#885 Post by CatDude »

Hi

Widget Reference
Examples

If it's not what you are talking about, then please ignore.

CatDude
.
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

#886 Post by afifio »

sunburnt wrote:XML syntax is another suck arse item. It`s a crappy way to describe anything.
I believe you got it a bit wrong there. XML is THE WAY to describe anything, that is the current common popular belief and practiced successfully almost everywhere. View source of this page and bam, its XML. Even MS in drawn to create XAML.

What interesting about gtkdialog is - the ability to define actions to perform. Most XML dont have this or in limited style using CDATA.

gtkdialog takes the pain away from GTK using XML and I'm trying to take the pain away from XML using gmould. In future, your grandchild might have <make><coffee type=latte></coffee></make> button, and guess what it do ? :lol: :lol: :lol:

Of course, there are other way to describe things, but I think they introduce more complexity.

About GTK sucks, I cant comment, I dont code in it. I never code in GTK, not yet, even its just C. Why bother when you can use XML. Notice that I dont know GTK but still able to build gtk app ? Thats the power of XML.

I believe you can accept these stuff as a game challenge, its more fun that way.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#887 Post by sunburnt »

Just because it`s popular doesn`t mean it`s better in any way.
Obtuse syntax and too much typing to describe the items.
xml and html just use more text to describe less data and control.

Example`s easier to read, understand, type, and is smaller.
Less typing means fewer errors, people make mistakes.
Easy to read and understand means quicker to find the errors.

Code: Select all

gui='title Example
list
	var LIST
	file /path/file
	click script1
button
	text Do Something
	click script2
button
	cancel'

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

#888 Post by Moose On The Loose »

sunburnt wrote:Just because it`s popular doesn`t mean it`s better in any way.
Obtuse syntax and too much typing to describe the items.
xml and html just use more text to describe less data and control.

Example`s easier to read, understand, type, and is smaller.
Less typing means fewer errors, people make mistakes.
Easy to read and understand means quicker to find the errors.

Code: Select all

gui='title Example
list
	var LIST
	file /path/file
	click script1
button
	text Do Something
	click script2
button
	cancel'
Are you suggesting that a fixed indenting system would be the way to make clear what is going on.

BTW: Languages with default types and no need to explicitly define variables are the source of massive numbers of hard to find errors. They do require less typing but at least they don't lose space craft because of a mistyped "do".

My method of doing gtkdialog scripts is to make functions for the fragments and test them one by one and then combine fragments to make the whole GUI. It is easy to do and does not lead to errors. The only downside is that I have to do just a little more typing. The functions just echo to stdout.

The final mainline code looks a little like this:

Code: Select all

function MakeGUI() {
  Fragment1
  Fragment2
  SomeButtons
  }

DIA=$( MakeGUI )
gtkdialog3 -p DIA
Its all very easy to trouble shoot

afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

#889 Post by afifio »

sunburnt wrote:Just because it`s popular doesn`t mean it`s better in any way.
Obtuse syntax and too much typing to describe the items.
xml and html just use more text to describe less data and control.

Code: Select all

gui='title Example
list
	var LIST
	file /path/file
	click script1
button
	text Do Something
	click script2
button
	cancel'
Correct, its more typing, but its the most simplest of code I guess. IMO, XML lose only to direct variable assignment.

Code: Select all

<button>blue</button> vs
button=blue
....but then XML add more flexibility. Flexibility always come with complexity.

Code: Select all

<button align="right">
<text align="left" style="underline">blue</text>
</button>
Now how do you do that in your algo ? even with python style indentation its quite hard to explain I think.

Anyway, want gmould ? (my shameless promo)
It save you from typing :lol: :lol: :lol:
its still in dev but pretty usable now.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#890 Post by sunburnt »

It`s just an example, there are as many ways to do things as the imagination can muster.
And it is easier on the eyes ( many claim otherwise...), and it`ll do anything xml will do.

Code: Select all

button
   align right
   text blue
   text align left
   text style underline
afifio; I don`t write apps much, a Filer is needed to replace Rox is my only use here.
If time permits I`ll look at it, I`m looking at RSH`s Modularity package at the moment.

Moose; Yes, my dynamic menu loops to make the buttons from lists or files.
Each loop creates code for a complete button. I wrote one in BaCon also.
But it needs to be compiled to work on different Puppies. Too much effort...
GtkDialog`s one saving grace, as only it needs compiling because it reads script.
.
Last edited by sunburnt on Sat 23 Nov 2013, 19:49, edited 1 time in total.

afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

#891 Post by afifio »

A Filer is a file manager isn't it ?

How about xfe ? 3 pane filemanager, require fox toolkit, which is simply another file, the benefits is there are lots of fox program can be run too.

Another shameless plug! :lol: :lol:
gmould now available for download, will require about 5 minutes on 14.4kbps modem.

Requirements:
gtkdialog version 0.8.3 r473M or better
bash and its friends.
https://code.google.com/p/gmould/source ... uld.tar.gz 600kb

git clone https://code.google.com/p/gmould/

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#892 Post by sunburnt »

afifio; Rox is the only filer that recognizes AppDir or RoxApp type no-install packages.

### Problems with the GtkDialog list box.
Code looks good and the output is good also, but it errors:
** (gtkdialog:837): ERROR **: gtkdialog: Error in line 58, near token '<item>': syntax error
/root/0_sda3/AppPkg/tools/ubu_new-build/main-apps-deps.gtkdlg: line 33: 837 Trace/breakpoint trap gtkdialog --program=UBU_GU

Code: Select all

#!/bin/sh
P=`realpath $0`
cd ${P%/*}
List=$(<Ubuntu-Precise-Main_Apps-DB.lst)
Groups=`echo "$List" |sed 's,^.*/ ,    <item>,;s, |.*$,,;s,$,</item>,'`
TITLE=' Ubuntu Package Builder.'
export UBU_GUI='
<window title="'$TITLE'">
<vbox>
<hbox>
  <list>
    <variable>GROUP</variable>
    <width>400</width><height>200</height>
'$Groups'
  </list>
</hbox>
<hbox>
  <button ok></button>
  <button exit></button>
</hbox>
</vbox>
</window>
'
echo -e "$UBU_GUI"
gtkdialog --program=UBU_GUI
And the output, there`s 2 "/" and 1 "'" which I tried removing with no luck.

Code: Select all

<window title=" Ubuntu Package Builder.">
<vbox>
<hbox>
  <list>
    <variable>GROUP</variable>
    <width>400</width><height>200</height>
    <item>Administration Utilities</item>
    <item>Mono/CLI</item>
    <item>Communication Programs</item>
    <item>Databases</item>
    <item>debian-installer udeb packages</item>
    <item>Debug packages</item>
    <item>Development</item>
    <item>Documentation</item>
    <item>Editors</item>
    <item>Electronics</item>
    <item>Embedded software</item>
    <item>Fonts</item>
    <item>Games</item>
    <item>GNOME</item>
    <item>GNU R</item>
    <item>GNUstep</item>
    <item>Graphics</item>
    <item>Ham Radio</item>
    <item>Haskell</item>
    <item>Web Servers</item>
    <item>Interpreters</item>
    <item>Java</item>
    <item>KDE</item>
    <item>Kernels</item>
    <item>Library development</item>
    <item>Libraries</item>
    <item>Lisp</item>
    <item>Language packs</item>
    <item>Mail</item>
    <item>Mathematics</item>
    <item>Miscellaneous</item>
    <item>Network</item>
    <item>Newsgroups</item>
    <item>OCaml</item>
    <item>Old Libraries</item>
    <item>Other OS's and file systems</item>
    <item>Perl</item>
    <item>PHP</item>
    <item>Python</item>
    <item>Ruby</item>
    <item>Science</item>
    <item>Shells</item>
    <item>Sound</item>
    <item>TeX</item>
    <item>Text Processing</item>
    <item>Translations</item>
    <item>Utilities</item>
    <item>Version Control Systems</item>
    <item>Video</item>
    <item>Virtual packages</item>
    <item>Web Software</item>
    <item>X Window System software</item>
    <item>Xfce</item>
    <item>Zope/Plone Framework</item>
  </list>
</hbox>
<hbox>
  <button ok></button>
  <button exit></button>
</hbox>
</vbox>
</window>
Last edited by sunburnt on Sat 23 Nov 2013, 19:50, edited 1 time in total.

afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

#893 Post by afifio »

Code: Select all

#!/bin/sh
P=`realpath $0`
cd ${P%/*}
#List=$(<Ubuntu-Precise-Main_Apps-DB.lst)  --- dont need anymore
#Groups=`echo "$List" |sed 's,^.*/ ,    <item>,;s, |.*$,</item>,'`  --- not work
#Groups=`tr -d | sed  -e i'<item>' -e a'</item>'   Ubuntu-Precise-Main_Apps-DB.lst ` --- works, but newline will screw up the item list
Groups=`cat Ubuntu-Precise-Main_Apps-DB.lst | awk '{print "<item>"$_"</item>"}'`
TITLE=' Ubuntu Package Builder.'
export UBU_GUI='
<window title="'$TITLE'">
<vbox>
<hbox>
  <list>
'$Groups'
    <variable>GROUP</variable>
    <width>400</width><height>200</height>
  </list>
</hbox>
<hbox>
  <button ok></button>
</hbox>
</vbox>
</window>
'
echo -e "$UBU_GUI" 
gtkdialog --program=UBU_GUI[quote][/quote]
In curiousity, why you dont use the input file directive ? or treeview widget instead ?
Feeling bored so here the treeview snippet, might want to repair the input file, cause I dont know the path and whats in it. This was generated using gmould of course (another shameless plug LOL )

Code: Select all

<tree icon-name="system-software-update">
	<variable>GROUP</variable>
	<label>Packages</label>
'$Groups'
	<width>200</width>
	<height>100</height>
	<input file>Ubuntu-Precise-Main_Apps-DB.lst</input>
<action>command:echo $GROUP</action>
</tree>
Anyway, I still dont understand the ROX thingy :). Using lxpup pcmanfm is good enough for me :)

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#894 Post by sunburnt »

Thanks afifio; A list was all that`s needed, but the tree ( grid ) may just be a better control.
I`ll give it a go starting with your code example.
The gui will have 3 "listboxes", 1 for each of Ubuntu`s package web pages.
1) App groups, 2) App packages, 3) App deps. And an EditBox for the App Description.
I`ve done this before, but GtkDialog keeps changing so it`s always a new learning experience.
Here`s one line from the Ubuntu Apps DB file.

Code: Select all

gnustep/ GNUstep | gnustep-dl2-postgresql-adaptor | gnustep-dl2-sqlite-adaptor | gorm.app | grr.app | systempreferences.app
Your line doesn`t need the redundant "cat". ( I read the whole file to a var. just once for reuse. )

Code: Select all

Groups=`awk '{print "<item>"$_"</item>"}' Ubuntu-Precise-Main_Apps-DB.lst`
### But as you can see in my post above, the output GtkDialog listbox code looks proper.
.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#895 Post by sunburnt »

### How to get GtkDialog`s current font.?

I have a "text-size" utility I made from vovchik`s BaCon code to get screen size of text.

I need to get GtkDialog`s current working font, with Bash code hopefully.
.

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

#896 Post by Moose On The Loose »

sunburnt wrote:### How to get GtkDialog`s current font.?

I have a "text-size" utility I made from vovchik`s BaCon code to get screen size of text.

I need to get GtkDialog`s current working font, with Bash code hopefully.
.
GTK2_RC_FILES tells you what to parse to find the font settings
It usually comes from the theme that gets included. In the theme, the default font is usually the only one set.



This is helpful to set the font:

Code: Select all


#########################################################################
#  I add to the GTK styles to control the style of some one the text
#
#   Make the warnings come up red by setting up a style in Gtk that has
#   the text as red
#
#   For the display of data files, I want a mono spaced font
#########################################################################
echo 'style "specialwarning"
  {  fg[NORMAL] = { 1.0, 0, 0 } }
  widget "*warning" style "specialwarning"
  class "GtkText*" style "specialwarning"
style "specialmono"
  {  font = "mono 12" }
  widget "*mono" style "specialmono"
  class "GtkText*" style "specialmono"' > /tmp/gtkrc_fft

#  This is where GTK looks
GTK2_RC_FILES=/tmp/gtkrc_fft:/root/.gtkrc-2.0
Use like this

Code: Select all

echo "<text name="mono" xalign="0" use-markup="true">"

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#897 Post by sunburnt »

Thanks Moose; Looking at it...
Puppy has no: /tmp/gtkrc_fft
And: /root/.gtkrc-2.0 is an empty file.

User avatar
koulaxizis
Posts: 452
Joined: Sun 17 Jul 2011, 18:43
Location: Greece
Contact:

#898 Post by koulaxizis »

Is it possible in a combobox when selecting an <item> to have a different action than reading the exact word written inside? For example: when selecting <item>hello</item>, the script will actually read/use <item>hello</item>. But i want to select <item>Greek</item> and use on the final output "el", not "Greek". I want to do that so i can change the ugly language shortcut code (eg "el) with the whole word (Greek) but on the final output it must be used the shortcut (el) for the command to work properly... I hope you understood what i mean, my English are not too good... :/

Here is the whole code to help you understand what i mean...

Code: Select all

#!/bin/sh

export TEXTDOMAIN=find-subtitles
export OUTPUT_CHARSET=UTF-8

: ${GTKDIALOG:=gtkdialog}

export MAIN_DIALOG="
<window title=\"$(gettext 'Find Subtitles')\" window_position=\"1\" icon-name=\"gtk-bold\">

<vbox>
<notebook labels=\"$(gettext 'OpenSubtitles')|$(gettext 'MySubtiles')|$(gettext 'Subs4movies')|$(gettext 'AllSubs')\">

<vbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
 <label>$(gettext 'Preferred interface')</label>
</text>
<hbox space-expand=\"true\" space-fill=\"true\"><text><label>\"\"</label></text></hbox>
<comboboxtext space-expand=\"false\" space-fill=\"false\" tooltip-text=\"$(gettext 'The language used to display search results and information')\">
<variable>COMBOBOX0</variable>
<item>el</item>
<item>ar</item>
<item>cs</item>
<item>et</item>
<item>fi</item>
<item>he</item>
<item>hu</item>
<item>it</item>
<item>km</item>
<item>ms</item>
<item>oc</item>
<item>pt</item>
<item>si</item>
<item>sq</item>
<item>th</item>
<item>uk</item>
<item>bg</item>
<item>da</item>
<item>en</item>
<item>eu</item>
<item>fr</item>
<item>hi</item>
<item>id</item>
<item>ja</item>
<item>ko</item>
<item>nl</item>
<item>pb</item>
<item>ro</item>
<item>sk</item>
<item>sr</item>
<item>tl</item>
<item>vi</item>
<item>ca</item>
<item>de</item>
<item>es</item>
<item>fa</item>
<item>gl</item>
<item>hr</item>
<item>is</item>
<item>ka</item>
<item>mk</item>
<item>no</item>
<item>pl</item>
<item>ru</item>
<item>sl</item>
<item>sv</item>
<item>tr</item>
<item>zh</item>
</comboboxtext>
</hbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
 <label>$(gettext 'Preferred language')</label>
</text>
<hbox space-expand=\"true\" space-fill=\"true\"><text><label>\"\"</label></text></hbox>
<comboboxtext space-expand=\"false\" space-fill=\"false\" tooltip-text=\"$(gettext 'The language the subtitles should be in')\">
<variable>COMBOBOX2</variable>
<item>all</item>
<item>ell</item>
<item>afr</item>
<item>alb</item>
<item>ara</item>
<item>arm</item>
<item>baq</item>
<item>ben</item>
<item>bos</item>
<item>bop</item>
<item>bre</item>
<item>bul</item>
<item>bur</item>
<item>cat</item>
<item>chi</item>
<item>hrv</item>
<item>cze</item>
<item>dan</item>
<item>dut</item>
<item>eng</item>
<item>epo</item>
<item>est</item>
<item>fin</item>
<item>fre</item>
<item>gig</item>
<item>geo</item>
<item>ger</item>
<item>heb</item>
<item>hin</item>
<item>hun</item>
<item>ice</item>
<item>ind</item>
<item>ita</item>
<item>jpn</item>
<item>kaz</item>
<item>khm</item>
<item>kor</item>
<item>lav</item>
<item>lit</item>
<item>ltz</item>
<item>mac</item>
<item>may</item>
<item>mal</item>
<item>mon</item>
<item>mne</item>
<item>nor</item>
<item>oci</item>
<item>per</item>
<item>pol</item>
<item>por</item>
<item>rum</item>
<item>rus</item>
<item>scc</item>
<item>sin</item>
<item>slo</item>
<item>slv</item>
<item>spa</item>
<item>swa</item>
<item>swe</item>
<item>syr</item>
<item>tgl</item>
<item>tam</item>
<item>tel</item>
<item>tha</item>
<item>tur</item>
<item>ukr</item>
<item>urd</item>
<item>vie</item>
</comboboxtext>
</hbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
 <label>$(gettext 'Series/movie title:')</label>
</text>
<entry tooltip-text=\"$(gettext 'Copy-paste the file name or type the title of the series/movie in this box')\" activates-default=\"true\" space-expand=\"true\">
<variable>ent1</variable>
</entry>
</hbox>
<hbox>
<button tooltip-text=\"$(gettext 'Get subtitles')\" can-default=\"true\" has-default=\"true\">
<input file icon=\"gtk-ok\"></input>
<label>$(gettext 'Search')</label>
<action>defaultbrowser \"http://www.opensubtitles.org/\$COMBOBOX0/search/sublanguageid-\$COMBOBOX2/moviename-\$ent1\" &</action>
<action>exit:EXIT</action>
</button>
<button tooltip-text=\"$(gettext 'Exit program')\">
<label>$(gettext 'Cancel')</label>
<input file stock=\"gtk-cancel\"></input>
<action>exit:ABORT</action>
</button>
</hbox>
</vbox>

<vbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
 <label>$(gettext 'Preferred interface')</label>
</text>
<hbox space-expand=\"true\" space-fill=\"true\"><text><label>\"\"</label></text></hbox>
<comboboxtext space-expand=\"false\" space-fill=\"false\" tooltip-text=\"$(gettext 'The language used to display search results and information')\">
<variable>COMBOBOX1</variable>
<item>en</item>
</comboboxtext>
</hbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
 <label>$(gettext 'Preferred language')</label>
</text>
<hbox space-expand=\"true\" space-fill=\"true\"><text><label>\"\"</label></text></hbox>
<comboboxtext space-expand=\"false\" space-fill=\"false\" tooltip-text=\"$(gettext 'The language the subtitles should be in')\">
<variable>COMBOBOX3</variable>
<item>all</item>
<item>en</item>
<item>sq</item>
<item>ar</item>
<item>hy</item>
<item>bg</item>
<item>zh</item>
<item>hr</item>
<item>cs</item>
<item>da</item>
<item>nl</item>
<item>et</item>
<item>fi</item>
<item>fr</item>
<item>ka</item>
<item>de</item>
<item>el</item>
<item>he</item>
<item>hi</item>
<item>hu</item>
<item>it</item>
<item>ja</item>
<item>ko</item>
<item>lv</item>
<item>lt</item>
<item>mk</item>
<item>no</item>
<item>pl</item>
<item>pt</item>
<item>br</item>
<item>ro</item>
<item>ru</item>
<item>sr</item>
<item>sk</item>
<item>sl</item>
<item>es</item>
<item>sv</item>
<item>tr</item>
<item>uk</item>
<item>ve</item>
</comboboxtext>
</hbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
 <label>$(gettext 'Series/movie title:')</label>
</text>
<entry tooltip-text=\"$(gettext 'Type the title of the series/movie in this box (do not copy-paste the file name)')\" activates-default=\"true\" space-expand=\"true\">
<variable>ent2</variable>
</entry>
</hbox>
<hbox>
<button tooltip-text=\"$(gettext 'Get subtitles')\" can-default=\"true\" has-default=\"true\">
<input file icon=\"gtk-ok\"></input>
<label>$(gettext 'Search')</label>
<action>defaultbrowser \"http://www.mysubtitles.com/subtitles/search/\$ent2/\$COMBOBOX3\" &</action>
<action>exit:EXIT</action>
</button>
<button tooltip-text=\"$(gettext 'Exit program')\">
<label>$(gettext 'Cancel')</label>
<input file stock=\"gtk-cancel\"></input>
<action>exit:ABORT</action>
</button>
</hbox>
</vbox>

<vbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
 <label>$(gettext 'Preferred interface')</label>
</text>
<hbox space-expand=\"true\" space-fill=\"true\"><text><label>\"\"</label></text></hbox>
<comboboxtext space-expand=\"false\" space-fill=\"false\" tooltip-text=\"$(gettext 'The language used to display search results and information')\">
<variable>COMBOBOX1</variable>
<item>en</item>
</comboboxtext>
</hbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
 <label>$(gettext 'Preferred language')</label>
</text>
<hbox space-expand=\"true\" space-fill=\"true\"><text><label>\"\"</label></text></hbox>
<comboboxtext space-expand=\"false\" space-fill=\"false\" tooltip-text=\"$(gettext 'The language the subtitles should be in')\">
<variable>COMBOBOX4</variable>
<item>Greek</item>
<item>English</item>
<item>Portuguese-BR</item>
<item>Polish</item>
<item>Romanian</item>
<item>Spanish</item>
<item>Portuguese</item>
<item>French</item>
<item>Turkish</item>
<item>Czech</item>
<item>Bulgarian</item>
<item>Hungarian</item>
<item>Hebrew</item>
<item>Dutch</item>
<item>Serbian</item>
<item>Italian</item>
<item>Finnish</item>
<item>Croatian</item>
<item>Arabic</item>
<item>Slovak</item>
<item>Slovenian</item>
<item>Russian</item>
<item>Swedish</item>
<item>Estonian</item>
<item>German</item>
<item>Bosnian</item>
<item>Danish</item>
<item>Indonesian</item>
<item>Norwegian</item>
<item>Farsi</item>
<item>Chinese</item>
<item>Albanian</item>
<item>Catalan</item>
<item>Vietnamese</item>
<item>Malay</item>
<item>Icelandic</item>
<item>Japanese</item>
<item>Lithuanian</item>
<item>Ukrainian</item>
<item>Korean</item>
<item>Fyrom</item>
<item>Brazilian</item>
<item>Esperanto</item>
<item>Galician</item>
<item>Basque</item>
<item>Latvian</item>
<item>Thai</item>
<item>Sinhalese</item>
<item>Georgian</item>
<item>Hindi</item>
</comboboxtext>
</hbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
 <label>$(gettext 'Series/movie title:')</label>
</text>
<entry tooltip-text=\"$(gettext 'Copy-paste the file name or type the title of the series/movie in this box')\" activates-default=\"true\" space-expand=\"true\">
<variable>ent3</variable>
</entry>
</hbox>
<hbox>
<button tooltip-text=\"$(gettext 'Get subtitles')\" can-default=\"true\" has-default=\"true\">
<input file icon=\"gtk-ok\"></input>
<label>$(gettext 'Search')</label>
<action>defaultbrowser \"http://www.subs4movies.com/search_results.php?qs=\$ent3&qs_lang=\$COMBOBOX4&x=0&y=0\" &</action>
<action>exit:EXIT</action>
</button>
<button tooltip-text=\"$(gettext 'Exit program')\">
<label>$(gettext 'Cancel')</label>
<input file stock=\"gtk-cancel\"></input>
<action>exit:ABORT</action>
</button>
</hbox>
</vbox>

<vbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
 <label>$(gettext 'Preferred interface')</label>
</text>
<hbox space-expand=\"true\" space-fill=\"true\"><text><label>\"\"</label></text></hbox>
<comboboxtext space-expand=\"false\" space-fill=\"false\" tooltip-text=\"$(gettext 'The language used to display search results and information')\">
<variable>COMBOBOX5</variable>
<item>en</item>
</comboboxtext>
</hbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
 <label>$(gettext 'Preferred language')</label>
</text>
<hbox space-expand=\"true\" space-fill=\"true\"><text><label>\"\"</label></text></hbox>
<comboboxtext space-expand=\"false\" space-fill=\"false\" tooltip-text=\"$(gettext 'The language the subtitles should be in')\">
<variable>COMBOBOX5</variable>
<item>en</item>
<item>sq</item>
<item>ar</item>
<item>hy</item>
<item>bg</item>
<item>zh</item>
<item>hr</item>
<item>cs</item>
<item>da</item>
<item>nl</item>
<item>et</item>
<item>fi</item>
<item>fr</item>
<item>ka</item>
<item>de</item>
<item>el</item>
<item>he</item>
<item>hi</item>
<item>hu</item>
<item>it</item>
<item>ja</item>
<item>ko</item>
<item>lv</item>
<item>lt</item>
<item>mk</item>
<item>no</item>
<item>pl</item>
<item>pt</item>
<item>br</item>
<item>ro</item>
<item>ru</item>
<item>sr</item>
<item>sk</item>
<item>sl</item>
<item>es</item>
<item>sv</item>
<item>tr</item>
<item>uk</item>
<item>ve</item>
</comboboxtext>
</hbox>
<hbox>
<text space-expand=\"false\" space-fill=\"false\">
 <label>$(gettext 'Series/movie title:')</label>
</text>
<entry tooltip-text=\"$(gettext 'Type the title of the series/movie in this box (do not copy-paste the file name)')\" activates-default=\"true\" space-expand=\"true\">
<variable>ent4</variable>
</entry>
</hbox>
<hbox>
<button tooltip-text=\"$(gettext 'Get subtitles')\" can-default=\"true\" has-default=\"true\">
<input file icon=\"gtk-ok\"></input>
<label>$(gettext 'Search')</label>
<action>defaultbrowser \"http://www.allsubs.org//search-subtitle/\$ent4+\$COMBOBOX5/50\" &</action>
<action>exit:EXIT</action>
</button>
<button tooltip-text=\"$(gettext 'Exit program')\">
<label>$(gettext 'Cancel')</label>
<input file stock=\"gtk-cancel\"></input>
<action>exit:ABORT</action>
</button>
</hbox>
</vbox>

</notebook>
</vbox>
</window>
"

$GTKDIALOG -p MAIN_DIALOG 
[b]Christos Koulaxizis[/b]
[i]Woof woof from Greece![/i]

[color=darkred][url=https://sourceforge.net/projects/puppystuff/][ Puppy Stuff Repository ][/url][/color]

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

gettext

#899 Post by don570 »

When I wrote the gettext version of Baconrecorder
I believe I wrote the combobox items with gettext translations.
You can open the script up and see.

Wave
MP3 stereo
MP3 Mono

or 'case' command could convert

Greek) LANGUAGE=el
;;
German) LANGUAGE=de
;;
esac
__________________________________________

Code: Select all

  case  $variable-name  in
                pattern1)       
     		    command1
                    ...
                    ....
                    commandN
                    ;;
                pattern2)
     		    command1
                    ...
                    ....
                    commandN
                    ;;            
                patternN)       
     		    command1
                    ...
                    ....
                    commandN
                    ;;
                *)              
          esac 

User avatar
koulaxizis
Posts: 452
Joined: Sun 17 Jul 2011, 18:43
Location: Greece
Contact:

Re: gettext

#900 Post by koulaxizis »

don570 wrote:When I wrote the gettext version of Baconrecorder
I believe I wrote the combobox items with gettext translations.
You can open the script up and see.

Wave
MP3 stereo
MP3 Mono

or 'case' command could convert

Greek) LANGUAGE=el
;;
German) LANGUAGE=de
;;
esac
__________________________________________

Code: Select all

  case  $variable-name  in
                pattern1)       
     		    command1
                    ...
                    ....
                    commandN
                    ;;
                pattern2)
     		    command1
                    ...
                    ....
                    commandN
                    ;;            
                patternN)       
     		    command1
                    ...
                    ....
                    commandN
                    ;;
                *)              
          esac 
I'll give it a try! Thank you! :)
[b]Christos Koulaxizis[/b]
[i]Woof woof from Greece![/i]

[color=darkred][url=https://sourceforge.net/projects/puppystuff/][ Puppy Stuff Repository ][/url][/color]

Post Reply