Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKshitij <Kshitij@Kshitijs-MacBook-Pro.local>2012-12-13 15:01:01 (GMT)
committer Kshitij <Kshitij@Kshitijs-MacBook-Pro.local>2012-12-13 15:01:01 (GMT)
commitd63eb44aa4a151fb08a8427f72758cea1f511307 (patch)
treee6666cb696ef4c2b0e20406c757e59d4fc67ae87
parentc891d3fa228fff387a98c11fce38454c987ad091 (diff)
PyGI changessugar-0.94
-rw-r--r--activity.py6
-rw-r--r--cardlist.py32
-rw-r--r--cardtable.py26
-rw-r--r--createcardpanel.py36
-rw-r--r--face.py6
-rw-r--r--fontcombobox.py6
-rw-r--r--playerscoreboard.py18
-rw-r--r--port/chooser.py2
-rw-r--r--port/roundbox.py6
-rw-r--r--score.py4
-rw-r--r--scoreboard.py10
-rw-r--r--speak/espeak.py2
-rw-r--r--speak/eye.py8
-rw-r--r--speak/face.py10
-rw-r--r--speak/mouth.py2
-rw-r--r--svgcard.py24
-rw-r--r--svglabel.py8
-rw-r--r--theme.py2
18 files changed, 104 insertions, 104 deletions
diff --git a/activity.py b/activity.py
index 0ca8108..204be15 100644
--- a/activity.py
+++ b/activity.py
@@ -174,7 +174,7 @@ class MemorizeActivity(Activity):
self.connect('focus_out_event', self._focus_out)
self.connect('destroy', self._cleanup_cb)
- self.add_events(Gdk.POINTER_MOTION_MASK)
+ self.add_events(Gdk.EventMask.POINTER_MOTION_MASK)
self.connect('motion_notify_event',
lambda widget, event: face.look_at())
@@ -304,7 +304,7 @@ class MemorizeActivity(Activity):
self.hbox.remove(self.scoreboard)
self.hbox.remove(self.table)
self.hbox.pack_start(self.createcardpanel, False)
- self.hbox.pack_start(self.cardlist)
+ self.hbox.pack_start(self.cardlist, True, True, 0)
self.cardlist.load_game(self.game)
self.game.model.create_temp_directories()
self.createcardpanel.set_temp_folder(
@@ -323,7 +323,7 @@ class MemorizeActivity(Activity):
self.hbox.remove(self.createcardpanel)
self.hbox.remove(self.cardlist)
if self.play_mode in (False, None):
- self.hbox.pack_start(self.scoreboard)
+ self.hbox.pack_start(self.scoreboard, True, True, 0)
self.hbox.pack_start(self.table, False)
self.play_mode = True
self._memorizeToolbarBuilder.update_controls(mode == _MODE_PLAY)
diff --git a/cardlist.py b/cardlist.py
index f43ad10..7316615 100644
--- a/cardlist.py
+++ b/cardlist.py
@@ -41,7 +41,7 @@ class CardList(Gtk.EventBox):
}
def __init__(self):
- Gtk.EventBox.__init__(self)
+ gobject.GObject.__init__(self)
self.pairs = []
self.current_pair = None
self.current_game_key = None
@@ -52,15 +52,15 @@ class CardList(Gtk.EventBox):
self.vbox = Gtk.VBox(False)
fill_box = Gtk.Label()
- fill_box.modify_bg(Gtk.STATE_NORMAL, Gdk.color_parse('#000000'))
+ fill_box.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('#000000'))
fill_box.show()
self.vbox.pack_end(fill_box, True, True)
scroll = Gtk.ScrolledWindow()
- scroll.set_policy(Gtk.POLICY_AUTOMATIC, Gtk.POLICY_AUTOMATIC)
+ scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
scroll.add_with_viewport(self.vbox)
scroll.set_border_width(0)
- scroll.get_child().modify_bg(Gtk.STATE_NORMAL,
+ scroll.get_child().modify_bg(Gtk.StateType.NORMAL,
Gdk.color_parse('#000000'))
self.add(scroll)
self.show_all()
@@ -78,14 +78,14 @@ class CardList(Gtk.EventBox):
self.clean_list(load=True)
for key in game_pairs:
if game_pairs[key].props.aimg != None:
- aimg = Gdk.pixbuf_new_from_file( \
+ aimg = GdkPixbuf.Pixbuf.new_from_file( \
join(self.model.data['pathimg'],
game_pairs[key].props.aimg))
else:
aimg = None
if game_pairs[key].props.bimg != None:
- bimg = Gdk.pixbuf_new_from_file( \
+ bimg = GdkPixbuf.Pixbuf.new_from_file( \
join(self.model.data['pathimg'],
game_pairs[key].props.bimg))
else:
@@ -252,7 +252,7 @@ class CardPair(Gtk.EventBox):
def __init__(self, text1, text2=None, aimg=None, bimg=None,
asnd=None, bsnd=None, aspeak=None, bspeak=None,
font_name1=None, font_name2=None):
- Gtk.EventBox.__init__(self)
+ gobject.GObject.__init__(self)
self.bg_color = '#000000'
self.asnd = asnd
@@ -274,9 +274,9 @@ class CardPair(Gtk.EventBox):
None, theme.PAIR_SIZE, 1, self.bg_color, font_name1)
self.bcard1.flip()
self.bcard1.set_pixbuf(aimg)
- align = Gtk.Alignment(.5, .5, 0, 0)
+ align = Gtk.Alignment.new(.5, .5, 0, 0)
align.add(self.bcard1)
- row.pack_start(align)
+ row.pack_start(align, True, True, 0)
self.bcard2 = svgcard.SvgCard(-1,
{'front_text': {'card_text': text2,
@@ -288,26 +288,26 @@ class CardPair(Gtk.EventBox):
None, theme.PAIR_SIZE, 1, self.bg_color, font_name2)
self.bcard2.flip()
self.bcard2.set_pixbuf(bimg)
- align = Gtk.Alignment(.5, .5, 0, 0)
+ align = Gtk.Alignment.new(.5, .5, 0, 0)
align.add(self.bcard2)
- row.pack_start(align)
+ row.pack_start(align, True, True, 0)
close_image = Icon(
icon_name='remove',
- icon_size=Gtk.ICON_SIZE_LARGE_TOOLBAR)
- align = Gtk.Alignment(.5, .5)
+ icon_size=Gtk.IconSize.LARGE_TOOLBAR)
+ align = Gtk.Alignment.new(.5, .5)
align.add(close_image)
close_button = Gtk.ToolButton()
close_button.set_icon_widget(align)
close_button.connect('clicked', self.emit_close)
close_button.set_size_request(style.STANDARD_ICON_SIZE,
style.STANDARD_ICON_SIZE)
- align = Gtk.Alignment(.5, 0, 0, 0)
+ align = Gtk.Alignment.new(.5, 0, 0, 0)
align.add(close_button)
row.pack_start(align, False)
self.connect('button-press-event', self.emit_selected)
- self.modify_bg(Gtk.STATE_NORMAL, Gdk.color_parse(self.bg_color))
+ self.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse(self.bg_color))
self.add(row)
self.show_all()
@@ -323,7 +323,7 @@ class CardPair(Gtk.EventBox):
else:
self.bg_color = '#b2b3b7'
- self.modify_bg(Gtk.STATE_NORMAL, Gdk.color_parse(self.bg_color))
+ self.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse(self.bg_color))
self.bcard1.set_background(self.bg_color)
self.bcard2.set_background(self.bg_color)
diff --git a/cardtable.py b/cardtable.py
index 8f39e64..70a6154 100644
--- a/cardtable.py
+++ b/cardtable.py
@@ -16,7 +16,7 @@
#
from gi.repository import Gtk
-import pango
+from gi.repository import Pango
import svgcard
import os
import math
@@ -37,7 +37,7 @@ class CardTable(Gtk.EventBox):
}
def __init__(self):
- Gtk.EventBox.__init__(self)
+ gobject.GObject.__init__(self)
self.data = None
self.cards_data = None
self._workspace_size = 0
@@ -47,20 +47,20 @@ class CardTable(Gtk.EventBox):
self.connect('size-allocate', self._allocate_cb)
# Set table settings
- self.modify_bg(Gtk.STATE_NORMAL, Gdk.color_parse('#000000'))
+ self.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('#000000'))
self.table = Gtk.Table()
self.table.grab_focus()
self.table.set_flags(Gtk.CAN_FOCUS)
- self.table.set_flags(Gtk.CAN_DEFAULT)
+ self.table.set_can_default(True)
self.table.set_row_spacings(theme.CARD_PAD)
self.table.set_col_spacings(theme.CARD_PAD)
self.table.set_border_width(theme.CARD_PAD)
self.table.set_resize_mode(Gtk.RESIZE_IMMEDIATE)
self.set_property('child', self.table)
- self.load_message = Gtk.Label('Loading Game')
- self.load_message.modify_fg(Gtk.STATE_NORMAL,
+ self.load_message = Gtk.Label(label='Loading Game')
+ self.load_message.modify_fg(Gtk.StateType.NORMAL,
Gdk.color_parse('#ffffff'))
- self.load_message.modify_font(pango.FontDescription('10'))
+ self.load_message.modify_font(Pango.FontDescription('10'))
self.load_message.show()
self.first_load = True
self.load_mode = False
@@ -146,7 +146,7 @@ class CardTable(Gtk.EventBox):
self.id2cd[identifier] = card
self.cards[(x, y)] = card
self.dict[identifier] = (x, y)
- self.table.attach(card, x, x + 1, y, y + 1, Gtk.SHRINK, Gtk.SHRINK)
+ self.table.attach(card, x, x + 1, y, y + 1, Gtk.AttachOptions.SHRINK, Gtk.AttachOptions.SHRINK)
x += 1
if x == self.size:
@@ -184,31 +184,31 @@ class CardTable(Gtk.EventBox):
x = self.selected_card[0]
y = self.selected_card[1]
- if event.keyval in (Gtk.keysyms.Left, Gtk.keysyms.KP_Left):
+ if event.keyval in (Gdk.KEY_Left, Gdk.KEY_KP_Left):
if (x - 1, y) in self.table_positions:
card = self.cards[x - 1, y]
identifier = self.cd2id.get(card)
self.emit('card-highlighted', identifier, False)
- elif event.keyval in (Gtk.keysyms.Right, Gtk.keysyms.KP_Right):
+ elif event.keyval in (Gdk.KEY_Right, Gdk.KEY_KP_Right):
if (x + 1, y) in self.table_positions:
card = self.cards[x + 1, y]
identifier = self.cd2id.get(card)
self.emit('card-highlighted', identifier, False)
- elif event.keyval in (Gtk.keysyms.Up, Gtk.keysyms.KP_Up):
+ elif event.keyval in (Gdk.KEY_Up, Gdk.KEY_KP_Up):
if (x, y - 1) in self.table_positions:
card = self.cards[x, y - 1]
identifier = self.cd2id.get(card)
self.emit('card-highlighted', identifier, False)
- elif event.keyval in (Gtk.keysyms.Down, Gtk.keysyms.KP_Down):
+ elif event.keyval in (Gdk.KEY_Down, Gdk.KEY_KP_Down):
if (x, y + 1) in self.table_positions:
card = self.cards[x, y + 1]
identifier = self.cd2id.get(card)
self.emit('card-highlighted', identifier, False)
- elif event.keyval in (Gtk.keysyms.space, Gtk.keysyms.KP_Page_Down):
+ elif event.keyval in (Gdk.KEY_space, Gdk.KEY_KP_Page_Down):
card = self.cards[x, y]
self.card_flipped(card)
diff --git a/createcardpanel.py b/createcardpanel.py
index dbdeba7..5663f6a 100644
--- a/createcardpanel.py
+++ b/createcardpanel.py
@@ -56,16 +56,16 @@ class CreateCardPanel(Gtk.EventBox):
label_box = Gtk.HBox()
icon = Icon(
icon_name=icon_name,
- icon_size=Gtk.ICON_SIZE_LARGE_TOOLBAR)
+ icon_size=Gtk.IconSize.LARGE_TOOLBAR)
label_box.pack_start(icon, False)
- label = Gtk.Label(label)
- label.modify_fg(Gtk.STATE_NORMAL,
+ label = Gtk.Label(label=label)
+ label.modify_fg(Gtk.StateType.NORMAL,
style.COLOR_TOOLBAR_GREY.get_gdk_color())
- label_box.pack_start(label)
+ label_box.pack_start(label, True, True, 0)
label_box.show_all()
return label_box
- Gtk.EventBox.__init__(self)
+ gobject.GObject.__init__(self)
self.equal_pairs = False
self._updatebutton_sensitive = False
@@ -110,8 +110,8 @@ class CreateCardPanel(Gtk.EventBox):
# edit panel
self.card_box = Gtk.HBox()
- self.card_box.pack_start(self.cardeditor1)
- self.card_box.pack_start(self.cardeditor2)
+ self.card_box.pack_start(self.cardeditor1, True, True, 0)
+ self.card_box.pack_start(self.cardeditor2, True, True, 0)
box = Gtk.VBox()
box.pack_start(self.card_box, False)
@@ -201,7 +201,7 @@ class CreateCardPanel(Gtk.EventBox):
self.card_box.remove(self.cardeditor2)
else:
if not self.cardeditor2.parent:
- self.card_box.pack_start(self.cardeditor2)
+ self.card_box.pack_start(self.cardeditor2, True, True, 0)
def clean(self, widget):
self.cardeditor1.clean()
@@ -278,7 +278,7 @@ class CardEditor(Gtk.EventBox):
}
def __init__(self, editor_index):
- Gtk.EventBox.__init__(self)
+ gobject.GObject.__init__(self)
self.snd = None
self.editor_index = editor_index
@@ -288,7 +288,7 @@ class CardEditor(Gtk.EventBox):
box.props.spacing = theme.PAD
box.props.border_width = theme.PAD
- self.previewlabel = Gtk.Label(_('Preview:'))
+ self.previewlabel = Gtk.Label(label=_('Preview:'))
self.previewlabel.set_alignment(0, 1)
box.pack_start(self.previewlabel, False)
@@ -300,11 +300,11 @@ class CardEditor(Gtk.EventBox):
'opacity': '1'}},
None, theme.PAIR_SIZE, 1, '#c0c0c0')
self.card.flip()
- card_align = Gtk.Alignment(.5, .5, 0, 0)
+ card_align = Gtk.Alignment.new(.5, .5, 0, 0)
card_align.add(self.card)
box.pack_start(card_align, False)
- textlabel = Gtk.Label(_('Text:'))
+ textlabel = Gtk.Label(label=_('Text:'))
textlabel.set_alignment(0, 1)
box.pack_start(textlabel, False)
@@ -404,15 +404,15 @@ class CardEditor(Gtk.EventBox):
self.set_speak(None)
- pixbuf_t = Gdk.pixbuf_new_from_file_at_size(
+ pixbuf_t = GdkPixbuf.Pixbuf.new_from_file_at_size(
index, theme.PAIR_SIZE - theme.PAD * 2,
theme.PAIR_SIZE - theme.PAD * 2)
size = max(pixbuf_t.get_width(), pixbuf_t.get_height())
- pixbuf_z = Gdk.pixbuf_new_from_file_at_size(
+ pixbuf_z = GdkPixbuf.Pixbuf.new_from_file_at_size(
'images/white.png', size, size)
pixbuf_t.composite(pixbuf_z, 0, 0, pixbuf_t.get_width(),
pixbuf_t.get_height(), 0, 0, 1, 1,
- Gdk.INTERP_BILINEAR, 255)
+ GdkPixbuf.InterpType.BILINEAR, 255)
self.card.set_pixbuf(pixbuf_z)
_logger.debug('Picture Loaded: ' + index)
self.emit('has-picture', True)
@@ -432,7 +432,7 @@ class CardEditor(Gtk.EventBox):
dst = join(self.temp_folder, 'sounds', basename(index))
shutil.copy(index, dst)
self.set_snd(dst)
- icon_theme = Gtk.icon_theme_get_default()
+ icon_theme = Gtk.IconTheme.get_default()
pixbuf_t = icon_theme.load_icon("audio-x-generic",
style.XLARGE_ICON_SIZE, 0)
self.card.set_pixbuf(pixbuf_t)
@@ -485,7 +485,7 @@ class SpeakPalette(Palette):
self.face = speak.face.View()
toolbar = Gtk.HBox()
- toolbar.modify_bg(Gtk.STATE_NORMAL, style.COLOR_BLACK.get_gdk_color())
+ toolbar.modify_bg(Gtk.StateType.NORMAL, style.COLOR_BLACK.get_gdk_color())
usespeak_play = ToolButton(icon_name='media-playback-start')
usespeak_play.connect('clicked', lambda button:
@@ -493,7 +493,7 @@ class SpeakPalette(Palette):
toolbar.pack_start(usespeak_play, False)
self.voices = speak.widgets.Voices(self.face)
- toolbar.pack_start(ToolComboBox(self.voices))
+ toolbar.pack_start(ToolComboBox(self.voices, True, True, 0))
toolbar.show_all()
self.set_content(toolbar)
diff --git a/face.py b/face.py
index 4a98383..4498ed0 100644
--- a/face.py
+++ b/face.py
@@ -26,9 +26,9 @@ import theme
class Face(Gtk.EventBox):
def __init__(self):
- Gtk.EventBox.__init__(self)
+ gobject.GObject.__init__(self)
- self.modify_bg(Gtk.STATE_NORMAL, style.COLOR_BLACK.get_gdk_color())
+ self.modify_bg(Gtk.StateType.NORMAL, style.COLOR_BLACK.get_gdk_color())
self.face = speak.face.View(style.Color('#4b4c4e'))
self.face.set_border_width(theme.SVG_PAD)
@@ -52,7 +52,7 @@ def look_at():
if not speak.espeak.supported:
return
- display = Gdk.display_get_default()
+ display = Gdk.Display.get_default()
screen_, x, y, modifiers_ = display.get_pointer()
for i in _cache:
diff --git a/fontcombobox.py b/fontcombobox.py
index f5f34e9..dea44b7 100644
--- a/fontcombobox.py
+++ b/fontcombobox.py
@@ -24,9 +24,9 @@ FONT_BLACKLIST = ['cmex10', 'cmmi10', 'cmr10', 'cmsy10', 'esint10', 'eufm10',
class FontComboBox(Gtk.ComboBox):
def __init__(self):
- Gtk.ComboBox.__init__(self)
+ gobject.GObject.__init__(self)
font_renderer = Gtk.CellRendererText()
- self.pack_start(font_renderer)
+ self.pack_start(font_renderer, True, True, 0)
self.add_attribute(font_renderer, 'text', 0)
self.add_attribute(font_renderer, 'font', 0)
font_model = Gtk.ListStore(str)
@@ -46,7 +46,7 @@ class FontComboBox(Gtk.ComboBox):
self.faces[name] = font_faces
sorter = Gtk.TreeModelSort(font_model)
- sorter.set_sort_column_id(0, Gtk.SORT_ASCENDING)
+ sorter.set_sort_column_id(0, Gtk.SortType.ASCENDING)
self.set_model(sorter)
self.show()
diff --git a/playerscoreboard.py b/playerscoreboard.py
index 73df73c..b7f31a6 100644
--- a/playerscoreboard.py
+++ b/playerscoreboard.py
@@ -31,7 +31,7 @@ _logger = logging.getLogger('memorize-activity')
class PlayerScoreboard(Gtk.EventBox):
def __init__(self, nick, fill_color, stroke_color, score=0):
- Gtk.EventBox.__init__(self)
+ gobject.GObject.__init__(self)
self.default_color = '#4c4d4f'
self.selected_color = '#818286'
@@ -47,7 +47,7 @@ class PlayerScoreboard(Gtk.EventBox):
# Set table
self.table = Gtk.Table(2, 2, False)
- self.modify_bg(Gtk.STATE_NORMAL,
+ self.modify_bg(Gtk.StateType.NORMAL,
Gdk.color_parse(self.current_color))
self.table.set_row_spacings(theme.PAD / 2)
self.table.set_col_spacings(theme.PAD / 2)
@@ -73,17 +73,17 @@ class PlayerScoreboard(Gtk.EventBox):
theme.BODY_WIDTH, theme.BODY_HEIGHT)
# Set nick label
- self.nick = Gtk.Label(nick)
- self.nick.modify_fg(Gtk.STATE_NORMAL, Gdk.color_parse('#ffffff'))
+ self.nick = Gtk.Label(label=nick)
+ self.nick.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse('#ffffff'))
self.nick.set_alignment(0, 0.5)
# Set message label
- self.msg = Gtk.Label('Waiting for next game...')
- self.msg.modify_fg(Gtk.STATE_NORMAL, Gdk.color_parse('#ffffff'))
+ self.msg = Gtk.Label(label='Waiting for next game...')
+ self.msg.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse('#ffffff'))
self.msg.set_alignment(0, 0.5)
self.add(self.table)
- self.table.attach(self.icon, 0, 1, 0, 3, Gtk.SHRINK, Gtk.SHRINK)
+ self.table.attach(self.icon, 0, 1, 0, 3, Gtk.AttachOptions.SHRINK, Gtk.AttachOptions.SHRINK)
self.table.attach(self.nick, 1, 2, 0, 1)
self.table.attach(self.score_table, 1, 2, 1, 2)
@@ -123,7 +123,7 @@ class PlayerScoreboard(Gtk.EventBox):
self.scores.append(new_score)
new_score.show()
self.score_table.attach(new_score, self.current_x, self.current_x + 1,
- self.current_y, self.current_y + 1, Gtk.SHRINK, Gtk.SHRINK)
+ self.current_y, self.current_y + 1, Gtk.AttachOptions.SHRINK, Gtk.AttachOptions.SHRINK)
self.current_x += 1
if self.current_x == self._score_cols:
self.current_x = 0
@@ -136,7 +136,7 @@ class PlayerScoreboard(Gtk.EventBox):
self.current_color = self.selected_color
else:
self.current_color = self.default_color
- self.modify_bg(Gtk.STATE_NORMAL,
+ self.modify_bg(Gtk.StateType.NORMAL,
Gdk.color_parse(self.current_color))
self.icon.set_background(self.current_color)
for score in self.scores:
diff --git a/port/chooser.py b/port/chooser.py
index 9e1b3ff..c03037c 100644
--- a/port/chooser.py
+++ b/port/chooser.py
@@ -47,7 +47,7 @@ def pick(cb=None, default=None, parent=None, what=None):
out = None
try:
- if chooser.run() == Gtk.RESPONSE_ACCEPT:
+ if chooser.run() == Gtk.ResponseType.ACCEPT:
jobject = chooser.get_selected_object()
logging.debug('ObjectChooser: %r' % jobject)
diff --git a/port/roundbox.py b/port/roundbox.py
index ab0f81e..f9bfdba 100644
--- a/port/roundbox.py
+++ b/port/roundbox.py
@@ -9,7 +9,7 @@ class RoundBox(Gtk.HBox):
_BORDER_DEFAULT = style.LINE_WIDTH
def __init__(self, **kwargs):
- Gtk.HBox.__init__(self, **kwargs)
+ gobject.GObject.__init__(self, **kwargs)
self._radius = style.zoom(10)
self.border = self._BORDER_DEFAULT
@@ -68,13 +68,13 @@ if __name__ == '__main__':
box1 = RoundBox()
vbox.add(box1)
- label1 = Gtk.Label("Test 1")
+ label1 = Gtk.Label(label="Test 1")
box1.add(label1)
rbox = RoundBox()
rbox.background_color = style.Color('#FF0000')
vbox.add(rbox)
- label2 = Gtk.Label("Test 2")
+ label2 = Gtk.Label(label="Test 2")
rbox.add(label2)
bbox = RoundBox()
diff --git a/score.py b/score.py
index 2217d91..a535698 100644
--- a/score.py
+++ b/score.py
@@ -57,11 +57,11 @@ class Score(svglabel.SvgLabel):
self.status = status
if status:
self.pixbuf = self.pixbuf_sel
- self.modify_bg(Gtk.STATE_NORMAL,
+ self.modify_bg(Gtk.StateType.NORMAL,
Gdk.color_parse(self.selected_color))
else:
self.pixbuf = self.pixbuf_un
- self.modify_bg(Gtk.STATE_NORMAL,
+ self.modify_bg(Gtk.StateType.NORMAL,
Gdk.color_parse(self.default_color))
self.queue_draw()
diff --git a/scoreboard.py b/scoreboard.py
index 75cdef0..61c4ca0 100644
--- a/scoreboard.py
+++ b/scoreboard.py
@@ -24,7 +24,7 @@ _logger = logging.getLogger('memorize-activity')
class Scoreboard(Gtk.EventBox):
def __init__(self):
- Gtk.EventBox.__init__(self)
+ gobject.GObject.__init__(self)
self.players = {}
self.current_buddy = None
@@ -32,16 +32,16 @@ class Scoreboard(Gtk.EventBox):
self.vbox = Gtk.VBox(False)
fill_box = Gtk.EventBox()
- fill_box.modify_bg(Gtk.STATE_NORMAL, Gdk.color_parse('#4c4d4f'))
+ fill_box.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse('#4c4d4f'))
fill_box.show()
self.vbox.pack_end(fill_box, True, True)
scroll = Gtk.ScrolledWindow()
- scroll.props.shadow_type = Gtk.SHADOW_NONE
- scroll.set_policy(Gtk.POLICY_NEVER, Gtk.POLICY_AUTOMATIC)
+ scroll.props.shadow_type = Gtk.ShadowType.NONE
+ scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
scroll.add_with_viewport(self.vbox)
scroll.set_border_width(0)
- scroll.get_child().set_property('shadow-type', Gtk.SHADOW_NONE)
+ scroll.get_child().set_property('shadow-type', Gtk.ShadowType.NONE)
self.add(scroll)
self.show_all()
diff --git a/speak/espeak.py b/speak/espeak.py
index 0b4eebe..2a03afe 100644
--- a/speak/espeak.py
+++ b/speak/espeak.py
@@ -23,7 +23,7 @@ supported = True
class BaseAudioGrab(GObject.GObject):
__gsignals__ = {
- 'new-buffer': (GObject.SIGNAL_RUN_FIRST, None, [GObject.TYPE_PYOBJECT])
+ 'new-buffer': (GObject.SignalFlags.RUN_FIRST, None, [GObject.TYPE_PYOBJECT])
}
def __init__(self):
diff --git a/speak/eye.py b/speak/eye.py
index 9ebd1bc..3f0ae35 100644
--- a/speak/eye.py
+++ b/speak/eye.py
@@ -30,7 +30,7 @@ import math
class Eye(Gtk.DrawingArea):
def __init__(self, fill_color):
- Gtk.DrawingArea.__init__(self)
+ gobject.GObject.__init__(self)
self.connect("expose_event", self.expose)
self.frame = 0
self.blink = False
@@ -38,8 +38,8 @@ class Eye(Gtk.DrawingArea):
self.fill_color = fill_color
# listen for clicks
- self.add_events(Gdk.BUTTON_PRESS_MASK)
- self.add_events(Gdk.BUTTON_RELEASE_MASK)
+ self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
+ self.add_events(Gdk.EventMask.BUTTON_RELEASE_MASK)
self.connect("button_press_event", self._mouse_pressed_cb)
self.connect("button_release_event", self._mouse_released_cb)
@@ -48,7 +48,7 @@ class Eye(Gtk.DrawingArea):
# Unfortunately that would cause a lot of CPU usage. So instead we rely on our parent to
# tell us to redraw when the mouse has moved. We still need to call add_events so that
# our parent will get mouse motion events, but we don't connect the callback for them ourselves.
- self.add_events(Gdk.POINTER_MOTION_MASK)
+ self.add_events(Gdk.EventMask.POINTER_MOTION_MASK)
# self.connect("motion_notify_event", self._mouse_moved_cb)
def _mouse_moved_cb(self, widget, event):
diff --git a/speak/face.py b/speak/face.py
index de964fb..a81c742 100644
--- a/speak/face.py
+++ b/speak/face.py
@@ -92,7 +92,7 @@ class Status:
class View(Gtk.EventBox):
def __init__(self, fill_color=style.COLOR_BUTTON_GREY):
- Gtk.EventBox.__init__(self)
+ gobject.GObject.__init__(self)
self.status = Status()
self.fill_color = fill_color
@@ -113,10 +113,10 @@ class View(Gtk.EventBox):
# layout the screen
box = Gtk.VBox(homogeneous=False)
- box.pack_start(self._eyebox)
+ box.pack_start(self._eyebox, True, True, 0)
box.pack_start(self._mouthbox, False)
box.set_border_width(FACE_PAD)
- self.modify_bg(Gtk.STATE_NORMAL, self.fill_color.get_gdk_color())
+ self.modify_bg(Gtk.StateType.NORMAL, self.fill_color.get_gdk_color())
self.add(box)
self._mapped = False
@@ -159,7 +159,7 @@ class View(Gtk.EventBox):
for i in status.eyes:
eye = i(self.fill_color)
self._eyes.append(eye)
- self._eyebox.pack_start(eye, padding=FACE_PAD)
+ self._eyebox.pack_start(eye, True, True, FACE_PAD)
eye.show()
self._mouth = status.mouth(self._audio, self.fill_color)
@@ -167,7 +167,7 @@ class View(Gtk.EventBox):
self._mouthbox.add(self._mouth)
# enable mouse move events so we can track the eyes while the mouse is over the mouth
- #self._mouth.add_events(Gdk.POINTER_MOTION_MASK)
+ #self._mouth.add_events(Gdk.EventMask.POINTER_MOTION_MASK)
def say(self, something):
self._audio.speak(self._peding or self.status, something)
diff --git a/speak/mouth.py b/speak/mouth.py
index 3966d2f..94ae6c7 100644
--- a/speak/mouth.py
+++ b/speak/mouth.py
@@ -31,7 +31,7 @@ import numpy.core
class Mouth(Gtk.DrawingArea):
def __init__(self, audioSource, fill_color):
- Gtk.DrawingArea.__init__(self)
+ gobject.GObject.__init__(self)
self.connect("expose_event",self.expose)
self.buffers = []
self.buffer_size = 256
diff --git a/svgcard.py b/svgcard.py
index ff235e5..ff6ef9e 100644
--- a/svgcard.py
+++ b/svgcard.py
@@ -21,7 +21,7 @@ from os.path import join, dirname
import rsvg
import re
from gi.repository import Gtk
-import pango
+from gi.repository import Pango
import logging
from sugar3.util import LRU
@@ -59,7 +59,7 @@ class SvgCard(Gtk.EventBox):
def __init__(self, identifier, pprops, jpeg, size,
align, bg_color='#000000', font_name=model.DEFAULT_FONT):
- Gtk.EventBox.__init__(self)
+ gobject.GObject.__init__(self)
self.bg_color = bg_color
self.flipped = False
@@ -73,7 +73,7 @@ class SvgCard(Gtk.EventBox):
self.text_layouts = [None, None]
self.font_name = font_name
- self.modify_bg(Gtk.STATE_NORMAL, Gdk.color_parse(bg_color))
+ self.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse(bg_color))
self.set_size_request(size, size)
# Views properties
@@ -91,8 +91,8 @@ class SvgCard(Gtk.EventBox):
self.current_face = 'back'
self.draw = Gtk.DrawingArea()
- self.draw.modify_bg(Gtk.STATE_NORMAL, Gdk.color_parse(bg_color))
- self.draw.set_events(Gdk.ALL_EVENTS_MASK)
+ self.draw.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse(bg_color))
+ self.draw.set_events(Gdk.EventMask.ALL_EVENTS_MASK)
self.draw.connect('expose-event', self._expose_cb)
self.draw.connect('realize', self._realize_cb)
self.draw.show_all()
@@ -162,7 +162,7 @@ class SvgCard(Gtk.EventBox):
data = re.sub('size_card1', str(self.size), data)
data = re.sub('size_card2', str(self.size - 6), data)
data = re.sub('size_card3', str(self.size - 17), data)
- pixbuf = rsvg.Handle(data=data).get_pixbuf()
+ pixbuf = Rsvg.Handle.new_from_data(data).get_pixbuf()
self.cache[key] = pixbuf
return pixbuf
@@ -213,12 +213,12 @@ class SvgCard(Gtk.EventBox):
if not self.flipped_once:
if self.jpeg is not None:
- pixbuf_t = Gdk.pixbuf_new_from_file(self.jpeg)
+ pixbuf_t = GdkPixbuf.Pixbuf.new_from_file(self.jpeg)
if pixbuf_t.get_width() != self.size - 22 \
or pixbuf_t.get_height() != self.size - 22:
self.jpeg = pixbuf_t.scale_simple(self.size - 22,
self.size - 22,
- Gdk.INTERP_BILINEAR)
+ GdkPixbuf.InterpType.BILINEAR)
del pixbuf_t
else:
self.jpeg = pixbuf_t
@@ -301,8 +301,8 @@ class SvgCard(Gtk.EventBox):
card_size = self.size - theme.SVG_PAD * 2
layout = self.create_pango_layout(text)
layout.set_width(PIXELS_PANGO(card_size))
- layout.set_wrap(pango.WRAP_WORD)
- desc = pango.FontDescription(self.font_name + " " + str(size))
+ layout.set_wrap(Pango.WrapMode.WORD)
+ desc = Pango.FontDescription(self.font_name + " " + str(size))
layout.set_font_description(desc)
if layout.get_line_count() <= max_lines_count and \
@@ -313,7 +313,7 @@ class SvgCard(Gtk.EventBox):
if layout.get_line_count() > 1:
# XXX for single line ALIGN_CENTER wrongly affects on text position
# and also in some cases for multilined text
- layout.set_alignment(pango.ALIGN_CENTER)
+ layout.set_alignment(Pango.Alignment.CENTER)
_text_layout_cache[key] = layout
@@ -332,7 +332,7 @@ class SvgCard(Gtk.EventBox):
def set_background(self, color):
self.bg_color = color
- self.draw.modify_bg(Gtk.STATE_NORMAL,
+ self.draw.modify_bg(Gtk.StateType.NORMAL,
Gdk.color_parse(self.bg_color))
def change_text(self, newtext):
diff --git a/svglabel.py b/svglabel.py
index a20a361..401a6d1 100644
--- a/svglabel.py
+++ b/svglabel.py
@@ -29,13 +29,13 @@ class SvgLabel(Gtk.DrawingArea):
def __init__(self, filename, fill_color, stroke_color, pixbuf=False,
background_color='', request_x=45, request_y=45):
- Gtk.DrawingArea.__init__(self)
+ gobject.GObject.__init__(self)
self.set_size_request(request_x, request_y)
self.filename = filename
self.background_color = background_color
self.fill_color = fill_color
self.stroke_color = stroke_color
- self.modify_bg(Gtk.STATE_NORMAL, Gdk.color_parse(background_color))
+ self.modify_bg(Gtk.StateType.NORMAL, Gdk.color_parse(background_color))
if pixbuf:
self.pixbuf = pixbuf
else:
@@ -62,7 +62,7 @@ class SvgLabel(Gtk.DrawingArea):
data = re.sub('<!ENTITY stroke_color .*>', entity, data)
self.data_size = len(data)
- return rsvg.Handle(data=data).get_pixbuf()
+ return Rsvg.Handle.new_from_data(data).get_pixbuf()
def set_color(self, fill_color, stroke_color):
self.fill_color = fill_color
@@ -98,6 +98,6 @@ class SvgLabel(Gtk.DrawingArea):
def set_background(self, background_color):
self.background_color = background_color
- self.modify_bg(Gtk.STATE_NORMAL,
+ self.modify_bg(Gtk.StateType.NORMAL,
Gdk.color_parse(self.background_color))
self.queue_draw()
diff --git a/theme.py b/theme.py
index 8cc24f4..1de4d23 100644
--- a/theme.py
+++ b/theme.py
@@ -17,7 +17,7 @@
from gi.repository import Gtk
-PAIR_SIZE = Gdk.screen_width() / 5
+PAIR_SIZE = Gdk.Screen.width() / 5
PAD = 10
SVG_PAD = 10
CARD_PAD = 4