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 Thu 18 Dec 2014, 07:30
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to put color in GTKDIALOG
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Author Message
don570


Joined: 10 Mar 2010
Posts: 3435
Location: Ontario

PostPosted: Mon 23 Jan 2012, 15:22    Post_subject:  How to put color in GTKDIALOG  

I have put together two scripts , one for gtkdialog3 and
the other for the newer gtkdialog4 to show how easy it is
to put some color in message windows.

Code:
#!/bin/sh


export VERSION=3.1


export MAIN_DIALOG='<window title="Examples" icon-name="gtk-info" resizable="false">

<hbox>
   

<frame>
   <vbox>
   <text width-request="100"><label>First Frame</label></text>
      <text use-markup="true"><label>"<b><u><span size='"'large'"'>Pup</span><span size='"'large'"' color='"'blue'"'>Shutdown</span> 1.6</u></b>"</label></text>
  <text use-markup="true"><label>"<b><span size='"'large'"'  color='"'blue'"'>Pup</span><span size='"'large'"' color='"'red'"'>Shutdown</span> '$VERSION'</b>"</label></text>
  <text use-markup="true"><label>"<b><span size='"'large'"' color='"'red'"'>Shutdown</span>   '$VERSION'</b>    text"</label></text>
  <text use-markup="true"><label>"<u><span size='"'large'"' color='"'red'"'>Shutdown</span></u>"</label></text>

   
   </vbox>
</frame>
    <frame>
   <vbox>
   <text width-request="50"><label>Second Frame</label></text>
      <text use-markup="true"><label>"<b><span size='"'large'"'>Pup</span><span size='"'large'"' color='"'blue'"'>Shutdown</span> 1.6</b>"</label></text>
  <text use-markup="true"><label>"<b><span size='"'large'"'  color='"'blue'"'>Pup</span><span size='"'large'"' color='"'red'"'>Shutdown</span> '$VERSION'</b>"</label></text>
  <text use-markup="true"><label>"<b><span size='"'large'"' color='"'red'"'>Shutdown</span>   '$VERSION'</b>    text"</label></text>

 <hbox>
  <text space-expand="false"  use-markup="true"><label>"<u><span size='"'large'"' color='"'red'"'>Shutdown</span></u>"</label></text>   
  <text space-expand="true" space-fill="true">
            <label>""</label>
  </text>
 </hbox>

<hbox>
       <button help></button>
         
</hbox>
 
   </vbox>
</frame>
   
<vbox>
 
     <hbox>
   <vbox>
   <text height-request="110"><label> </label></text>
    <hbox><button ok></button>
    </hbox>
   
     
   </vbox>

   </hbox>
 
   </vbox>   
</hbox>

</window>
'

gtkdialog --program=MAIN_DIALOG



Some notes:
Both bold and underlining is possible simultaneously
Code:
[b][u]....text.....[/u][/b]


Note the method I used to place 'Shutdown' to left of hbox



A color can be a hex number instead.
You can use mtpaint to get the hex number.
The dropper can be used anywhere on
your computer screen to find the appropriate color.



____________________________________________________

Edited_times_total
Back to top
View user's profile Send_private_message 
technosaurus


Joined: 18 May 2008
Posts: 4423

PostPosted: Mon 23 Jan 2012, 15:59    Post_subject:  

Somewhere in the gtkdialog tips thread is an example I posted that shows all named colors from rgb.txt. (red, blue, black ...) Those are supported too, also included a tool to auto-generate a 1x1 xpm that easily can be scaled.
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send_private_message 
don570


Joined: 10 Mar 2010
Posts: 3435
Location: Ontario

PostPosted: Mon 23 Jan 2012, 16:11    Post_subject:  

When you have the time could you track down the pages.??


_____________________________________________________

Edited_time_total
Back to top
View user's profile Send_private_message 
vovchik


Joined: 23 Oct 2006
Posts: 1287
Location: Ukraine

PostPosted: Mon 23 Jan 2012, 16:38    Post_subject:  

Dear guys,

I did a markup editor once and it is here: http://murga-linux.com/puppy/viewtopic.php?mode=attach&id=30359. I also have a simpler markup editor somewhere else on the forum.

With kind regards,
vovchik
Back to top
View user's profile Send_private_message 
darkcity


Joined: 23 May 2010
Posts: 2481
Location: near here

PostPosted: Thu 02 Aug 2012, 09:17    Post_subject:  

don570 wrote:
When you have the time could you track down the pages.??


color thing is here-
http://www.murga-linux.com/puppy/viewtopic.php?p=559741#559741

rgb file on pup5 is at
/usr/share/X11/rgb.txt

any examples of scripts using this?

_________________
helping Wiki for help | IF SendSpace link = "dead" THEN PM me ("up file to http://meownplanet.net/")
Back to top
View user's profile Send_private_message Visit_website 
don570


Joined: 10 Mar 2010
Posts: 3435
Location: Ontario

PostPosted: Thu 02 Aug 2012, 18:32    Post_subject:  

puppy backup ---> I put in colored word in front window
bacon recorder --> I put in a info message in color

Radky's apps are the best when it comes to color
see pupshutdown
http://www.murga-linux.com/puppy/viewtopic.php?t=56077
______________________________________________

.
Back to top
View user's profile Send_private_message 
darkcity


Joined: 23 May 2010
Posts: 2481
Location: near here

PostPosted: Sun 05 Aug 2012, 15:34    Post_subject:  

Thanks, this method seems a bit 'clunky' - and I keep messing up the syntax. Embarassed

I want to make different colored buttons, perhaps a different method using sprites would be easier?

_________________
helping Wiki for help | IF SendSpace link = "dead" THEN PM me ("up file to http://meownplanet.net/")
Back to top
View user's profile Send_private_message Visit_website 
don570


Joined: 10 Mar 2010
Posts: 3435
Location: Ontario

PostPosted: Tue 07 Aug 2012, 17:08    Post_subject:  

Zigbert is experimenting with SVG
in pfind using a technique he learned from Technosaurus
but it's a little too difficult for me to understand Crying or Very sad .
http://murga-linux.com/puppy/viewtopic.php?t=76431

In bacon recorder I have an animated gif icon that can be clicked on
to launch an app. I made it with mtpaint.

So if you're looking for a fancy button that's the way to go.
___________________________________________
Back to top
View user's profile Send_private_message 
darkcity


Joined: 23 May 2010
Posts: 2481
Location: near here

PostPosted: Tue 07 Aug 2012, 18:22    Post_subject:  

sweet, svg files can be used as input ; -) eg

Code:

      <button relief="2"   tooltip-text="pup">
        <input file>'/usr/share/images/sm.svg'</input>
        <action>echo monkey</action>
      </button>


thanks Twisted Evil Twisted Evil

_________________
helping Wiki for help | IF SendSpace link = "dead" THEN PM me ("up file to http://meownplanet.net/")
Back to top
View user's profile Send_private_message Visit_website 
don570


Joined: 10 Mar 2010
Posts: 3435
Location: Ontario

PostPosted: Tue 07 Aug 2012, 18:33    Post_subject:  

I think Technosaurus method can control the
individual elements of the image such as straight lines,
arcs, circles etc. Zigbert can then define
things like color opacity size. I wish I knew more Crying or Very sad

_________________________________________________
Back to top
View user's profile Send_private_message 
technosaurus


Joined: 18 May 2008
Posts: 4423

PostPosted: Tue 07 Aug 2012, 22:43    Post_subject:  

Svg is very similar to html, only for images. I usually just Google svg + whatever and if it is possible, something will come up on stackoverflow, or even a full tutorial. I posted a bunch of svg line drawings in the simple icon tray thread that could be used and tweaked in inkscapelite (i usually manually adjust inkscape's code for size/readability ... SVG is supposed to be human readable)
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send_private_message 
darkcity


Joined: 23 May 2010
Posts: 2481
Location: near here

PostPosted: Wed 08 Aug 2012, 10:49    Post_subject:  

great stuff, gtkdialogue seems to need over complex syntax, but I will fight on ; -)
Back to top
View user's profile Send_private_message Visit_website 
don570


Joined: 10 Mar 2010
Posts: 3435
Location: Ontario

PostPosted: Tue 14 Oct 2014, 20:08    Post_subject:  

It is possible to change colors according to darkness of theme.
For example here I have modified parchive 1.0 by Radky

For a dark theme I changed the color automatically from blue to orange.
ie 3272C0 to FFD900


At the beginning of script I define the color ---> variable COLOUR.
I check for some common dark theme names and change the color to orange
if a dark theme name is found.


Code:

export COLOUR=3272C0
#  check for dark gtk themes and change  COLOUR
if [ "`cat /root/.gtkrc-2.0 | grep  "Stardust_dark_mouse"`" ]; then
 COLOUR=FFD900
elif [ "`cat /root/.gtkrc-2.0 | grep  "Stardust_dark_touch"`" ]; then
 COLOUR=FFD900
 elif [ "`cat /root/.gtkrc-2.0 | grep  "Azenis"`" ]; then
 COLOUR=FFD900
 elif [ "`cat /root/.gtkrc-2.0 | grep  "TerraNova-Aquarius"`" ]; then
 COLOUR=FFD900
 elif [ "`cat /root/.gtkrc-2.0 | grep  "terminus"`" ]; then
 COLOUR=FFD900
 elif [ "`cat /root/.gtkrc-2.0 | grep  "Murrina-Black"`" ]; then
 COLOUR=FFD900
 elif [ "`cat /root/.gtkrc-2.0 | grep  "DarkRoomCompact"`" ]; then
 COLOUR=FFD900
 elif [ "`cat /root/.gtkrc-2.0 | grep  "PenOSmaster"`" ]; then
 COLOUR=FFD900
 fi


Note that a check has been made of the invisible file /root/.gtkrc-2.0
which records the theme name...

Code:

# -- THEME AUTO-WRITTEN DO NOT EDIT
include "/usr/share/themes/Stardust_dark_mouse/gtk-2.0/gtkrc"

include "/root/.gtkrc.mine"

# -- THEME AUTO-WRITTEN DO NOT EDIT
gtk-theme-name="Stardust_dark_mouse"




Then when the window is formed on the computer screen the substitution
is made...

Code:
<text use-markup=\"true\"><label>\"<b><span size='"'x-large'"'>p</span><span size='"'x-large'"' color='"'#'$COLOUR''"'>Archive</span></b>\"</label></text>






Back to top
View user's profile Send_private_message 
zigbert


Joined: 29 Mar 2006
Posts: 5811
Location: Valåmoen, Norway

PostPosted: Wed 15 Oct 2014, 02:12    Post_subject:  

Quote:
It is possible to change colors according to darkness of theme.
For example here I have modified parchive 1.0 by Radky

Thumbs up!

To generalize the coding, I grab the active colors from /usr/lib/gtkdialog/svg_bar.


Sigmund

_________________
Stardust resources
Back to top
View user's profile Send_private_message Visit_website 
radky

Joined: 02 May 2010
Posts: 469

PostPosted: Wed 15 Oct 2014, 12:36    Post_subject:  

removed
Edited_times_total
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0963s ][ Queries: 11 (0.0047s) ][ GZIP on ]