Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 20 Oct 2014, 04:06
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Gtkdialog Development
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 27 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, ..., 25, 26, 27, 28, 29, ..., 53, 54, 55 Next
Author Message
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Mon 24 Oct 2011, 12:17    Post subject: Re: setting checkboxes from actions  

Hi Miriam

This is how you get data into a widget (many widgets support <input file> but the checkbox doesn't [yet] so we can use <input> instead):
Code:
#!/bin/sh

GTKDIALOG=gtkdialog

inputfile1=`mktemp`
inputfile2=`mktemp`
inputfile3=`mktemp`
inputfile4=`mktemp`

echo true > $inputfile1
echo false > $inputfile2
echo true > $inputfile3
echo false > $inputfile4

export MAIN_DIALOG='
<window title="Miriam - CheckBox Setting States" resizable="false">
   <vbox>
      <hbox>
         <frame Group 1>
            <checkbox>
               <variable>chkGroup1CheckBox1</variable>
               <label>CheckBox 1</label>
               <input>cat '$inputfile1'</input>
            </checkbox>
            <checkbox>
               <variable>chkGroup1CheckBox2</variable>
               <label>CheckBox 2</label>
               <input>cat '$inputfile2'</input>
            </checkbox>
            <checkbox>
               <variable>chkGroup1CheckBox3</variable>
               <label>CheckBox 3</label>
               <input>cat '$inputfile3'</input>
            </checkbox>
            <checkbox>
               <variable>chkGroup1CheckBox4</variable>
               <label>CheckBox 4</label>
               <input>cat '$inputfile4'</input>
            </checkbox>
            <hseparator></hseparator>
            <togglebutton>
               <variable>tgbGroup1</variable>
               <label>Toggle All</label>
               <action>echo $tgbGroup1 > '$inputfile1'</action>
               <action>echo $tgbGroup1 > '$inputfile2'</action>
               <action>echo $tgbGroup1 > '$inputfile3'</action>
               <action>echo $tgbGroup1 > '$inputfile4'</action>
               <action>refresh:chkGroup1CheckBox1</action>
               <action>refresh:chkGroup1CheckBox2</action>
               <action>refresh:chkGroup1CheckBox3</action>
               <action>refresh:chkGroup1CheckBox4</action>
            </togglebutton>
         </frame>
      </hbox>
      <hbox homogeneous="true">
         <button ok></button>
      </hbox>
   </vbox>
   <action signal="hide">exit:Exit</action>
</window>
'

$GTKDIALOG --program=MAIN_DIALOG

rm $inputfile1 $inputfile2 $inputfile3 $inputfile4

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3380
Location: Oregon

PostPosted: Mon 24 Oct 2011, 12:35    Post subject:  

BarryK wrote:
BarryK wrote:
zigbert,
Thanks for the feedback, but none of those suggestions fix it. They made no difference at all.

If anyone with more knowledge about gtkdialog would like to help me to fix this, here are some of the dialogs attached:


Ha ha, I just now reread what I posted, and it sure can be misunderstood! What I meant was:

If anyone with more knowledge about gtkdialog than me would like to help me to fix this, here are some of the dialogs attached

Anyway, thunor, thanks for the solution, greatly appreciated!


Barry, I just ran both scripts after adding enough to do that.
I made one change and the windows display correctly.
The drop down lists I did nothing with to reduce the height of them.
But for the windows, just add " resizable="false" to the window line like this:
<window title="Quick Setup" window_position="1" icon-name="gtk-preferences" resizable="false" >

That is if I read your post correctly.

One other thing and this is important.
The added line will not work with gtkdialog3!
But if you use thunor's gtkdialog rev8 release, it will.
So change gtkdialog3 to whatever you called thunor's release.

Sometimes, simple solutions pass us by.
Back to top
View user's profile Send private message 
miriam


Joined: 06 Dec 2006
Posts: 281
Location: Queensland, Australia

PostPosted: Mon 24 Oct 2011, 13:28    Post subject:  

Holy cow! Thanks Thunor! I have to admit I was really expecting you to reply with something like, "Sorry, not supported yet, so isn't possible."

I'm rapt! And thank you so much for the beautiful example. Smile

Ummm... I'm going to sound like I'm looking a gift-horse in the mouth here, but with all the wonderful work you've been doing on bringing gtkdialog back to life you might know if there is some way to use a monospaced font for the text in an edit pane. That would be extremely useful for a lot of data that uses character-spacing to output tables or ASCII-art.

And here is a really big ask: markup too? Like in some other parts of gtkdialog.

_________________
A life! Cool! Where can I download one of those from?
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Mon 24 Oct 2011, 19:01    Post subject:  

Hi Miriam

The edit widget doesn't support markup, but the text widget does. Anyway, you can use styles to change widgets like this (see here for a great theme tutorial):
Code:
#!/bin/sh

GTKDIALOG=gtkdialog

## Create a custom style.
funcgtkrcCreate() {
   echo '
style "styleGtkEditFontMonospace" {
   text[NORMAL] = "#ffffff"
   base[NORMAL] = "#000000"
   font_name = "monospace 16"
}
widget "*GtkEditFontMonospace" style "styleGtkEditFontMonospace"
' > $TEMP_DIR/gtkrc
   GTK2_RC_FILES=$TEMP_DIR/gtkrc:~/.gtkrc-2.0
}

## Create a temporary directory.
TEMP_DIR=$(mktemp -d)
if [ $? -ne 0 ]; then
   echo "Error: Couldn't create temporary directory."
   exit 1
fi

## Create a custom style.
funcgtkrcCreate
export GTK2_RC_FILES

## Create some ASCII art.
cat > $TEMP_DIR/asciiart <<EOF
Font: chunky
 _______ __   __       __ __         __             
|     __|  |_|  |--.--|  |__|.---.-.|  |.-----.-----.
|    |  |   _|    <|  _  |  ||  _  ||  ||  _  |  _  |
|_______|____|__|__|_____|__||___._||__||_____|___  |
                                              |_____|

Font: graffiti
  ________ __   __       .___.__       .__                 
 /  _____//  |_|  | __ __| _/|__|____  |  |   ____   ____ 
/   \  __\   __\  |/ // __ | |  \__  \ |  |  /  _ \ / ___\
\    \_\  \  | |    </ /_/ | |  |/ __ \|  |_(  <_> ) /_/  >
 \______  /__| |__|_ \____ | |__(____  /____/\____/\___  /
        \/          \/    \/         \/           /_____/ 

Font: rectangles
 _____ _   _     _ _     _         
|   __| |_| |_ _| |_|___| |___ ___
|  |  |  _| '_| . | | .'| | . | . |
|_____|_| |_,_|___|_|__,|_|___|_  |
                              |___|

http://www.network-science.de/ascii/
EOF

echo '
<window title="Miriam - Edit Font" resizable="false">
   <vbox>
      <edit name="GtkEditFontMonospace" editable="false">
         <width>600</width>
         <height>400</height>
         <input file>'$TEMP_DIR'/asciiart</input>
      </edit>
      <hbox homogeneous="true">
         <button ok></button>
      </hbox>
   </vbox>
   <action signal="hide">exit:Exit</action>
</window>
' > $TEMP_DIR/dialog_main

## Run the main application.
$GTKDIALOG -f $TEMP_DIR/dialog_main

## Remove the temporary files.
rm -rf $TEMP_DIR

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3380
Location: Oregon

PostPosted: Mon 24 Oct 2011, 19:14    Post subject:  

thunor,
In the scripts Barry provided, the size of the window is figured out now.
The dropdown in the quick-country-too-wide script is long.
But is there a way to limit the height of the item drop down selection popup window when the down arrow is clicked?
Try it and you will see what I mean.
Barry did not comment on that one, but if it was doable, it would help.
Back to top
View user's profile Send private message 
miriam


Joined: 06 Dec 2006
Posts: 281
Location: Queensland, Australia

PostPosted: Mon 24 Oct 2011, 20:55    Post subject:  

Wow!! Thanks again Thunor for a wonderful explanatory script.

I would never have thought of setting the GTK theme for the edit window. Now there's lateral thinking! This makes possible a small, but neat project that I'd all but given up on.

I'll post here when I have it working the way I want... although less than a week to NaNoWriMo... so if I don't get it done this week it won't happen 'til December.

With gratitude and best wishes,

Miriam

_________________
A life! Cool! Where can I download one of those from?
Back to top
View user's profile Send private message Visit poster's website 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sat 05 Nov 2011, 13:56    Post subject:
Subject description: Window and taskbar icon
 

Dear thunor,

Would it be possible to add the following:
Code:
gtk_window_set_icon_from_file(long,char*,void*)

to the window code so as to allow for user-defined pixmaps as window/taskbar icons? I have used that gtk call in progs in C and Bacon myself, so I know it is a cinch. All that is needed, apart from the imported function, is an appropriate tag_attr, which, along side the existing icon-name="gtk-xxxx" could be something like pixmap="path to img". Any thoughts?

With kind regards,
vovchik
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 1835
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Fri 11 Nov 2011, 07:02    Post subject:  

Hello,
Quote:
allow for user-defined pixmaps as window/taskbar icons
Not very important indeed, but I warmly subscribe to...

Cordialement.

_________________

Back to top
View user's profile Send private message Visit poster's website 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Fri 11 Nov 2011, 18:24    Post subject:  

thunor,
You are the only guy who can resolve this problem for us!

Racy 5.1.110 has /usr/sbin/quicksetup that has <comboboxtext> tags, with quite a lot of items. It also uses the <default> tag.
However, when we click on one of these comboboxes, the list pops up then immediately disappears. We have to click again, then it pops up and stays up. However, if we press the left mouse button and hold it down, the list stays up.
Note, the list is quite long, goes right from top to bottom of screen.

So, for Racy 5.2.1.90 I have changed to <combobox>, but that does not support <default> -- which is ok, I just put the default item first in the list.
However, after releasing latest Racy, testers have found that when a list is brought up, CPU usage becomes very high. On older CPUs, scrolling the list becomes extremely slow.

This morning I found a solution. I have gone back to <comboboxtext> but do not use the <default> tag. Now, do not get the double-popup problem. I have attached this latest script.

My question, are these two problems GTK problems, not specifically gtkdialog problems? in which case, nothing we can do. Or, can either of them be fixed in gtkdialog?
quicksetup.gz
Description 
gz

 Download 
Filename  quicksetup.gz 
Filesize  15.83 KB 
Downloaded  238 Time(s) 

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Sat 12 Nov 2011, 18:47    Post subject:  

A further note on extreme slowness with <combobox>. It is not a specifically gtkdialog4 problem, gtkdialog3 exhibits it also.

Wary and Racy testers have reported the problem with /usr/sbin/remove_builtin and /usr/sbin/bootmanager, that use gtkdialog3.

I just checked bootmanager with my fast laptop, chose to add a new module, the dropdown list is quite long, yes, unbearably slow. Even on my fast machine.

I do not recall this problem before. Perhaps it is a problem with gtk 2.45.x -- well, most likely it is.

However, we can have long lists in Xdialog (with gtk 2.45.x), and they are not slow, nor do they hog the CPU. So, that would indicate that there is something that gtkdialog is doing that is causing the problem.

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 7830
Location: qld

PostPosted: Sat 12 Nov 2011, 21:19    Post subject:  

hi Barry

I don't know that anything can be done with <combobox> as it was deprecated as of gtk+-2.4. See here .. Thunor states this on page 1 of this thread.

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 7047
Location: Perth, Western Australia

PostPosted: Sat 12 Nov 2011, 21:43    Post subject:  

01micko wrote:
hi Barry

I don't know that anything can be done with <combobox> as it was deprecated as of gtk+-2.4. See here .. Thunor states this on page 1 of this thread.


Oh, ok. I presume then that <comboboxtext> is using the new GtkComboBoxEntry functions.

Then we still need to tackle, if possible, the double-popup problem if use <default> tag with <comoboboxtext>.

Oh yes, I got it wrong with Xdialog in BootManager. The drop-down list to add a new module is slow, but it is using Xdialog. So the slowness of long lists in the dropdown box applies to Xdialog also.

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Mon 14 Nov 2011, 09:23    Post subject:  

Hi Barry

Sorry for the delay in replying as I'm busy looking for a new job and apartment which is consuming much of my time (and motivation) Confused

BarryK wrote:
...
Racy 5.1.110 has /usr/sbin/quicksetup that has <comboboxtext> tags, with quite a lot of items. It also uses the <default> tag.
However, when we click on one of these comboboxes, the list pops up then immediately disappears. We have to click again, then it pops up and stays up. However, if we press the left mouse button and hold it down, the list stays up.
Note, the list is quite long, goes right from top to bottom of screen.

I've just tried your attached application on my PIII 866MHz, lupu-520, GTK+ 2.20.0.

I ran it from the terminal and it took about 13 seconds for the application to appear.

A normal length click on the first comboboxtext (262 items) took 1.46s to appear the first time but after that 0.8s.
Positioning the mouse over the arrows top or bottom of the list so that it scrolls as fast as possible uses 35% CPU.

A normal length click on the second comboboxtext (234 items) took 1.41s to appear the first time but after that 0.8s.
Positioning the mouse over the arrows top or bottom of the list so that it scrolls as fast as possible uses 33% CPU.

A normal length click on the third comboboxtext (44 items) took 0.64s to appear the first time but after that it was too fast to measure.
List scrolling can't be measured as it's not long enough.

There's no CPU usage if the application is not interacted with.

I did not experience the list appearing and then disappearing.

Holding down the mouse button works the same way as it does in menus i.e. you hold it down whilst traversing the list and when you let go the list closes. It's clearer to see this if you use the comboboxtext_advanced example which is a lot faster.

Therefore for me it's working as expected.

BarryK wrote:
So, for Racy 5.2.1.90 I have changed to <combobox>, but that does not support <default> -- which is ok, I just put the default item first in the list.
However, after releasing latest Racy, testers have found that when a list is brought up, CPU usage becomes very high. On older CPUs, scrolling the list becomes extremely slow.

This morning I found a solution. I have gone back to <comboboxtext> but do not use the <default> tag. Now, do not get the double-popup problem. I have attached this latest script.

My question, are these two problems GTK problems, not specifically gtkdialog problems? in which case, nothing we can do. Or, can either of them be fixed in gtkdialog?

Using the comboboxtext_advanced example which includes the old combobox widget, the combobox gives me invalid "depressed" signal warnings and I have to fight for control of my window when manipulating the ones with tag attributes set, and as Mick has already indicated, GTK+ deprecated this a long time ago which equates to it not being maintained so that's why I'm not recommending it to Gtkdialog application developers.

The <default> directive: right at the start before the user sees the application window, the comboboxtext widget is initialised with data and then the contents of the default directive are used to select a matching item. That's it, an iteration through the list and then a change of the selected item. That code is then finished with, GTK+ shows the application and the user interacts with it.

BarryK wrote:
A further note on extreme slowness with <combobox>. It is not a specifically gtkdialog4 problem, gtkdialog3 exhibits it also.

Wary and Racy testers have reported the problem with /usr/sbin/remove_builtin and /usr/sbin/bootmanager, that use gtkdialog3.

I just checked bootmanager with my fast laptop, chose to add a new module, the dropdown list is quite long, yes, unbearably slow. Even on my fast machine.

I do not recall this problem before. Perhaps it is a problem with gtk 2.45.x -- well, most likely it is.

However, we can have long lists in Xdialog (with gtk 2.45.x), and they are not slow, nor do they hog the CPU. So, that would indicate that there is something that gtkdialog is doing that is causing the problem.

The fact that Xdialog's combobox (it looks like the old GtkComBox <combobox> widget) is faster is interesting.

I want to do some quick tests on my lupu-520 anyway, but if I was to try Racy then which is the recommended version?

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Mon 14 Nov 2011, 09:37    Post subject:  

BarryK wrote:
Oh, ok. I presume then that <comboboxtext> is using the new GtkComboBoxEntry functions.

Then we still need to tackle, if possible, the double-popup problem if use <default> tag with <comoboboxtext>.

Oh yes, I got it wrong with Xdialog in BootManager. The drop-down list to add a new module is slow, but it is using Xdialog. So the slowness of long lists in the dropdown box applies to Xdialog also.

I've had a look on your blog and from what you've said here sounds like a GTK+ problem. I'd like to be able to experience these problems though so just post a link to a Racy ISO.

Is there another GTK+ non-Gtkdialog application that has a comboboxtext widget with lots of items that can be tested for comparison?

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
thunor


Joined: 14 Oct 2010
Posts: 350
Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings

PostPosted: Mon 14 Nov 2011, 12:15    Post subject:  

Your application wrote /var/local/quicksetup-timezone-table-x which is a list of 234 items so I'm loading that and multiples of that into a single 202px wide comboboxtext with a default "US/Samoa "." off" as a test.

On lupu-520, PIII 866MHz, GTK+ 2.20.0:

234 items in one comboboxtext:
App load time: 1.07s
comboboxtext list initial show time: 0.50s
comboboxtext list subsequent show time: 0.30s
CPU usage when scrolling: 32%

234x2 items in one comboboxtext:
App load time: 2.10s
comboboxtext list initial show time: 1.17s
comboboxtext list subsequent show time: 0.55s
CPU usage when scrolling: 52%

234x3 items in one comboboxtext:
App load time: 3.28s
comboboxtext list initial show time: 2.16s
comboboxtext list subsequent show time: 0.76s
CPU usage when scrolling: 60% to 70% but it gets erratic

234x4 items in one comboboxtext:
App load time: 4.58s
comboboxtext list initial show time: 3.21s
comboboxtext list subsequent show time: 1.19s
CPU usage when scrolling: 60% to 70% but it gets erratic
...
234x10 items in one comboboxtext:
App load time: 16.82s
comboboxtext list initial show time: 15.35s
comboboxtext list subsequent show time: 2.62s
CPU usage when scrolling: 60% to 70% but it gets erratic

This is my test app which uses a copy of /var/local/quicksetup-timezone-table-x as /tmp/test and just keep editing it and multiplying its contents:
Code:
#!/bin/sh

GTKDIALOG=gtkdialog

## Create a temporary directory.
TEMP_DIR=$(mktemp -d)
if [ $? -ne 0 ]; then
   echo "Error: Couldn't create temporary directory."
   exit 1
fi

echo '
<window title="BarryK - comboboxtext speed issues" resizable="false">
   <vbox>
      <comboboxtext width-request="202">
         <default>US/Samoa "." off</default>
         <input file>/tmp/test</input>
      </comboboxtext>
      <hbox homogeneous="true">
         <button ok></button>
      </hbox>
   </vbox>
   <action signal="hide">exit:Exit</action>
</window>
' > $TEMP_DIR/dialog_main

## Run the main application.
$GTKDIALOG -f $TEMP_DIR/dialog_main

## Remove the temporary files.
rm -rf $TEMP_DIR

Regards,
Thunor
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 27 of 55 [821 Posts]   Goto page: Previous 1, 2, 3, ..., 25, 26, 27, 28, 29, ..., 53, 54, 55 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1542s ][ Queries: 13 (0.0199s) ][ GZIP on ]