Hi guys,

Forwarding my answer to Mohamed here :)

First of all I am no expert in UI mirroring. What you did in the piece
of code you sent looks find from a widget point of view. The remaining
question in my view is what the best place to store that parameter
(isRTL) is. My feeling is that it could be an option of the
PigmentFrontend.
What do you think of that?

Florian

Le mardi 03 juin 2008 à 13:05 +0300, Mohamed Imam a écrit :
> Hi All, 
> 
> Please let me share with you a UI requirement that is needed for RTL -
> Right to Left -  interfaces such as Arabic, Hebrew. 
> 
> This requirement is mirroring the user interface controls. 
> 
> For English interface the controls are laid out left to right while
> for RTL interface they are laid out right to left.
> 
> The following article explains the mirroring concept 
> http://www.microsoft.com/globaldev/getwr/steps/WRG_mirror.mspx 
> 
> In Elisa 0.3.5 I have implemented a limited version in some UI
> controls
> 
> A simple equation is used
> 
> Given a widget has x,y 
> Then the mirrored widget x = mx
> 
> mx = parentWidth - x - widgetWidth
> y is the same
> 
> To optimize the RTL support I have created a global application
> variable that I check during UI creation/relayout. Using a function
> named isRTL() 
> 
> 
> Sample change in context_bar.py 
> 
> def compute_layout(self):
>         if not self.parent:
>             return
>         p = 1
>         margin = self.icon_margin * self.parent.height
>         right_margin = self.right_margin * self.parent.height
>         index = 0
>         for i in reversed(self.children):
>             i.size = (self.parent.height - margin*2,
> self.parent.height - margin * 2)
>             x = self.parent.width - i.width * p - margin * (p-1) -
> right_margin
>             i.x = x
>             
>             #Added for RTL Support
>             if isRTL():
>                 i.x = self.parent.width - x - i.width
>             
>             i.y += margin
>             p += 1
>             if self._current_index > -1 and index ==
> self._current_index:
>                 i.opacity = 255
>             else:
>                 i.opacity = self.unselected_opacity
>             index += 1
> 
> 
> def isRTL():
>     return rtl_global
> 
> 
> I wonder if you have any ideas or suggestions on implementing this
> into the new Elisa 0.5.0 to support RTL/LTR interfaces  
> 
> 
> Best regards,
> Mohamed Imam
> 

Reply via email to