Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 136 → Rev 137

/branches/BR-0.3/basico/basico.py
239,8 → 239,8
try:
self.gui = self.get_service('GUI')
self.gui.run()
except:
self.log.error(self.get_traceback())
except Exception as error:
self.debug(error)
 
 
def main():
/branches/BR-0.3/basico/callbacks.py
124,28 → 124,28
titlebar.set_markup("<big><b>%s</b></big>" % title)
 
 
def show_dashboard(self, *args):
notebook = self.gui.get_widget('mainbox')
notebook.set_current_page(0)
self.update_titlebar_title("Dashboard", "dashboard")
#~ def show_dashboard(self, *args):
#~ notebook = self.gui.get_widget('mainbox')
#~ notebook.set_current_page(0)
#~ self.update_titlebar_title("Dashboard", "dashboard")
 
 
def show_workplace(self, *args):
notebook = self.gui.get_widget('mainbox')
notebook.set_current_page(1)
self.update_titlebar_title("Workplace", "workplace")
#~ def show_workplace(self, *args):
#~ notebook = self.gui.get_widget('mainbox')
#~ notebook.set_current_page(1)
#~ self.update_titlebar_title("Workplace", "workplace")
 
 
def show_school(self, *args):
notebook = self.gui.get_widget('mainbox')
notebook.set_current_page(2)
self.update_titlebar_title("My SAP School", "school", False)
#~ def show_school(self, *args):
#~ notebook = self.gui.get_widget('mainbox')
#~ notebook.set_current_page(2)
#~ self.update_titlebar_title("My SAP School", "school", False)
 
 
def show_workbook(self, *args):
notebook = self.gui.get_widget('mainbox')
notebook.set_current_page(3)
self.update_titlebar_title("Workbook", "comments")
#~ def show_workbook(self, *args):
#~ notebook = self.gui.get_widget('mainbox')
#~ notebook.set_current_page(3)
#~ self.update_titlebar_title("Workbook", "comments")
 
 
def toggle_search(self, *args):
/branches/BR-0.3/basico/gui.py
38,10 → 38,7
self.widgets = {} # Widget name : Object
self.keys = {} # Key : Value; keys: doctype, property, values
 
# Setup Glade builder
self.setup_builder()
 
 
def run(self):
'''
Let GUI service start
71,22 → 68,6
self.ui.quit()
 
 
def setup_builder(self):
'''
Setup Gtk.Builder object
'''
DIR_UI = self.get_var('UI')
self.builder = Gtk.Builder()
self.builder.add_from_file(DIR_UI + 'basico.ui')
 
 
def get_builder(self):
'''
Return Gtk.Builder object
'''
return self.builder()
 
 
def swap_widget(self, parent, widget):
'''
Swap widget inside a container
125,11 → 106,10
try:
if obj is not None:
self.widgets[name] = obj
return self.widgets[name]
else:
self.widgets[name] = self.builder.get_object(name)
return self.widgets[name]
except Exception as error:
self.log.error (self.get_traceback())
return None
except:
return None
 
 
/branches/BR-0.3/basico/sapnoteviewrow.py
95,6 → 95,7
 
# BOOKMARK BUTTON
self.bookmark = Gtk.ToggleButton()
self.bookmark.set_hexpand(False)
self.bookmark.set_relief(Gtk.ReliefStyle.NONE)
self.bookmark.set_active(sapnote['bookmark'])
if self.bookmark.get_active():
/branches/BR-0.3/basico/uiapp.py
77,31 → 77,3
else:
self.window.unfullscreen()
 
 
def cb_show_about(self, *args):
DIR_ICONS = self.controller.get_var("ICONS")
CREDITS = self.controller.get_file("CREDITS")
rootwin = self.gui.get_widget('mainwindow')
version = APP['version']
 
aboutdialog = Gtk.AboutDialog()
aboutdialog.set_hide_titlebar_when_maximized(True)
icon_dlg = self.im.get_icon('basico', 96, 96)
applicense = Gtk.License(Gtk.License.GPL_3_0)
shortname = self.controller.get_app_info('short')
longname = self.controller.get_app_info('desc')
authors = self.controller.get_app_info('authors')
aboutdialog.set_logo(icon_dlg)
aboutdialog.set_icon(icon_dlg)
aboutdialog.set_comments(longname)
aboutdialog.set_version(version)
aboutdialog.set_copyright("Copyright \xa9 2016-2018 Tomás Vírseda García")
aboutdialog.set_license_type(applicense)
aboutdialog.set_authors(authors)
aboutdialog.set_website("http://t00mlabs.net")
aboutdialog.set_website_label("t00mlabs Website")
aboutdialog.set_title("")
aboutdialog.connect("response", self.cb_hide_about)
aboutdialog.set_transient_for(rootwin)
aboutdialog.set_modal(True)
aboutdialog.show()
/branches/BR-0.3/basico/window.py
41,7 → 41,7
 
self.setup_window()
self.setup_widgets()
self.setup_app()
#~ self.setup_app()
 
self.gui.get_service('Workplace')
 
51,13 → 51,6
self.controller = uiapp.get_controller()
 
 
def setup_app(self):
searchentry = self.gui.get_widget("stySearchInfo")
viewlabel = self.gui.get_widget('lblViewCurrent')
searchentry.set_text('')
 
 
 
def setup_window(self):
app_title = self.controller.get_app_info('name')
Gtk.Window.__init__(self, title=app_title, application=self.uiapp)
203,26 → 196,7
hb.show_all()
 
 
def setup_dashboard_filters(self):
### SETTINGS POPOVER
menu = Gio.Menu()
menu.append_item(self.uif.create_item('Fullscreen', 'app.settings-fullscreen', 'gtk-fullscreen'))
menu.append_item(self.uif.create_item('Rename current project', 'app.project-rename', 'preferences-desktop-personal'))
menu.append_item(self.uif.create_item('Refresh current project', 'app.project-refresh', 'view-refresh'))
menu.append_item(self.uif.create_item('Close current project', 'app.project-close', 'window-close'))
menu.append_item(self.uif.create_item('Delete current project', 'app.project-delete', 'list-remove'))
menu.append_item(self.uif.create_item('Export current project', 'app.project-delete', 'document-save-as'))
window = self.gui.get_window()
window.set_app_menu(menu)
app = self.gui.get_app()
app.add_action(self.uif.create_item("settings-fullscreen"))
 
button = self.gui.get_widget('btnDashboard')
popover_dashboard = Gtk.Popover.new_from_model(button, menu)
popover_dashboard.set_position(Gtk.PositionType.BOTTOM)
button.connect('clicked', lambda _: popover_dashboard.show_all())
 
 
def setup_popover_settings(self, widget):
#Creating a popover
popover = Gtk.Popover.new(widget)
301,33 → 275,65
 
 
def setup_widgets(self):
self.mainbox = self.gui.get_widget('mainbox')
self.mainbox.reparent(self)
#~ self.mainbox = self.gui.get_widget('mainbox')
#~ self.mainbox.reparent(self)
 
# SETUP MENUS
self.setup_menus()
# Mainbox
mainbox = self.gui.add_widget('mainbox', Gtk.Box())
mainbox.set_hexpand(True)
paned = self.gui.add_widget('paned', Gtk.HPaned())
paned.set_wide_handle(True)
paned.set_position(250)
 
# SETTINGS PAGE WIDGETS
button = self.gui.get_widget('btnPrefsBack')
button.connect('clicked', self.cb.show_workplace)
# Paned
## Left view
box = self.gui.add_widget('boxMenuView', Gtk.Box())
box.set_hexpand(True)
scr = Gtk.ScrolledWindow()
#~ scr.set_min_content_width(250)
scr.set_propagate_natural_width(True)
scr.set_hexpand(True)
scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
vwp = Gtk.Viewport()
vwp.set_hexpand(True)
viewsbox = self.gui.add_widget('viewsbox', Gtk.Box())
viewsbox.set_hexpand(True)
vwp.add(viewsbox)
scr.add(vwp)
box.add(scr)
paned.add1(box)
 
button = self.gui.add_widget('btnPrefsSAPApply')
#~ button.connect('clicked', self.cb.apply_preferences)
## Right view
box = self.gui.add_widget('boxVisor', Gtk.Box())
box.set_hexpand(True)
scr = self.gui.add_widget('scrVisor', Gtk.ScrolledWindow())
scr.set_hexpand(True)
scr.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
vwp = Gtk.Viewport()
vwp.set_hexpand(True)
notesbox = self.gui.add_widget('notesbox', Gtk.Box())
notesbox.set_hexpand(True)
vwp.add(notesbox)
scr.add(vwp)
box.add(scr)
paned.add2(box)
 
button = self.gui.add_widget('btnPrefsSAPCancel')
button.connect('clicked', self.cb.refresh_view)
mainbox.add(paned)
self.add(mainbox)
self.show_all()
 
button = self.gui.add_widget('btnPrefsSAPReset')
button.connect('clicked', self.cb.default_preferences)
# SETUP MENUS
#~ self.setup_menus()
 
 
# SAPNOTEVIEW WIDGETS
self.gui.add_widget('combobox')
search = self.gui.add_widget('stySearchInfo')
search.connect('activate', self.cb.search_notes)
self.setup_combobox_search()
self.show_all()
#~ self.gui.add_widget('combobox')
#~ search = self.gui.add_widget('stySearchInfo')
#~ search.connect('activate', self.cb.search_notes)
#~ self.setup_combobox_search()
 
#~ self.debug("GUI loaded")
self.cb.show_workplace()
#~ self.cb.show_workplace()
 
 
def setup_props_window(self):
/branches/BR-0.3/basico/workplace.py
84,6 → 84,7
# Views
viewsbox = self.gui.get_widget('viewsbox')
viewmenu = self.gui.add_widget('viewmenu', SAPNoteViewMenu(self.app))
viewmenu.set_hexpand(True)
viewmenu.set_view('components')
self.gui.swap_widget(viewsbox, viewmenu)
 
/branches/BR-0.3/setup.py
73,7 → 73,6
'basico/data/icons/tag.png',
'basico/data/icons/menu.png',
]),
('basico/data/ui', ['basico/data/ui/basico.ui']),
('basico/data/share', []),
("basico/data/share/docs",
[