Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/moon.py
diff options
context:
space:
mode:
authorKshitij Kumar <kshitijakumar@gmail.com>2013-01-11 05:39:18 (GMT)
committer Kshitij Kumar <kshitijakumar@gmail.com>2013-01-11 05:39:18 (GMT)
commitf416a2aaaebe3971cf9a1a07dd6b61a0966a2df6 (patch)
treeada28b9cc7eb7bd2bb36c45ce0ea3e9ed52cfab1 /moon.py
parent79eb8f07253dc0159042fafd3c04a64460183e97 (diff)
more PyGI changes
Diffstat (limited to 'moon.py')
-rwxr-xr-xmoon.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/moon.py b/moon.py
index 3949bd5..4b83ca6 100755
--- a/moon.py
+++ b/moon.py
@@ -142,14 +142,14 @@ class MoonActivity(activity.Activity):
self.blue_green_mask_alloc_color = Gdk.Color.alloc_color('#F00')
self.red_alloc_color = Gdk.Color.alloc_color('#F20')
self.blue_alloc_color = Gdk.Color.alloc_color('#04F')
- self.moon_stamp = Gdk.pixbuf_new_from_file("moon.jpg")
+ self.moon_stamp = GdkPixbuf.Pixbuf.new_from_file("moon.jpg")
self.image_size_cache = -1
# Build main layout manually for the first pass
self.build_main_layout_cb()
# Watch for signal that the screen changed size (landscape vs. portrait)
- Gdk.screen_get_default().connect('size-changed', self.build_main_layout_cb)
+ Gdk.Screen.get_default().connect('size-changed', self.build_main_layout_cb)
def build_main_layout_cb(self, widget=None, data=None):
"""Create main layout respecting landscape or portrait orientation.
@@ -163,33 +163,33 @@ class MoonActivity(activity.Activity):
if self.is_landscape_orientation():
self.main_view = Gtk.HBox()
self.info_panel = Gtk.VBox()
- self.event_box.set_size_request(int(Gdk.screen_width() / 1.70), -1)
+ self.event_box.set_size_request(int(Gdk.Screen.width() / 1.70), -1)
self.main_view.pack_end(self.event_box, False)
self.main_view.pack_start(info_scroll, True)
else:
self.main_view = Gtk.VBox()
self.info_panel = Gtk.HBox()
- self.event_box.set_size_request(-1, int(Gdk.screen_height() / 1.60))
+ self.event_box.set_size_request(-1, int(Gdk.Screen.height() / 1.60))
self.main_view.pack_start(self.event_box, False)
self.main_view.pack_start(info_scroll, True)
# Create the Moon image widget
self.image = Gtk.Image()
self.event_box.add(self.image)
- self.event_box.modify_bg(Gtk.STATE_NORMAL, self.black_alloc_color)
+ self.event_box.modify_bg(Gtk.StateType.NORMAL, self.black_alloc_color)
self.event_box.connect('size-allocate', self._moon_size_allocate_cb)
# Create scrolling Moon information panel
- info_scroll.set_policy(Gtk.POLICY_NEVER, Gtk.POLICY_AUTOMATIC)
+ info_scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
info_scroll.set_size_request(-1, -1)
self.info_panel.set_border_width(10)
self.info = Gtk.Label()
- self.info.set_justify(Gtk.JUSTIFY_LEFT)
+ self.info.set_justify(Gtk.Justification.LEFT)
self.info.set_alignment(0.0, 0.0)
self.info_panel.pack_start(self.info, False)
self.info2 = Gtk.Label()
- self.info2.set_justify(Gtk.JUSTIFY_LEFT)
+ self.info2.set_justify(Gtk.Justification.LEFT)
self.info2.set_alignment(0.0, 0.0)
self.info_panel.pack_start(self.info2, True, True, 10)
info_scroll.add_with_viewport(self.info_panel)
@@ -213,7 +213,7 @@ class MoonActivity(activity.Activity):
def is_landscape_orientation(self):
"""Return True of in landscape, False for portrait orientation.
"""
- if Gdk.screen_width() > Gdk.screen_height():
+ if Gdk.Screen.width() > Gdk.Screen.height():
return True
return False
@@ -345,14 +345,14 @@ class MoonActivity(activity.Activity):
# Modified image based on public domain photo by John MacCooey
moon_pixbuf = self.moon_stamp.scale_simple(IMAGE_SIZE, IMAGE_SIZE,
- Gdk.INTERP_BILINEAR)
+ GdkPixbuf.InterpType.BILINEAR)
# Composite bright Moon image and semi-transparant Moon for shadow detail
- dark_pixbuf = Gdk.Pixbuf(Gdk.COLORSPACE_RGB, True, 8, IMAGE_SIZE, IMAGE_SIZE)
+ dark_pixbuf = GdkPixbuf.Pixbuf(GdkPixbuf.Colorspace.RGB, True, 8, IMAGE_SIZE, IMAGE_SIZE)
dark_pixbuf.fill(0x00000000)
if (self.data_model.next_lunar_eclipse_sec == -1 and self.data_model.last_lunar_eclipse_sec > 7200) or (self.data_model.next_lunar_eclipse_sec > 7200 and self.data_model.last_lunar_eclipse_sec == -1) or min(self.data_model.next_lunar_eclipse_sec, self.data_model.last_lunar_eclipse_sec) > 7200:
# Normal Moon phase render
- moon_pixbuf.composite(dark_pixbuf, 0, 0, IMAGE_SIZE, IMAGE_SIZE, 0, 0, 1, 1, Gdk.INTERP_BILINEAR, 127)
+ moon_pixbuf.composite(dark_pixbuf, 0, 0, IMAGE_SIZE, IMAGE_SIZE, 0, 0, 1, 1, GdkPixbuf.InterpType.BILINEAR, 127)
self.image_pixbuf.draw_pixbuf(self.gc, dark_pixbuf, 0, 0, 0, 0)
self.image_pixbuf.draw_pixbuf(maskgc, moon_pixbuf, 0, 0, 0, 0)
@@ -365,13 +365,13 @@ class MoonActivity(activity.Activity):
else:
eclipse_alpha = min(self.data_model.next_lunar_eclipse_sec, self.data_model.last_lunar_eclipse_sec) / 7200.0 * 256
moon_pixbuf.composite(dark_pixbuf, 0, 0, IMAGE_SIZE, IMAGE_SIZE,
- 0, 0, 1, 1, Gdk.INTERP_BILINEAR,
+ 0, 0, 1, 1, GdkPixbuf.InterpType.BILINEAR,
int(196 - eclipse_alpha / 2))
self.image_pixbuf.draw_pixbuf(self.gc, dark_pixbuf, 0, 0, 0, 0)
del dark_pixbuf
- dark_pixbuf = Gdk.Pixbuf(Gdk.COLORSPACE_RGB, True, 8, IMAGE_SIZE, IMAGE_SIZE)
+ dark_pixbuf = GdkPixbuf.Pixbuf(GdkPixbuf.Colorspace.RGB, True, 8, IMAGE_SIZE, IMAGE_SIZE)
moon_pixbuf.composite(dark_pixbuf, 0, 0, IMAGE_SIZE, IMAGE_SIZE,
- 0, 0, 1, 1, Gdk.INTERP_BILINEAR,
+ 0, 0, 1, 1, GdkPixbuf.InterpType.BILINEAR,
int(eclipse_alpha))
rgc = self.image_pixbuf.new_gc(foreground=self.blue_green_mask_alloc_color, function=Gdk.AND)
self.image_pixbuf.draw_rectangle(rgc, True, 0, 0, IMAGE_SIZE, IMAGE_SIZE)
@@ -379,7 +379,7 @@ class MoonActivity(activity.Activity):
if self.hemisphere_view == 'south':
# Rotate final image for a view from north or south hemisphere
- rot_pixbuf = Gdk.Pixbuf(Gdk.COLORSPACE_RGB, False, 8, IMAGE_SIZE, IMAGE_SIZE)
+ rot_pixbuf = GdkPixbuf.Pixbuf(GdkPixbuf.Colorspace.RGB, False, 8, IMAGE_SIZE, IMAGE_SIZE)
rot_pixbuf.get_from_drawable(self.image_pixbuf, self.image_pixbuf.get_Gdk.Color(), 0, 0, 0, 0, -1, -1)
rot_pixbuf = rot_pixbuf.rotate_simple(Gdk.PIXBUF_ROTATE_UPSIDEDOWN)
self.image_pixbuf.draw_pixbuf(self.gc, rot_pixbuf, 0, 0, 0, 0)