reload fonts

15 views
Skip to first unread message

rogerdpack

unread,
Oct 13, 2009, 5:14:31 PM10/13/09
to Arcadia ruby ide
Hi Antonio.
I want to do something so that I can edit preferences and have it "re
display" using the new fonts that I have specified in the preferences
file.
I can get it to reload the preferences file, but cannot get it to
redisplay changed fonts right.

Any pointers there?
-r

antonio.galeone

unread,
Oct 13, 2009, 5:58:42 PM10/13/09
to Arcadia ruby ide
Must be done.
An idea can 'be: when one uses a property it is registered as a
listener,
so when the property is changed you can' change the reality property
of the registered widgets.

angal

Roger Pack

unread,
Oct 13, 2009, 6:13:37 PM10/13/09
to arcadia-...@googlegroups.com
> Must be done.
> An idea can 'be: when one uses a property it is registered as a
> listener,
> so when the property is changed you can' change the reality property
> of the registered widgets.

I guess my difficulty is in getting the fonts to reload *at all* :)
-r

Antonio Galeone

unread,
Oct 13, 2009, 6:36:08 PM10/13/09
to arcadia-...@googlegroups.com
My idea can be like this:

now we have :

    label = TkLabel.new(self){
      text  'Arcadia'
      font  conf('font')      [or  Arcadia.conf('font')]
      place('width' => '190','x' => 110,'y' => 10,'height' => 25)
    }

if we create a new method:

def conf(_property, _change_callback_proc)
   ...
   @hash_property_callbacks[_property] << _change_callback_proc
   ...
end

we rewriete :

    label = TkLabel.new(self){
      text  'Arcadia'
      font  conf('font', proc{|new_value| self.configure('font'=> new_value)})
      place('width' => '190','x' => 110,'y' => 10,'height' => 25)
    }

when you edit properties file  throws a wizard then use

@hash_property_callbacks[_property].each{|cb|
    cb.call(new_value)
}


2009/10/14 Roger Pack <roger...@gmail.com>

Roger Pack

unread,
Oct 13, 2009, 10:52:57 PM10/13/09
to arcadia-...@googlegroups.com
>    @hash_property_callbacks[_property] << _change_callback_proc

Another option would be to just require each plugin that *can* reload
to listen for a ReloadExtensionEvent
then they would each reload themselves separately, I suppose...
-r

antonio.galeone

unread,
Oct 14, 2009, 4:29:28 AM10/14/09
to Arcadia ruby ide
Nice, I like this solution.
Reply all
Reply to author
Forward
0 new messages