Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 92 → Rev 93

/branches/BR-0.3/basico/dashboard.py
40,6 → 40,7
 
 
def update(self):
self.webserver.run()
self.build_report()
 
 
47,11 → 48,12
try:
dashboard = self.gui.get_widget('DashboardViewer')
view = WebKit.WebView()
chart = self.stats.build_pie_maincomp()
fsvg = open('chart.svg', 'w')
fsvg.write(chart)
fsvg.close()
view.load_string(HTML5_REPORT % chart, 'text/html', 'UTF-8','/')
view.load_uri("http://localhost:8000/index.html")
#~ chart = self.stats.build_pie_maincomp()
#~ fsvg = open('chart.svg', 'w')
#~ fsvg.write(chart)
#~ fsvg.close()
#~ view.load_string(HTML5_REPORT % chart, 'text/html', 'UTF-8','/')
except Exception as error:
self.log.error(error)
view = Gtk.Label()
60,7 → 62,7
 
self.gui.swap_widget(dashboard, view)
 
self.update_maincomps_chart()
#~ self.update_maincomps_chart()
 
 
def get_services(self):
68,6 → 70,7
self.db = self.app.get_service('DB')
self.gui = self.app.get_service('GUI')
self.stats = self.app.get_service('Stats')
self.webserver = self.app.get_service('WebServer')
 
 
def update_maincomps_chart(self):
/branches/BR-0.3/basico/env.py
31,6 → 31,7
LPATH['LOG'] = LPATH['VAR'] + 'logs' + SEP
LPATH['TMP'] = LPATH['VAR'] + 'tmp' + SEP
LPATH['DB'] = LPATH['VAR'] + 'db' + SEP
LPATH['WWW'] = LPATH['VAR'] + 'www' + SEP
LPATH['EXPORT'] = LPATH['VAR'] + 'export' + SEP
LPATH['OPT'] = LPATH['ROOT'] + 'opt' + SEP
LPATH['DRIVERS'] = LPATH['OPT'] + 'webdrivers' + SEP
/branches/BR-0.3/basico/basico.py
39,6 → 39,7
from .dashboard import Dashboard
from .stats import Stats
from .database import Database
from .webserver import WebServer
from .driver import SeleniumDriver
from .env import ROOT, APP, LPATH, GPATH, FILE
 
73,9 → 74,10
'Plugins' : Plugins(),
'Callbacks' : Callback(),
'Stats' : Stats(),
'Dashboard' : Dashboard(),
'Dashboard' : Dashboard(),
'DB' : Database(),
'Driver' : SeleniumDriver()
'Driver' : SeleniumDriver(),
'WebServer' : WebServer()
}
self.register_services(services)
except Exception as error:
/branches/BR-0.3/basico/webserver.py
0,0 → 1,44
#!/usr/bin/python
# -*- coding: utf-8 -*-
# File: webserver.py
# Author: Tomás Vírseda
# License: GPL v3
# Description: Simple WebServer service
 
import os
import threading
import http.server
import socketserver
 
from .service import Service
from .env import LPATH
 
# FIXME: make PORT dynamic via configuration
PORT = 8000
 
class WebServer(Service):
def initialize(self):
WEBROOT = LPATH['WWW']
os.chdir(WEBROOT)
self.handler = http.server.SimpleHTTPRequestHandler
self.httpd = socketserver.TCPServer(("", PORT), self.handler)
self.log.debug("Web Root Document: %s" % WEBROOT)
self.log.debug("WebServer listening at port: %d" % PORT)
self.thread = threading.Thread(target=self.serve)
 
def run(self):
self.thread.daemon = True
self.thread.start()
 
def serve(self):
self.httpd.serve_forever()
 
 
def halt(self):
# Clean-up server (close socket, etc.)
#~ self.thread.stop()
self.httpd.server_close()
 
 
def finalize(self):
self.halt()
/branches/BR-0.3/basico/window.py
42,6 → 42,7
 
self.setup_window()
self.setup_widgets()
 
self.setup_app()
 
 
83,6 → 84,9
self.set_default_size(1024, 728)
self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
#~ self.connect('destroy', Gtk.main_quit)
 
# HEADERBAR WIDGETS
self.setup_headerbar()
self.show_all()
 
 
178,8 → 182,18
button.set_relief(Gtk.ReliefStyle.NONE)
button.connect('clicked', self.uiapp.cb_show_about)
rhbox.pack_end(button, False, False, 0)
#~ hb.pack_end(rhbox)
 
# Help
button = Gtk.Button()
button.set_tooltip_markup('<big><b>Help</b></big>')
icon = self.im.get_pixbuf_icon('basico_help', 24, 24)
image = Gtk.Image()
image.set_from_pixbuf(icon)
button.set_image(image)
button.set_relief(Gtk.ReliefStyle.NONE)
button.connect('clicked', self.cb.show_help)
rhbox.pack_end(button, False, False, 0)
 
# Settings
button = Gtk.Button()
button.set_tooltip_markup('<big><b>Settings</b></big>')
375,9 → 389,6
self.mainbox = self.gui.get_widget('mainbox')
self.mainbox.reparent(self)
 
# HEADERBAR WIDGETS
self.setup_headerbar()
 
#~ # STATUSBAR WIDGETS
# StatusBar disabled
#~ statusbar = self.gui.get_widget('pgbMain')
/branches/BR-0.3/basico/callbacks.py
166,6 → 166,10
toggled = tgbsearch.get_active()
tgbsearch.set_active(not toggled)
 
def show_help(self, *args):
notebook = self.gui.get_widget('mainbox')
notebook.set_current_page(5)
self.update_titlebar_title("Help", "basico_help")
 
def show_settings(self, *args):
notebook = self.gui.get_widget('mainbox')
/branches/BR-0.3/basico/data/icons/basico_help.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/BR-0.3/basico/data/icons/basico_help.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: BR-0.3/basico/data/ui/basico.ui
===================================================================
--- BR-0.3/basico/data/ui/basico.ui (revision 92)
+++ BR-0.3/basico/data/ui/basico.ui (revision 93)
@@ -36,13 +36,14 @@
<object class="GtkNotebook" id="mainbox">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="show_tabs">False</property>
<child>
- <object class="GtkBox" id="box1">
+ <object class="GtkBox" id="DashboardViewer3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkBox" id="box9">
+ <object class="GtkBox" id="DashboardViewer5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
@@ -52,7 +53,7 @@
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkViewport" id="viewport3">
+ <object class="GtkViewport" id="DashboardViewer">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
@@ -59,9 +60,11 @@
<object class="GtkBox" id="box11">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkBox" id="DashboardViewer">
+ <object class="GtkBox" id="DashboardViewer2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -1032,7 +1035,7 @@
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">About</property>
+ <property name="label" translatable="yes">Help</property>
</object>
<packing>
<property name="position">5</property>
@@ -1039,6 +1042,20 @@
<property name="tab_fill">False</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label11">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">About</property>
+ </object>
+ <packing>
+ <property name="position">6</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
</object>
</child>
</object>
Index: BR-0.3/setup.py
===================================================================
--- BR-0.3/setup.py (revision 92)
+++ BR-0.3/setup.py (revision 93)
@@ -39,6 +39,7 @@
'basico/data/icons/category.png',
'basico/data/icons/component.png',
'basico/data/icons/delete.png',
+ 'basico/data/icons/basico_help.png',
'basico/data/icons/noproject.png',
'basico/data/icons/project.png',
'basico/data/icons/sapnote.png',