[Dextrose] [PATCH][Flipsticks]Avoiding module name error on Dextrose builds

Anish Mangal anish at sugarlabs.org
Thu Feb 2 06:45:40 EST 2012


While we're doing this, can we also fix a number of pep8 style errors
;-). There are a number of them on a brief glance of the code.

On Wed, Feb 1, 2012 at 21:17, Rafael Ortiz <rafael at activitycentral.com> wrote:
> This patch permits flipsticks to init on dextrose builds, fixing a module name exception
>
> Signed-off-by: Rafael Ortiz <rafael at activitycentral.com>
> ---
>  montage.py    |    4 +-
>  screen.py     |   68 ---------------------------------------------------------
>  screenflip.py |   68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 70 insertions(+), 70 deletions(-)
>  delete mode 100644 screen.py
>  create mode 100644 screenflip.py
>
> diff --git a/montage.py b/montage.py
> index 11e5f3f..553c8b3 100644
> --- a/montage.py
> +++ b/montage.py
> @@ -28,7 +28,7 @@ from gettext import gettext as _
>  from sugar.activity.activity import get_bundle_path
>
>  import model
> -import screen
> +import screenflip
>  import kinematic
>  import theme
>  from theme import *
> @@ -590,7 +590,7 @@ class View(gtk.EventBox):
>         for i in range(len(model.keys)):
>             self.keys_overlap_stack.append(i)
>
> -        self.key = screen.ScreenFrame()
> +        self.key = screenflip.ScreenFrame()
>
>         self.kfselected = 0
>         self.jointpressed = None
> diff --git a/screen.py b/screen.py
> deleted file mode 100644
> index bd31199..0000000
> --- a/screen.py
> +++ /dev/null
> @@ -1,68 +0,0 @@
> -# This program is free software; you can redistribute it and/or modify
> -# it under the terms of the GNU General Public License as published by
> -# the Free Software Foundation; either version 2 of the License, or
> -# (at your option) any later version.
> -#
> -# This program is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with this program; if not, write to the Free Software
> -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> -
> -import theme
> -import model
> -
> -class ScreenFrame(model.KeyFrame):
> -    def __init__(self):
> -        self.reset()
> -
> -    def setjoints(self):
> -        self._setjoints(self.joints, self.sticks, self.middle)
> -
> -    def reset(self):
> -        self.parts = theme.PARTS.copy()
> -        self.sticks = theme.STICKS.copy()
> -        self.joints = self._initjoints()
> -        self.middle = (theme.DRAWWIDTH/2, theme.DRAWHEIGHT/3)
> -        self.setjoints()
> -
> -    def assign(self, x):
> -        self.middle = x.middle
> -        self.parts = x.parts.copy()
> -        self.sticks = x.sticks.copy()
> -        self.joints = x.joints.copy()
> -        self.setjoints()
> -
> -    def getrotatepoint(self):
> -        (angle,len) = self.sticks['TORSO']
> -        x,y = self.middle
> -        (rx,ry) = self._getpoints(x,y,angle,int(len/2.0))
> -        return (rx,ry)
> -
> -    def inrotate(self, x, y):
> -        rx, ry = self.getrotatepoint()
> -        if (abs(rx-x) <= 5) and (abs(ry-y) <= 5):
> -            return True
> -        return False
> -
> -    def injoint(self, x, y):
> -        for jname in self.joints:
> -            jx, jy = self.joints[jname]
> -            if (abs(jx-x) <= 5) and (abs(jy-y) <= 5):
> -                return jname
> -        return False
> -
> -    def inmiddle(self, x, y):
> -        mx, my = self.middle
> -        if (abs(mx-x) <= 5) and (abs(my-y) <= 5):
> -            return True
> -        return False
> -
> -    def move(self, dx, dy):
> -        if self.joints:
> -            for jname in self.joints:
> -                (jx, jy) = self.joints[jname]
> -                self.joints[jname] = (jx+dx, jy+dy)
> diff --git a/screenflip.py b/screenflip.py
> new file mode 100644
> index 0000000..bd31199
> --- /dev/null
> +++ b/screenflip.py
> @@ -0,0 +1,68 @@
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +
> +import theme
> +import model
> +
> +class ScreenFrame(model.KeyFrame):
> +    def __init__(self):
> +        self.reset()
> +
> +    def setjoints(self):
> +        self._setjoints(self.joints, self.sticks, self.middle)
> +
> +    def reset(self):
> +        self.parts = theme.PARTS.copy()
> +        self.sticks = theme.STICKS.copy()
> +        self.joints = self._initjoints()
> +        self.middle = (theme.DRAWWIDTH/2, theme.DRAWHEIGHT/3)
> +        self.setjoints()
> +
> +    def assign(self, x):
> +        self.middle = x.middle
> +        self.parts = x.parts.copy()
> +        self.sticks = x.sticks.copy()
> +        self.joints = x.joints.copy()
> +        self.setjoints()
> +
> +    def getrotatepoint(self):
> +        (angle,len) = self.sticks['TORSO']
> +        x,y = self.middle
> +        (rx,ry) = self._getpoints(x,y,angle,int(len/2.0))
> +        return (rx,ry)
> +
> +    def inrotate(self, x, y):
> +        rx, ry = self.getrotatepoint()
> +        if (abs(rx-x) <= 5) and (abs(ry-y) <= 5):
> +            return True
> +        return False
> +
> +    def injoint(self, x, y):
> +        for jname in self.joints:
> +            jx, jy = self.joints[jname]
> +            if (abs(jx-x) <= 5) and (abs(jy-y) <= 5):
> +                return jname
> +        return False
> +
> +    def inmiddle(self, x, y):
> +        mx, my = self.middle
> +        if (abs(mx-x) <= 5) and (abs(my-y) <= 5):
> +            return True
> +        return False
> +
> +    def move(self, dx, dy):
> +        if self.joints:
> +            for jname in self.joints:
> +                (jx, jy) = self.joints[jname]
> +                self.joints[jname] = (jx+dx, jy+dy)
> --
> 1.7.5.4
>
> _______________________________________________
> Dextrose mailing list
> Dextrose at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/dextrose



-- 
Anish | anish at sugarlabs.org


More information about the Dextrose mailing list