forked from sugarlabs/compress-activity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Compress.py
116 lines (110 loc) · 4.22 KB
/
Compress.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Ignacio Rodríguez <nachoel01@gmail.com>
# Rafael Cordano <rafael.cordano@gmail.com>
# Ezequiel Pereira <eze2307@gmail.com>
# 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 3 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
try: # gtk3
from sugar3.activity import activity
from sugar3.activity.widgets import StopButton
from sugar3.activity.widgets import ActivityToolbarButton
from sugar3.graphics.toolbutton import ToolButton
from sugar3.graphics.toolbarbox import ToolbarBox
from gettext import gettext as _ # Traduccion
import utils3 as utils
from utils3 import Boton
from gi.repository import Gtk
Abrir = Boton(_("Abrir"),"Abrir")
Arriba = Boton(_('Arriba'),'up')
Home = Boton(_('Directorio Zip'),'gtk-home')
#open_from_journal = Boton(_("Open from journal"),"open-from-journal")
Add = Boton(_('Añadir archivo'),"add")
save = Boton(_('Guardar archivo:'))
Barra = ToolbarBox()
from CompressCanvas3 import Canvas_box as PyApp
from CompressCanvas3 import *
class Compress(activity.Activity):
def __init__(self, handle):
activity.Activity.__init__(self, handle, True)
canvas = PyApp()
Actividad = ActivityToolbarButton(self)
Parar = StopButton(self)
Parar.set_tooltip(_('Parar - Gtk3'))
#<-------------Separadores------------->#
Separador = Gtk.SeparatorToolItem()
Separador2 = Gtk.SeparatorToolItem()
Separador3 = Gtk.SeparatorToolItem()
Separador3.set_expand(True)
Separador3.props.draw = False
Barra.toolbar.insert(Actividad, 0)
Barra.toolbar.insert(Separador2, 1)
Barra.toolbar.insert(Add, 2)
Barra.toolbar.insert(Home,3)
Barra.toolbar.insert(Arriba,4)
Barra.toolbar.insert(Separador3, 5)
Barra.toolbar.insert(Abrir, 6)
Barra.toolbar.insert(save,7)
Barra.toolbar.insert(Separador3, 8)
Barra.toolbar.insert(Parar, 9)
self.set_toolbar_box(Barra) # Barra
self.set_canvas(canvas)
self.show_all()
save.hide()
except ImportError:
import gtk
from sugar.activity import activity
from sugar.activity.widgets import StopButton
from sugar.activity.widgets import ActivityToolbarButton
from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.toolbarbox import ToolbarBox
from gettext import gettext as _ # Traduccion
import utils
from utils import Boton
Abrir = Boton(_("Abrir"),"Abrir")
Arriba = Boton(_('Arriba'),'up')
Home = Boton(_('Directorio Zip'),'gtk-home')
#open_from_journal = Boton(_("Open from journal"),"open-from-journal")
Add = Boton(_('Añadir archivo'),"add")
save = Boton(_('Guardar archivo:'))
Barra = ToolbarBox()
from CompressCanvas import Canvas_box as PyApp
from CompressCanvas import *
class Compress(activity.Activity):
def __init__(self, handle):
activity.Activity.__init__(self, handle, True)
canvas = PyApp()
Actividad = ActivityToolbarButton(self)
Parar = StopButton(self)
Parar.set_tooltip(_('Parar - Gtk2'))
#<-------------Separadores------------->#
Separador = gtk.SeparatorToolItem()
Separador2 = gtk.SeparatorToolItem()
Separador3 = gtk.SeparatorToolItem()
Separador3.set_expand(True)
Separador3.props.draw = False
Barra.toolbar.insert(Actividad, 0)
Barra.toolbar.insert(Separador2, 1)
Barra.toolbar.insert(Add, 2)
Barra.toolbar.insert(Home,3)
Barra.toolbar.insert(Arriba,4)
Barra.toolbar.insert(Separador3, 5)
Barra.toolbar.insert(Abrir, 6)
Barra.toolbar.insert(save,7)
Barra.toolbar.insert(Separador3, 8)
Barra.toolbar.insert(Parar, 9)
self.set_toolbar_box(Barra) # Barra
self.set_canvas(canvas)
self.show_all()
save.hide()