Subversion Repositories basico

Rev

Rev 125 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 125 Rev 130
Line 34... Line 34...
34
        scrolledwindow.set_hexpand(True)
34
        scrolledwindow.set_hexpand(True)
35
        scrolledwindow.set_vexpand(True)
35
        scrolledwindow.set_vexpand(True)
36
36
37
        textview = Gtk.TextView()
37
        textview = Gtk.TextView()
38
        self.textbuffer = textview.get_buffer()
38
        self.textbuffer = textview.get_buffer()
39
        self.textbuffer.set_text("This is some text inside of a Gtk.TextView. "
-
 
40
            + "Select text and click one of the buttons 'bold', 'italic', "
-
 
41
            + "or 'underline' to modify the text accordingly.")
-
 
-
 
39
        self.textbuffer.set_text("")
42
        scrolledwindow.add(textview)
40
        scrolledwindow.add(textview)
43
41
44
        box = self.get_content_area()
42
        box = self.get_content_area()
45
        box.add(scrolledwindow)
43
        box.add(scrolledwindow)
46
        self.show_all()
44
        self.show_all()
Line 59... Line 57...
59
        self.get_services()
57
        self.get_services()
60
        self.setup_widgets()
58
        self.setup_widgets()
61
        self.setup_menus()
59
        self.setup_menus()
62
60
63
61
64
    def hello(self, *args):
-
 
-
 
62
    def show_import_dialog_launchpad(self, *args):
65
        self.log.debug("Import from Launchpad")
63
        self.log.debug("Import from Launchpad")
66
        parent_window = self.gui.get_widget('mainwindow')
64
        parent_window = self.gui.get_widget('mainwindow')
67
        dialog = DlgImportFromLaunchpad(parent_window)
65
        dialog = DlgImportFromLaunchpad(parent_window)
68
        response = dialog.run()
66
        response = dialog.run()
69
67
Line 77... Line 75...
77
        dialog.destroy()
75
        dialog.destroy()
78
76
79
77
80
    def setup_widgets(self):
78
    def setup_widgets(self):
81
        # Toolbar
79
        # Toolbar
82
        btnwpunfull = self.gui.get_widget('btnWPUnfullscreen')
-
 
83
        btnwpunfull.connect('clicked', self.uif.do_unfullscreen)
-
 
84
        imgwpunfull = self.gui.get_widget('imgWPUnfullscreen')
-
 
85
        icon = self.im.get_pixbuf_icon('unfullscreen', 24, 24)
-
 
86
        imgwpunfull.set_from_pixbuf(icon)
-
 
-
 
80
        #~ btnwpunfull = self.gui.get_widget('btnWPUnfullscreen')
-
 
81
        #~ btnwpunfull.connect('clicked', self.uif.do_unfullscreen)
-
 
82
        #~ imgwpunfull = self.gui.get_widget('imgWPUnfullscreen')
-
 
83
        #~ icon = self.im.get_pixbuf_icon('unfullscreen', 24, 24)
-
 
84
        #~ imgwpunfull.set_from_pixbuf(icon)
87
85
88
        icon = self.im.get_pixbuf_icon('addnote', 24, 24)
-
 
89
        imgwpaddnote = self.gui.get_widget('imgWPAddNote')
-
 
90
        imgwpaddnote.set_from_pixbuf(icon)
-
 
-
 
86
        #~ icon = self.im.get_pixbuf_icon('addnote', 24, 24)
-
 
87
        #~ imgwpaddnote = self.gui.get_widget('imgWPAddNote')
-
 
88
        #~ imgwpaddnote.set_from_pixbuf(icon)
91
89
92
90
93
        tgbshowmenu = self.gui.get_widget('tgbShowMenuView')
91
        tgbshowmenu = self.gui.get_widget('tgbShowMenuView')
94
        tgbshowmenu.connect('toggled', self.show_menu_view)
92
        tgbshowmenu.connect('toggled', self.show_menu_view)
95
        self.lblSelectedNotes = self.gui.get_widget('lblSelectedNotes')
93
        self.lblSelectedNotes = self.gui.get_widget('lblSelectedNotes')
Line 103... Line 101...
103
        # SAP Notes Visor
101
        # SAP Notes Visor
104
        visorbox = self.gui.get_widget('notesbox')
102
        visorbox = self.gui.get_widget('notesbox')
105
        visor = self.gui.add_widget('visor', SAPNoteViewVisor(self.app))
103
        visor = self.gui.add_widget('visor', SAPNoteViewVisor(self.app))
106
        self.gui.swap_widget(visorbox, visor)
104
        self.gui.swap_widget(visorbox, visor)
107
105
-
 
106
        #~ toggled = visor.get_toggled()
-
 
107
        #~ bag = visor.get_bag()
-
 
108
        #~ label = self.gui.get_widget('lblSelectedNotes')
-
 
109
        #~ label.set_markup('<b><small>%d</small>/%d of <big>%d</big></b>' % (len(toggled), len(bag), self.db.get_total()))
108
110
109
    def get_services(self):
111
    def get_services(self):
110
        self.gui = self.app.get_service("GUI")
112
        self.gui = self.app.get_service("GUI")
111
        self.uif = self.app.get_service("UIF")
113
        self.uif = self.app.get_service("UIF")
112
        self.cb = self.app.get_service('Callbacks')
114
        self.cb = self.app.get_service('Callbacks')
Line 123... Line 125...
123
125
124
    def setup_menu_views(self):
126
    def setup_menu_views(self):
125
        app = self.gui.get_app()
127
        app = self.gui.get_app()
126
128
127
        # View label
129
        # View label
128
        self.gui.add_widget('lblViewCurrent')
-
 
-
 
130
        #~ self.gui.add_widget('lblViewCurrent')
129
131
130
        ## Views Menu
132
        ## Views Menu
131
        views_menu = self.gui.add_widget('mnuviews', Gio.Menu())
133
        views_menu = self.gui.add_widget('mnuviews', Gio.Menu())
132
134
133
        # Last added view
135
        # Last added view
Line 198... Line 200...
198
200
199
        ### ACTIONS POPOVER
201
        ### ACTIONS POPOVER
200
        app = self.gui.get_app()
202
        app = self.gui.get_app()
201
203
202
        ## Action Menu
204
        ## Action Menu
203
        actions_menu = Gio.Menu()
-
 
-
 
205
        actions_menu = self.gui.add_widget('actions_menu', Gio.Menu())
204
206
205
        #~ # Browse SAP Notes
207
        #~ # Browse SAP Notes
206
        actions_menu.append_item(self.uif.create_item('Browse SAP Note(s)', 'app.actions-browse', 'browse'))
208
        actions_menu.append_item(self.uif.create_item('Browse SAP Note(s)', 'app.actions-browse', 'browse'))
207
        app.add_action(self.uif.create_action("actions-browse"))
209
        app.add_action(self.uif.create_action("actions-browse"))
208
210
Line 256... Line 258...
256
        btnactions.set_property("use-popover", True)
258
        btnactions.set_property("use-popover", True)
257
        btnactions.set_menu_model(actions_menu)
259
        btnactions.set_menu_model(actions_menu)
258
260
259
261
260
    def setup_menu_import(self):
262
    def setup_menu_import(self):
261
        imgwpimport = self.gui.get_widget('imgWPImport')
-
 
262
        icon = self.im.get_pixbuf_icon('download', 24, 24)
-
 
263
        imgwpimport.set_from_pixbuf(icon)
-
 
-
 
263
        #~ imgwpimport = self.gui.get_widget('imgWPImport')
-
 
264
        #~ icon = self.im.get_pixbuf_icon('download', 24, 24)
-
 
265
        #~ imgwpimport.set_from_pixbuf(icon)
264
        viewmenu = self.gui.get_widget('viewmenu')
266
        viewmenu = self.gui.get_widget('viewmenu')
265
        view = viewmenu.get_view()
267
        view = viewmenu.get_view()
266
268
267
        ### ACTIONS POPOVER
269
        ### ACTIONS POPOVER
268
        app = self.gui.get_app()
270
        app = self.gui.get_app()
Line 282... Line 284...
282
284
283
        #~ Import from SAP Launchpad
285
        #~ Import from SAP Launchpad
284
        actions_menu.append_item(self.uif.create_item('Import SAP Notes from SAP Launchpad', 'app.actions-import-launchpad', 'download'))
286
        actions_menu.append_item(self.uif.create_item('Import SAP Notes from SAP Launchpad', 'app.actions-import-launchpad', 'download'))
285
        #~ action = Gio.SimpleAction.new('app.actions-import-launchpad', None)
287
        #~ action = Gio.SimpleAction.new('app.actions-import-launchpad', None)
286
        #~ action.connect('activate', self.hello, 'download')
288
        #~ action.connect('activate', self.hello, 'download')
287
        app.add_action(self.uif.create_action("actions-import-launchpad", self.hello))
-
 
-
 
289
        app.add_action(self.uif.create_action("actions-import-launchpad", self.show_import_dialog_launchpad))
288
        #~ action) #
290
        #~ action) #
289
291
290
        #~ actions_menu.append_submenu('Import', actions_import_submenu)
292
        #~ actions_menu.append_submenu('Import', actions_import_submenu)
291
293
292
        # MnuButton valid with any modern version of Gtk (?> 3.10)
294
        # MnuButton valid with any modern version of Gtk (?> 3.10)