예제 #1
0
def main():
    try:
        from enthought.etsconfig.api import ETSConfig
        from enthought.pyface.api import GUI
    except:
        print >>sys.stderr, "did you install python-chaco?"
        print >>sys.stderr, "maybe you did install chaco>=4, then you will need to install the package etsproxy"
        print >>sys.stderr, "sudo easy_install etsproxy"
        raise

    # select the toolkit we want to use
    # WX is more stable for now
    #ETSConfig.toolkit = 'qt4'
    ETSConfig.toolkit = 'wx'

    # workaround bad bg color in ubuntu, with Ambiance theme
    # wxgtk (or traitsGUI, I dont know) looks like using the menu's bgcolor 
    # for all custom widgets bg colors. :-(

    if ETSConfig.toolkit == 'wx':
        import wx, os
        if "gtk2" in wx.PlatformInfo:
            from gtk import rc_parse, MenuBar
            m = MenuBar()
            if m.rc_get_style().bg[0].red_float < 0.5: # only customize dark bg
                rc_parse(os.path.join(os.path.dirname(__file__),"images/gtkrc"))
            m.destroy()

    # workaround bug in kiva's font manager that fails to find a correct default font on linux
    if os.name=="posix":
        import warnings
        def devnull(*args):
            pass
        warnings.showwarning = devnull
        from  enthought.kiva.fonttools.font_manager import fontManager, FontProperties
        try:
            font = FontProperties()
            font.set_name("DejaVu Sans")
            fontManager.defaultFont = fontManager.findfont(font)
            fontManager.warnings = None
        except: # this code will throw exception on ETS4, which has actually fixed fontmanager
            pass

    from window import open_file



    import optparse
    parser = optparse.OptionParser(usage="""\
%prog [options] [trace.txt|trace.txt.gz|trace.txt.lzma|trace.dat]

pytimechart - Fast graphical exploration and visualisation for linux kernel traces.""")
    parser.add_option("-l", "--log", dest="loglevel", action="store",
                      help="change log level",
                      default=False)
    parser.add_option("-p", "--prof", dest="prof", action="store_true",
                      help="activate profiling",
                      default=False)
    (options, args) = parser.parse_args()

    if options.loglevel:
        numeric_level = getattr(logging, options.loglevel.upper(), None)
        logging.basicConfig(format='%(levelname)s:%(asctime)s:%(message)s',level=numeric_level)
    else:
        logging.basicConfig(format='%(levelname)s:%(asctime)s:%(message)s',level=logging.ERROR)
    # Create the GUI (this does NOT start the GUI event loop).
    gui = GUI()
    if len(args) == 0:
        args.append("dummy")
    for fn in args:
        if not open_file(fn):
            sys.exit(0)
    if options.prof:
        import cProfile
        dict = {"gui":gui}
        cProfile.runctx('gui.start_event_loop()',dict,dict,'timechart.prof')
    else:
        gui.start_event_loop()
예제 #2
0
        if m.rc_get_style().bg[0].red_float < 0.5:  # only customize dark bg
            rc_parse(os.path.join(os.path.dirname(__file__), "images/gtkrc"))
        m.destroy()

# workaround bug in kiva's font manager that fails to find a correct default font on linux
if os.name == "posix":
    import warnings

    def devnull(*args):
        pass

    warnings.showwarning = devnull
    from enthought.kiva.fonttools.font_manager import fontManager, FontProperties
    try:
        font = FontProperties()
        font.set_name("DejaVu Sans")
        fontManager.defaultFont = fontManager.findfont(font)
        fontManager.warnings = None
    except:  # this code will throw exception on ETS4, which has actually fixed fontmanager
        pass

from enthought.pyface.api import GUI
from window import open_file


def main():
    import optparse
    parser = optparse.OptionParser(usage="""\
%prog [options] [trace.txt|trace.txt.gz|trace.txt.lzma|trace.dat]

pytimechart - Fast graphical exploration and visualisation for linux kernel traces."""
예제 #3
0
def main():
    try:
        from enthought.etsconfig.api import ETSConfig
        from enthought.pyface.api import GUI
    except:
        print >> sys.stderr, "did you install python-chaco?"
        print >> sys.stderr, "maybe you did install chaco>=4, then you will need to install the package etsproxy"
        print >> sys.stderr, "sudo easy_install etsproxy"
        raise

    # select the toolkit we want to use
    # WX is more stable for now
    #ETSConfig.toolkit = 'qt4'
    ETSConfig.toolkit = 'wx'

    # workaround bad bg color in ubuntu, with Ambiance theme
    # wxgtk (or traitsGUI, I dont know) looks like using the menu's bgcolor
    # for all custom widgets bg colors. :-(

    if ETSConfig.toolkit == 'wx':
        import wx, os
        if "gtk2" in wx.PlatformInfo:
            from gtk import rc_parse, MenuBar
            m = MenuBar()
            if m.rc_get_style(
            ).bg[0].red_float < 0.5:  # only customize dark bg
                rc_parse(
                    os.path.join(os.path.dirname(__file__), "images/gtkrc"))
            m.destroy()

    # workaround bug in kiva's font manager that fails to find a correct default font on linux
    if os.name == "posix":
        import warnings

        def devnull(*args):
            pass

        warnings.showwarning = devnull
        from enthought.kiva.fonttools.font_manager import fontManager, FontProperties
        try:
            font = FontProperties()
            font.set_name("DejaVu Sans")
            fontManager.defaultFont = fontManager.findfont(font)
            fontManager.warnings = None
        except:  # this code will throw exception on ETS4, which has actually fixed fontmanager
            pass

    from window import open_file

    import optparse
    parser = optparse.OptionParser(usage="""\
%prog [options] [trace.txt|trace.txt.gz|trace.txt.lzma|trace.dat]

pytimechart - Fast graphical exploration and visualisation for linux kernel traces."""
                                   )
    parser.add_option("-p",
                      "--prof",
                      dest="prof",
                      action="store_true",
                      help="activate profiling",
                      default=False)
    (options, args) = parser.parse_args()

    # Create the GUI (this does NOT start the GUI event loop).
    gui = GUI()
    if len(args) == 0:
        args.append("dummy")
    for fn in args:
        if not open_file(fn):
            sys.exit(0)
    if options.prof:
        import cProfile
        dict = {"gui": gui}
        cProfile.runctx('gui.start_event_loop()', dict, dict, 'timechart.prof')
    else:
        gui.start_event_loop()
예제 #4
0
parser = argparse.ArgumentParser(description="Swift Nav Console.")
parser.add_argument("-p", "--port", default=[serial_link.DEFAULT_PORT], nargs=1, help="specify the serial port to use.")
args = parser.parse_args()
serial_port = args.port[0]

import logging

logging.basicConfig()

# Fix default font issue on Linux
import os
from enthought.kiva.fonttools.font_manager import fontManager, FontProperties

if os.name == "posix":
    font = FontProperties()
    font.set_name("Arial")
    fontManager.defaultFont = fontManager.findfont(font)

from enthought.traits.api import Str, Instance, Dict, HasTraits, Int
from enthought.traits.ui.api import Item, ShellEditor, View, VSplit, HSplit, Tabbed, InstanceEditor

import struct

from output_stream import OutputStream
from tracking_view import TrackingView
from almanac_view import AlmanacView
from solution_view import SolutionView
import flash


class SwiftConsole(HasTraits):
예제 #5
0
        from gtk import rc_parse, MenuBar
        m = MenuBar()
        if m.rc_get_style().bg[0].red_float < 0.5: # only customize dark bg
            rc_parse(os.path.join(os.path.dirname(__file__),"images/gtkrc"))
        m.destroy()

# workaround bug in kiva's font manager that fails to find a correct default font on linux
if os.name=="posix":
    import warnings
    def devnull(*args):
        pass
    warnings.showwarning = devnull
    from  enthought.kiva.fonttools.font_manager import fontManager, FontProperties
    try:
        font = FontProperties()
        font.set_name("DejaVu Sans")
        fontManager.defaultFont = fontManager.findfont(font)
        fontManager.warnings = None
    except: # this code will throw exception on ETS4, which has actually fixed fontmanager
        pass

from enthought.pyface.api import GUI
from window import open_file



def main():
    import optparse
    parser = optparse.OptionParser(usage="""\
%prog [options] [trace.txt|trace.txt.gz|trace.txt.lzma|trace.dat]