gmusicbrowser Forum

Main board => Questions => Topic started by: VastOne on January 27, 2012, 01:25:34

Title: Now in Git version - add hover_layout_pos option
Post by: VastOne on January 27, 2012, 01:25:34
Using the following as a guide and some discussion with squentin on the IRC, I have tweaked some of my desktop widgets to reflect the changes

Quoteadd hover_layout_pos option to control position of hover_layout popups

-each coordinate can be given using a sum of number of pixels or
proportion of the widget size (w), screen size (s), or popup size (p)
-the default reference point is the upper right of the widget, unless the
position is preceded with "abs:" in which case the reference point is 0,0
-if the position is only in w or s, a "smart alignment" of the popup is done:
the popup will be centered, or left aligned if on the left border (0w or 0s),
or right aligned if on the right border (1w or 1s)
examples :
".5w x w" : center bottom of widget, equivalent to ".5w-.5p x w-p"
"abs: .5s x 0" : center top of screen, equivalent to "abs: .5s-.5p x 0"
".5w x w-p-10" : 10 pixels above center bottom of widget
example of use :
Cover(hover_delay=1, hover_layout_pos=.5w x w, hover_layout=some_layout)

This code

[nowplaying_screenlet_vastone2]
Type=D
DefaultFont=8
Window        = size=240x240,transparent=1
VBmain= Artist(xalign=.5) Album(xalign=.5) Title(xalign=.5) HBTime _Cover(forceratio=1,hover_delay=1,hover_layout_pos=.5w x w,hover_layout=nowplaying_screenlet2_popup)
HBTime        = Length(markup="$length",initsize="XX:XX",xalign=0) _TimeBar(direct_mode=1) PlayingTime(markup="%s",initsize="XX:XX",xalign=1)


[nowplaying_screenlet2_popup]
Window = transparent=1
HBmain= 12Prev 12Play 12Next 12VolumeIcon 12BMSettings
BMSettings = (icon=gtk-preferences,size=menu) MainMenuItem PSortItem SMLibrary LayoutItem QueueItem PFilterItem SeparatorMenuItem01 MenuItem14(command=OpenPref,label=_"Settings",icon="gtk-preferences") MenuItem05(command=Quit,label=_"Quit",icon="gtk-quit")
SMLibrary = (label=_"Library") MenuItem00(command="RunPerlCode(::ChooseAddPath(0,1))",label=_"Add Music",icon="gtk-add") MenuItem32(command="RunPerlCode(::IdleScan)",label=_"Rescan Collection",icon="gtk-refresh")
VolumeScroll = VolumeIcon


Has the timer at the top and the pop ups at the bottom

(http://www.zimagez.com/miniature/screenshot-01262012-071300pm.php) (http://www.zimagez.com/zimage/screenshot-01262012-071300pm.php)

This one moves the time to the bottom and adjust the popup to go below the timebar


[nowplaying_screenlet2 VastOne Now]
Type=D
DefaultFont=8
Window = size=240x240,transparent=1
VBmain= Artist(xalign=.5) Album(xalign=.5) Title(xalign=.5) _Cover(forceratio=1,hover_delay=1,hover_layout_pos=  .5w x w-p+60,hover_layout=nowplaying_screenlet2_popup) _HBTime
HBTime = Length(markup="$length",initsize="XX:XX",xalign=0) _TimeSlider(direct_mode=1) PlayingTime(markup="%s",initsize="XX:XX",xalign=1)

[nowplaying_screenlet2_popup]
Window = transparent=1
HBmain= 12Prev 12Play 12Next 12VolumeIcon 12BMSettings
BMSettings = (icon=gtk-preferences,size=menu) MainMenuItem PSortItem SMLibrary LayoutItem QueueItem PFilterItem SeparatorMenuItem01 MenuItem14(command=OpenPref,label=_"Settings",icon="gtk-preferences") MenuItem05(command=Quit,label=_"Quit",icon="gtk-quit")
SMLibrary = (label=_"Library") MenuItem00(command="RunPerlCode(::ChooseAddPath(0,1))",label=_"Add Music",icon="gtk-add") MenuItem32(command="RunPerlCode(::IdleScan)",label=_"Rescan Collection",icon="gtk-refresh")
VolumeScroll = VolumeIcon


(http://www.zimagez.com/miniature/screenshot-01262012-071540pm.php) (http://www.zimagez.com/zimage/screenshot-01262012-071540pm.php)

Some notes from IRC

.5w x w-p-10 would move it up 10 pixels

.5w x w-p+35 would move it down 35 pixels

.5w x w+0 effectively disables the smart-align