Beispiel #1
0
	def __init__(self):
		self.builder = gtk.Builder() 
		self.builder.add_from_file(localpath + 'zkiosk.ui')
		self.window = self.builder.get_object('window')
		self.browser = self.builder.get_object('Browser') 
		self.webview = webkit.WebView()
		self.browser.add(self.webview)

		#Cambia el user-agent (por cuestión estética y de identificación para estadísticas)
		Settings = self.webview.get_settings()		
		useragent = Settings.get_property("user-agent")
		useragent = useragent.replace(' Safari/',' zombieKiosk/DrunkEngine Safari/')
		Settings.set_property("user-agent",useragent)
		Settings.set_property("enable-plugins",False)
		#cambiando a pantalla completa la ventana
		maxx = gtk.gdk.screen_width() 
		maxy = gtk.gdk.screen_height() 
		self.window.set_size_request(maxx,maxy) 
		
		#Parseamos el archivo del estilo visual
		gtk.rc_reset_styles(self.window.get_settings())
		gtk.rc_parse(theme)
		gtk.rc_add_default_file(theme)
		gtk.rc_reparse_all()
		
		#muestra los elementos de la ventana
		self.window.show_all()
		#-------DEBUG---------
		self.webview.connect("navigation-policy-decision-requested",self.VerUri)
		#conectando los botones y eventos de la ventana a las funciones 
		self.builder.connect_signals(self)
Beispiel #2
0
    def init(self):
        settings = self.settings
        config = self.config
        gtkrc = self.datadir + "/interface/table/gtkrc"
        if exists(gtkrc):
            gtk.rc_parse(gtkrc)
        glade_file = self.datadir + "/interface/table/mockup.glade"
        glade = gtk.glade.XML(glade_file)
        glade.signal_autoconnect(self)
        from gamewindow import GameWindowGlade
        self.glade = GameWindowGlade(glade)
        self.glade.signal_autoconnect(self)
        self.actions = {
            "call": self.glade.get_widget("call"),
            "raise": self.glade.get_widget("raise"),
            "raise_range": self.glade.get_widget("raise_range"),
            "raise_increase": self.glade.get_widget("raise_increase"),
            "raise_decrease": self.glade.get_widget("raise_decrease"),
            "raise_increase_bb": self.glade.get_widget("raise_increase_bb"),
            "raise_decrease_bb": self.glade.get_widget("raise_decrease_bb"),
            "raise_pot": self.glade.get_widget("raise_pot"),
            "raise_half_pot": self.glade.get_widget("raise_half_pot"),
            "check": self.glade.get_widget("check"),
            "fold": self.glade.get_widget("fold"),
            }
        self.switch = self.glade.get_widget("switch")
#        self.actions['check'].add_accelerator("clicked", gtk.AccelGroup(), gtk.gdk.keyval_from_name("p"), gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE)

        self.animations = pokeranimation2d.create(self.glade, config, settings)
Beispiel #3
0
def set_default_style():
    module_home = os.path.split(sys.modules[__name__].__file__)[0]
    gtk_rc = os.path.join(module_home, 'gtk_rc')
    with open(gtk_rc, 'rb') as rc_f:
        rc_data = rc_f.read()

    gtk.rc_parse(rc_data)
Beispiel #4
0
    def activate(self):
        """Basic UI setup. 
           Load theme glade file, assign gtk window callbacks.
        """

        # Load the glade file for current theme
        theme_path = self.config()["theme_path"]
        self.theme = theme_path.split("/")[-1]
        gtk.rc_parse(os.path.join(theme_path, "rcfile"))
        gtk.glade.set_custom_handler(self.custom_handler)
        w_tree = gtk.glade.XML(os.path.join(theme_path, "window.glade"))
        get_widget = w_tree.get_widget

        self.switcher = get_widget("switcher")
        self.window = get_widget("window")

        # fullscreen mode
        self.fullscreen = self.config()['fullscreen']
        if self.fullscreen:
            self.window.fullscreen()

        # connect signals to methods
        self.window.connect("delete_event", self.exit_)
        w_tree.signal_autoconnect(dict([(sig, getattr(self, sig + "_cb")) \
            for sig in ("window_state", "window_keypress")]))

        self.question_dialog = get_widget("question_dialog")
        self.information_dialog = get_widget("information_dialog")
        self.question_dialog_label = get_widget("question_dialog_label")
        self.information_dialog_label = get_widget("information_dialog_label")

        self.w_tree = w_tree
Beispiel #5
0
def set_default_style():
    module_home = os.path.split(sys.modules[__name__].__file__)[0]
    gtk_rc = os.path.join(module_home, 'gtk_rc')
    with open(gtk_rc, 'rb') as rc_f:
        rc_data = rc_f.read()

    gtk.rc_parse(rc_data)
    def temp_set(self, widget):
        global nt, fallback_theme
        nt = '"'
        THEME = gtk.IconTheme()
        s = self.treeview.get_selection()
        (ls, iter) = s.get_selected()
        if iter is None:
            print "nothing selected"
        else:
            data1 = ls.get_value(iter, 1)
            nt = nt + data1 + '"'
            file = os.path.expanduser("~") + "/.gtkrc.temp"
            if os.access(file, 0) == False:
                print "creating file"
                os.system("touch " + file)

            filename = open(str(file))
            fallbackline = ""
            for line in filename:
                if line.strip().startswith("gtk-fallback"):
                    fallbackline = line
            filename = open(str(file), "w")
            filename.write("gtk-icon-theme-name = " + nt + "\n")
            filename.write(fallbackline)
            THEME.set_custom_theme(nt)
            print nt
            print "#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#"
            filename.close()
            # gtk.rc_reparse_all_for_settings("gtk-icon-theme-name","~/.gtkrc.mine")
            gtk.rc_parse(file)
            THEME = gtk.IconTheme()
            THEME.set_custom_theme(nt)
            print THEME.list_icons()
            self.themelbl.set_text("Theme Name: " + nt)
Beispiel #7
0
    def __init__(self):
        if os.name == 'nt':
            gtk.rc_parse("gtkrc")

        self.init_cache_dir()

        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
        self.window.set_title('loading...')
        self.window.set_resizable(False)

        self.init_icon()
        self.init_config()
        self.init_menu()

        vbox = gtk.VBox()
        self.window.add(vbox)

        event_box = gtk.EventBox()
        event_box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0, 0, 0))
        vbox.add(event_box)

        self.message_label = gtk.Label('  please wait while loading...  ')
        vbox.pack_start(self.message_label, False, False, 0)

        self.clock_image = gtk.Image()
        event_box.add(self.clock_image)

        self.window.show_all()

        event_box.connect("button-press-event", self.on_button_press_event)
        self.window.connect("delete_event", self.on_main_delete)
        self.window.connect("destroy", self.on_main_destroy)
Beispiel #8
0
 def __init__(self):
     self.gladefile = "button.glade"
     self.w_tree = gtk.glade.XML(self.gladefile)
     self.window = self.w_tree.get_widget("window1")
     self.window.connect("destroy", gtk.main_quit)
     gtk.rc_parse("rcfile")
     self.window.show()
Beispiel #9
0
    def __init__(self):
        # List of signals to be connected
        self._signals = {}
        # Set GTK theme and set static flag to true
        if os.name is not 'posix' and not S4SBase._IS_THEME_APPLIED:
            gtk.rc_parse(self._THEME)
            S4SBase._IS_THEME_APPLIED = True

        self._init_widgets = []
Beispiel #10
0
    def __init__(self):
        """ Load theme's glade file """

        theme_path = config()["theme_path"]
        gtk.rc_parse(os.path.join(theme_path, "rcfile"))
        self.w_tree = gtk.glade.XML(os.path.join(theme_path, "window.glade"))

        # Set unvisible tabs of switcher
        switcher = self.w_tree.get_widget("switcher")
        switcher.set_property('show_tabs', False)
Beispiel #11
0
def extension_python_fu_console():
    import gtk, gimpenums, gimpshelf
    stderr.write(str('Hallo' + '\n'))
    gtk.rc_parse(gimp.gtkrc())
    namespace = {
        '__builtins__': __builtins__,
        '__name__': '__main__',
        '__doc__': None,
        'gimp': gimp,
        'pdb': gimp.pdb,
        'shelf': gimpshelf.shelf
    }
    for s in gimpenums.__dict__.keys():
        if s[0] != '_':
            namespace[s] = getattr(gimpenums, s)

    win = gtk.GtkWindow()
    win.connect("destroy", gtk.mainquit)
    win.set_title("Gimp-Python Console")
    cons = gtkcons.Console(
        namespace=namespace,
        copyright='Gimp Python Extensions - Copyright (C), 1997-1999' +
        ' James Henstridge\n',
        quit_cb=gtk.mainquit)

    def browse(button, cons):
        import gtk, pdbbrowse

        def ok_clicked(button, browse, cons=cons):
            cons.line.set_text(browse.cmd)
            browse.destroy()

        win = pdbbrowse.BrowseWin(ok_button=ok_clicked)
        win.connect("destroy", gtk.mainquit)
        win.set_modal(TRUE)
        win.show()
        gtk.mainloop()

    button = gtk.GtkButton("Browse")
    button.connect("clicked", browse, cons)
    cons.inputbox.pack_end(button, expand=FALSE)
    button.show()
    win.add(cons)
    cons.show()
    win.set_default_size(475, 300)
    win.show()
    cons.init()

    # flush the displays every half second
    def timeout():
        gimp.displays_flush()
        return TRUE

    gtk.timeout_add(500, timeout)
    gtk.mainloop()
Beispiel #12
0
    def configure_gtk(self):
        if not resource_exists(__name__, self.get_assets_path("gtk-2.0", "gtkrc")):
            raise ValueError("GTK theme does not exist")
        gtkrc_file_path = resource_filename(__name__, self.get_assets_path("gtk-2.0", "gtkrc"))
        filename = resource_filename(__name__, self.get_assets_path(
            "icons", "RAFCON_figurative_mark_negative.svg", for_theme=False))
        gtk.window_set_default_icon_from_file(filename)

        # wait for all gtk events being processed before parsing the gtkrc file
        wait_for_gui()
        gtk.rc_parse(gtkrc_file_path)
Beispiel #13
0
def setup_pygtk(required_version):
    import pygtk
    # this is needed for py2exe
    if sys.platform == 'win32':
        os.environ['PATH'] += ";lib;bin;"
    else:
        pygtk.require("2.0")
    import gtk
    gtk.rc_parse("solfege.gtkrc")
    # The rest of this function is just for sanity check. Not really required.
    if gtk.pygtk_version < required_version:
        sys.exit("\n" + "\n ".join(textwrap.wrap(" GNU Solfege requires pygtk version %s or newer. The version installed appears to be %s. Exiting program." % (
            ".".join([str(i) for i in required_version]),
            ".".join([str(i) for i in gtk.pygtk_version])))))
Beispiel #14
0
def setup_pygtk(required_version):
    import pygtk
    # this is needed for py2exe
    if sys.platform == 'win32':
        os.environ['PATH'] += ";lib;bin;"
    else:
        pygtk.require("2.0")
    import gtk
    gtk.rc_parse("solfege.gtkrc")
    # The rest of this function is just for sanity check. Not really required.
    if gtk.pygtk_version < required_version:
        sys.exit("\n" + "\n ".join(textwrap.wrap(" GNU Solfege requires pygtk version %s or newer. The version installed appears to be %s. Exiting program." % (
            ".".join([str(i) for i in required_version]),
            ".".join([str(i) for i in gtk.pygtk_version])))))
Beispiel #15
0
 def load_theme(self) :
     """ Load a gtk theme """
     self.logger.debug('Entering theme load')
     if self._option_dict.has_key('Theme') :
         l_path = os.path.join(self.__THEME_DIR,self._option_dict['Theme'])
         if os.path.exists(l_path) :
             gtk.rc_parse(l_path)
         else :
             msg =  _('Theme %s does not exist'%l_path)
             self.logger.info(msg) 
     else : 
         msg =  _('Impossible to load theme')
         self.logger.info(msg) 
     self.logger.debug('Exiting theme load')
Beispiel #16
0
def import_gtk():
    #set the GTK path stuff specially on windows:
    if System.IS_WINDOWS:
        if ProgramState.INSTALLED:
            Globals.WINDOWS_BIN = ProgramState.INSTALL_DIR
            encodedInstallDir = System.encode_for_filesystem(
                ProgramState.INSTALL_DIR)
            os.environ['GTK2_RC_FILES'] = encodedInstallDir
            os.environ['GTK_PATH'] = encodedInstallDir
            os.environ['GTK_BASEPATH'] = encodedInstallDir
            os.environ['PATH'] = encodedInstallDir
        else:
            os.environ['PATH'] += ";" + Globals.WINDOWS_BIN
        Globals.WINDOWS_BIN = os.path.realpath(Globals.WINDOWS_BIN)
        #import gtk
        import pygtk
        pygtk.require('2.0')
        #NOTE:  this crazy bit is to avoid a warning from GTK, which prints an error.
        #we want to submit error logs if any errors happen, but dont want this particular warning to count
        #because it always happens and is pointless
        #    temp = sys.argv
        #    sys.argv = []
        #funny stuff with system args
        warnings.simplefilter("ignore")
        import gtk
        #    sys.argv = temp
        #reinstate warnings
        warnings.resetwarnings()
        import gobject
        #find and parse the right rc file
        rc_file = os.getcwdu()
        if not ProgramState.INSTALLED:
            rc_file = os.path.join(rc_file, 'windows', 'build', 'dist')
        rc_file = os.path.join(rc_file, 'share', 'themes', 'Default',
                               'gtk-2.0', 'gtkrc')
        gtk.rc_parse(rc_file)
    else:
        #import GTK if possible:
        try:
            #funny stuff with system args
            warnings.simplefilter("ignore")
            import pygtk
            pygtk.require('2.0')
            import gtk, gobject
            #reinstate warnings
            warnings.resetwarnings()
        except ImportError:
            log_msg("Failed to import gtk.", 1)
            ProgramState.USE_GTK = False
Beispiel #17
0
	def __init__(self):
		signal.signal(signal.SIGTERM, gtk.main_quit)

		pids = getPids('tabletLauncher')
		if len(pids) > 1:
			for pid in pids:
				if pid != os.getpid():
					os.kill(pid, signal.SIGTERM)
			sys.exit(0)

		if os.path.exists("/etc/tablet-launcher/gtkrc"):
			gtk.rc_parse("/etc/tablet-launcher/gtkrc")
		parser = make_parser()
		parser.setContentHandler(self)
		parser.parse("/etc/tablet-launcher/commands.xml")
Beispiel #18
0
    def activate(self):
        """Basic UI setup."""

        # load styles
        gtk.rc_parse(os.path.join(self.config()["theme_path"], "rcfile"))
        # create main window
        self.window, self.switcher = widgets.create_main_ui()
        # fullscreen mode
        fullscreen = self.config()['fullscreen']
        if fullscreen:
            self.window.fullscreen()
        # connect signals to methods
        self.window.connect("delete_event", self.exit_)
        self.window.connect('window-state-event', self.window_state_cb)
        self.window.connect('key-press-event', self.window_keypress_cb)

        self.window.show_all()
def gui(self):
    self._ = None

    if platform.system() == 'Darwin':
        self.mac = True
    else:
        self.mac = False

    self.griffith_dir = self.locations['home']    # deprecated

    if self.windows:
        gtk.rc_parse('%s\\gtkrc' % self.locations['exec'])

    gf = os.path.join(self.locations['glade'], 'griffith.glade')
    from widgets import define_widgets
    define_widgets(self, gtk.glade.XML(gf))

    self.pdf_reader = self.config.get('pdf_reader')
Beispiel #20
0
    def __init__(self):
        gtk.rc_parse("/etc/gtk/gtkrc.iso-8859-2")
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        #self.window.set_size_request(380, 380)
        self.window.set_position(gtk.WIN_POS_CENTER)
        self.window.set_resizable(True)

        self.window.connect("destroy", self.close_application)
        self.window.set_title("Wolvix Wireless Config")
        self.window.set_border_width(10)

        self.mainbox = gtk.VBox(False, 10)
        self.populate(self, None)
	self.window.add(self.mainbox)
        self.mainbox.show()         
        self.window.show()

        
Beispiel #21
0
    def __init__(self, graph):
        wtree = gtk.Builder()
        wtree.add_from_file(sibpath(__file__, "vidref.glade"))
        mainwin = wtree.get_object("MainWindow")
        mainwin.connect("destroy", gtk.main_quit)
        wtree.connect_signals(self)
        gtk.rc_parse("theme/marble-ice/gtk-2.0/gtkrc")

        self.recordingTo = wtree.get_object('recordingTo')
        self.musicScale = wtree.get_object("musicScale")
        self.musicScale.connect("value-changed", self.onMusicScaleValue)
        # tiny race here if onMusicScaleValue tries to use musicTime right away
        self.musicTime = MusicTime(onChange=self.onMusicTimeChange, pollCurvecalc=False)
        self.ignoreScaleChanges = False
        # self.attachLog(wtree.get_object("lastLog")) # disabled due to crashing

        # wtree.get_object("replayPanel").show() # demo only
        rp = wtree.get_object("replayVbox")
        self.replayViews = ReplayViews(rp)

        mainwin.show_all()
        vid3 = wtree.get_object("vid3")

        if 0:
            self.pipeline = Pipeline(
                liveVideoXid=vid3.window.xid,
                musicTime=self.musicTime,
                recordingTo=self.recordingTo)
        else:
            self.pipeline = remotepivideo.Pipeline(
                liveVideo=vid3,
                musicTime=self.musicTime,
                recordingTo=self.recordingTo,
                graph=graph)

        vid3.props.width_request = 360
        vid3.props.height_request = 220
        wtree.get_object("frame1").props.height_request = 220
        

        self.pipeline.setInput('v4l') # auto seems to not search for dv

        gobject.timeout_add(1000 // framerate, self.updateLoop)
def gui(self):
    self._ = None

    if os.name in ('mac') or \
            (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
        self.mac = True
    else:
        self.mac = False

    self.griffith_dir = self.locations['home']    # deprecated

    if self.windows:
        gtk.rc_parse('%s\\gtkrc' % self.locations['exec'])

    gf = os.path.join(self.locations['glade'], 'griffith.glade')
    from widgets import define_widgets
    define_widgets(self, gtk.glade.XML(gf))

    self.pdf_reader = self.config.get('pdf_reader')
Beispiel #23
0
    def __init__(self, config=None):
        """Constructor.

        Reads the GUI definition from the GtkBuilder file and creates the GUI,
        registers event handlers and starts periodic tasks to update dynamic
        GUI elements.

        """
        self.config = config

        # read UI definition from GtkBuilder XML file
        ui_file = expanduser(self.config.get('ui_file', UI_FILENAME))

        if not exists(ui_file) and exists(join(ui_dir, ui_file)):
            ui_file = join(ui_dir, ui_file)

        self.ui = gtk.Builder()
        self.ui.add_from_file(ui_file)
        self.window = self.ui.get_object('mainwin')
        self.window.connect("destroy", self.quit)

        self.statusbar = self.ui.get_object('statusbar')
        self.aboutdialog = self.ui.get_object('aboutdialog')
        self.aboutdialog.set_name(__app_name__)
        self.aboutdialog.set_version(__version__)

        # parse Gtk+ RC file
        rc_file = expanduser(self.config.get('rc_file', GTKRC_FILENAME))

        if not exists(rc_file) and exists(join(ui_dir, rc_file)):
            rc_file = join(ui_dir, rc_file)

        gtk.rc_parse(rc_file)

        # attach signal handlers
        self.ui.connect_signals(self)

        # set up periodic tasks
        gobject.timeout_add(1000, self.set_time)
        self.set_time()

        self.window.set_title(__app_name__)
        self.window.show_all()
Beispiel #24
0
def gui(self):
    self._ = None

    if os.name in ('mac') or \
            (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
        self.mac = True
    else:
        self.mac = False

    self.griffith_dir = self.locations['home']  # deprecated

    if self.windows:
        gtk.rc_parse('%s\\gtkrc' % self.locations['exec'])

    gf = os.path.join(self.locations['glade'], 'griffith.glade')
    from widgets import define_widgets
    define_widgets(self, gtk.glade.XML(gf))

    self.pdf_reader = self.config.get('pdf_reader')
def load_theme(theme):
    try:
        if globals.config.debug:
            print _("Loading theme %s") % theme
        path = None
        for p in globals.paths.themes:
            try:
                path = os.path.join(p, theme, "gtkrc")
                if os.path.isfile(path):
                    break
                else:
                    path = None
            except:
                path = None
        if path is None or not os.path.isfile(path):
            raise
        gtk.rc_reset_styles(gtk.settings_get_default())
        gtk.rc_parse(path)
    except:
        print _("Warning: unable to load theme %s, using default" % theme)
Beispiel #26
0
    def __init__(self):
        if os.name == 'nt':
            gtk.rc_parse("gtkrc")

        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_title(self.main_title)
        self.window.set_size_request(500, 400)

        self.vbox = gtk.VBox(False, 0)
        self.vbox.show()

        self.init_ui_manager()

        self.list_view = gtk.TreeView()
        self.list_view.show()

        self.scrolled_window = gtk.ScrolledWindow()
        self.scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,
                                        gtk.POLICY_AUTOMATIC)
        self.scrolled_window.add(self.list_view)
        self.scrolled_window.show()

        self.content_box = gtk.VBox(False, 0)
        self.content_box.pack_start(self.scrolled_window, True, True, 0)
        self.content_box.show()

        self.vbox.pack_start(self.content_box, True, True, 0)

        self.statusbar = gtk.Statusbar()
        self.statusbar_context_id = self.statusbar.get_context_id(
            'SimpleDBFBrowser')
        self.statusbar.push(self.statusbar_context_id,
                            'SimpleDBFBrowser v%s' % self.version)
        self.statusbar.pop(self.statusbar_context_id)
        self.statusbar.show()
        self.vbox.pack_start(self.statusbar, False, True, 0)

        self.window.connect("delete_event", gtk.main_quit)

        self.window.add(self.vbox)
        self.window.show()
    def __init__(self):
        if os.name == 'nt':
            gtk.rc_parse("gtkrc")

        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_title(self.main_title)
        self.window.set_size_request(500,400)

        self.vbox = gtk.VBox(False, 0)
        self.vbox.show()

        self.init_ui_manager()

        self.list_view = gtk.TreeView()
        self.list_view.show()

        self.scrolled_window = gtk.ScrolledWindow()
        self.scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.scrolled_window.add(self.list_view)
        self.scrolled_window.show()

        self.content_box = gtk.VBox(False, 0)
        self.content_box.pack_start(self.scrolled_window, True, True, 0)
        self.content_box.show()

        self.vbox.pack_start(self.content_box, True, True, 0)

        self.statusbar = gtk.Statusbar()
        self.statusbar_context_id = self.statusbar.get_context_id('SimpleDBFBrowser')
        self.statusbar.push(self.statusbar_context_id, 'SimpleDBFBrowser v%s' % self.version)
        self.statusbar.pop(self.statusbar_context_id)
        self.statusbar.show()
        self.vbox.pack_start(self.statusbar, False, True, 0)

        self.window.connect("delete_event", gtk.main_quit)

        self.window.add(self.vbox)
        self.window.show()
def gui(self):
	self._ = None
	self.debug.show("running on %s - %s" % (os.name, platform.system()))
	if os.name == 'nt' or os.name.startswith('win'):
		self.windows = True
	else:
		self.windows = False
		
	if platform.system() == 'Darwin':
		self.mac = True
	else:
		self.mac = False
	
	self.griffith_dir = self.locations['home']	# deprecated
	
	if self.windows:
		gtk.rc_parse('%s\\gtkrc' % self.locations['exec'])


	gf = os.path.join(self.locations['glade'], 'griffith.glade')
	from widgets import define_widgets
	define_widgets(self, gtk.glade.XML(gf))

	self.pdf_reader = self.config.get('pdf_reader')
Beispiel #29
0
def main():
    '''
    Main method which creates the GUI
    '''
    gtk.rc_parse(MainGUI.RC_FILE)
    directories = [
        Storage.DIR_CALIBRATION, Storage.DIR_DST, Storage.DIR_TABLES,
        Storage.DIR_OUTPUT_TABLES, Storage.DIR_RESULTS
    ]
    window = MainGUI.MainGUI("HEGS_Manager",
                             "HEGSGUI",
                             directories,
                             "HEGS Manager",
                             xrootd=False)

    window.add_page("Analysis", AnalyseWindow(window))
    window.add_page("Maps Generation", MapsWindow(window))
    #    window.add_page("Time Maps Generation", TimeMapsWindow(window))
    window.add_page("Tools", ToolsWindow(window))
    window.add_page("Calibration", CalibCheckWindow(window))
    #    window.init(envtab=EnvironmentGUI(window))
    window.init()
    gobject.threads_init()
    gtk.main()
def gui(self):
    self._ = None
    self.debug.show("running on %s - %s" % (os.name, platform.system()))
    if os.name == "nt" or os.name.startswith("win"):
        self.windows = True
    else:
        self.windows = False

    if platform.system() == "Darwin":
        self.mac = True
    else:
        self.mac = False

    self.griffith_dir = self.locations["home"]  # deprecated

    if self.windows:
        gtk.rc_parse("%s\\gtkrc" % self.locations["exec"])

    gf = os.path.join(self.locations["glade"], "griffith.glade")
    from widgets import define_widgets

    define_widgets(self, gtk.glade.XML(gf))

    self.pdf_reader = self.config.get("pdf_reader")
Beispiel #31
0
def showtheme(theme, reparse=False):
    home = preparedirs()
    if theme.isdigit():
        dirs = sorteddirlist()
        if int(theme)-1 < len(dirs):
           theme = dirs[int(theme)-1]
        else:
           return _("No theme for entry '%s'") % theme, None
    fl = None
    for t in theme_dirs:
        f = os.path.join(t, theme, "gtk-2.0", "gtkrc")
        if  os.path.exists(f):
            fl = f
    if not fl:
        return _("No theme for entry '%s'") % theme, None
    else:
        return gtk.rc_parse(fl), theme
Beispiel #32
0
            dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK,msg)
        elif Tipo==2:
            dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_CLOSE,msg)
        elif Tipo==3:
            dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO,msg)
        elif Tipo==4:
            dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK_CANCEL,msg)
        dialog.connect('response', lambda dialog, response: dialog.destroy())
        dialog.show()
        return dialog
            
    def Salir(self,*args):
        #True
        if self.Llamada<>"":
            self.ventana.hide()
            self.Cliente=""
            self.Importe=""
            self.Llamada=""
            return True
        else:
            gtk.main_quit()

    def Main(self):
        self.Llamada=""
        gtk.main()
        
if __name__ == "__main__":
    gtk.rc_parse("gtkrc.txt")
    ven = Remesas()
    ven.Main()
Beispiel #33
0
def main():
    """ creates a HAL component.
        parsees a glade XML file with gtk.builder or libglade
        calls gladevcp.makepins with the specified XML file
        to create pins and register callbacks.
        main window must be called "window1"
    """
    global gladevcp_debug
    (progdir, progname) = os.path.split(sys.argv[0])

    usage = "usage: %prog [options] myfile.ui"
    parser = OptionParser(usage=usage)
    parser.disable_interspersed_args()
    parser.add_options(options)

    (opts, args) = parser.parse_args()

    if not args:
        parser.print_help()
        sys.exit(1)

    gladevcp_debug = debug = opts.debug
    xmlname = args[0]

    #if there was no component name specified use the xml file name
    if opts.component is None:
        opts.component = os.path.splitext(os.path.basename(xmlname))[0]

    #try loading as a libglade project
    try:
        builder = gtk.glade.XML(xmlname)
        builder = GladeBuilder(builder)
    except:
        try:
            # try loading as a gtk.builder project
            print "**** GLADE VCP INFO:    Not a libglade project, trying to load as a GTK builder project"
            builder = gtk.Builder()
            builder.add_from_file(xmlname)
        except:
            print "**** GLADE VCP ERROR:    With xml file: %s" % xmlname
            sys.exit(0)

    window = builder.get_object("window1")

    window.set_title(opts.component)

    try:
        halcomp = hal.component(opts.component)
    except:
        print "*** GLADE VCP ERROR:    Asking for a HAL component using a name that already exists."
        sys.exit(0)

    panel = gladevcp.makepins.GladePanel(halcomp, xmlname, builder, None)

    # at this point, any glade HL widgets and their pins are set up.
    handlers = load_handlers(opts.usermod, halcomp, builder, opts.useropts)

    builder.connect_signals(handlers)

    if opts.parent:
        # block X errors since gdk error handling silently exits the
        # program without even the atexit handler given a chance
        gtk.gdk.error_trap_push()

        window = xembed.reparent(window, opts.parent)

        forward = os.environ.get('AXIS_FORWARD_EVENTS_TO', None)
        if forward:
            xembed.keyboard_forward(window, forward)

    window.connect("destroy", on_window_destroy)
    window.show()

    # for window resize and or position options
    if "+" in opts.geometry:
        try:
            j = opts.geometry.partition("+")
            pos = j[2].partition("+")
            window.move(int(pos[0]), int(pos[2]))
        except:
            print "**** GLADE VCP ERROR:    With window position data"
            parser.print_usage()
            sys.exit(1)
    if "x" in opts.geometry:
        try:
            if "+" in opts.geometry:
                j = opts.geometry.partition("+")
                t = j[0].partition("x")
            else:
                t = window_geometry.partition("x")
            window.resize(int(t[0]), int(t[2]))
        except:
            print "**** GLADE VCP ERROR:    With window resize data"
            parser.print_usage()
            sys.exit(1)

    if opts.gtk_workaround:
        # work around https://bugs.launchpad.net/ubuntu/+source/pygtk/+bug/507739
        # this makes widget and widget_class matches in gtkrc and theme files actually work
        dbg("activating GTK bug workaround for gtkrc files")
        for o in builder.get_objects():
            if isinstance(o, gtk.Widget):
                # retrieving the name works only for GtkBuilder files, not for
                # libglade files, so be cautious about it
                name = gtk.Buildable.get_name(o)
                if name: o.set_name(name)

    if opts.gtk_rc:
        dbg("**** GLADE VCP INFO: %s reading gtkrc file '%s'" %
            (opts.component, opts.gtk_rc))
        gtk.rc_add_default_file(opts.gtk_rc)
        gtk.rc_parse(opts.gtk_rc)

    if opts.theme:
        dbg("**** GLADE VCP INFO:    Switching %s to '%s' theme" %
            (opts.component, opts.theme))
        settings = gtk.settings_get_default()
        settings.set_string_property("gtk-theme-name", opts.theme, "")
    # This needs to be done after geometry moves so on dual screens the window maxumizes to the actual used screen size.
    if opts.maximum:
        window.window.maximize()

    if opts.halfile:
        cmd = ["halcmd", "-f", opts.halfile]
        res = subprocess.call(cmd, stdout=sys.stdout, stderr=sys.stderr)
        if res:
            print >> sys.stderr, "'%s' exited with %d" % (' '.join(cmd), res)
            sys.exit(res)

    # User components are set up so report that we are ready
    halcomp.ready()

    if handlers.has_key(signal_func):
        dbg("Register callback '%s' for SIGINT and SIGTERM" % (signal_func))
        signal.signal(signal.SIGTERM, handlers[signal_func])
        signal.signal(signal.SIGINT, handlers[signal_func])

    try:
        gtk.main()
    except KeyboardInterrupt:
        sys.exit(0)
    finally:
        halcomp.exit()

    if opts.parent:
        gtk.gdk.flush()
        error = gtk.gdk.error_trap_pop()
        if error:
            print "**** GLADE VCP ERROR:    X Protocol Error: %s" % str(error)
Beispiel #34
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()
Beispiel #35
0
def rc_setup(rc_resource):
    """Run gtk.rc_parse on the resource, to setup the gtk settings."""
    gtk.rc_parse(rc_resource)
Beispiel #36
0
            return self.widgets[name]
        return self.glade.get_widget(name)

    def relative_file(self, file):
        return self.glade.relative_file(file)

    def signal_autoconnect(self, instance):
        for name, widget in self.widgets.iteritems():
            method = getattr(instance, "on_%s_clicked" % name, None)
            if method: widget.connect("clicked", method)


if __name__ == '__main__':
    glade = GameWindowGlade(gtk.glade.XML('data/interface/table/mockup.glade'))
    event_box = glade.get_widget('game_window')
    window = gtk.Window()
    window.add(event_box)
    gtk.rc_parse('data/interface/table/gtkrc')
    for seat_index in xrange(0, 10):
        for card_index in xrange(1, 8):
            glade.get_widget("card%d_seat%d" %
                             (card_index, seat_index)).set_from_file(
                                 'data/interface/table/card_back.png')
    window.show_all()
    gtk.main()

# Interpreted by emacs
# Local Variables:
# compile-command: "/usr/bin/python gamewindow.py"
# End:
        self.style.paint_box_gap(window,
                                gtk.STATE_NORMAL,
                                gtk.SHADOW_OUT,
                                event.area,
                                self,
                                'layoutwidget',
                                self.allocation.x,self.allocation.y,
                                self.allocation.width,label_allocation.height + (label_allocation.y-self.allocation.y)+self._space/2,
                                gtk.POS_BOTTOM,
                                0,self.allocation.width)
        return gtk.Bin.do_expose_event(self,event)

gobject.type_register(LayoutWidget)

if __name__ == '__main__':
    gtk.rc_parse(sys.argv[1])
    win = gtk.Window()
    lw = LayoutWidget()
    lw.set_markup("<b><big>test</big></b>")
    al = gtk.Alignment(0.5,0.5,1.0,1.0)
    al.set_padding(30,20,30,30)
    l = gtk.Label("jjjjjjjjjjjjjjjjjjjjjjjjj")
    lw.show()
    lw.add(l)
    al.add(lw)
    win.add(al)
    win.show_all()
    print lw.path()
    print lw._get_label_widget_requisition()
    gtk.main()
Beispiel #38
0
# 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)
Beispiel #39
0
	def __init__(self):
		gtk.rc_parse("/etc/gtk/gtkrc.iso-8859-2")
		message = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_NONE,
		"WARNING: This program is in development. Use it at your own \n\
risk. Installation of a live CD to hard disk is never entirely \n\
without risk - live CDs are generally not designed to be installed\n\
to HD. Having said that, this program has been tested as \n\
thoroughly as possible, without error. Continue?")
		message.add_button(gtk.STOCK_YES, gtk.RESPONSE_ACCEPT)
		message.add_button(gtk.STOCK_NO, gtk.RESPONSE_REJECT)
		resp = message.run()
		message.destroy()
		if (resp == gtk.RESPONSE_REJECT):
			self.close_application(self, None)
		self.wolvix_size = 0.0
		self.homepoint = ""
		self.partitionok = False
		self.last_percent=0
		self.size=""
		self.fs = "ext3"
		self.used = "0"
		self.timer = gobject
		self.space=0
		self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
		#self.window.set_size_request(560, 560)
		self.window.set_position(gtk.WIN_POS_CENTER)
		self.window.set_resizable(True)

		self.window.connect("destroy", self.close_application)
		self.window.set_title("Wolvix LiveCD Hard Disk Installer")
		self.window.set_border_width(10)

		self.mainbox = gtk.VBox(False, 0)
		self.topbox = gtk.HBox(False, 0)
		
		self.leftbox = gtk.VBox(False, 5)
		self.make_leftbox(self, None)
		
		self.rightbox = gtk.VBox(False, 10)
		self.sw = gtk.ScrolledWindow()
		self.sw.set_shadow_type(gtk.SHADOW_IN)
		self.sw.set_size_request(330, 320)
		self.sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
		self.textview = gtk.TextView()
		self.textview.set_wrap_mode(gtk.WRAP_WORD)
		self.textbuffer = gtk.TextBuffer()
		self.textbuffer.set_text("This is the Wolvix LiveCD hard disk installer. \
This utility is in development...Use with care!\n\n\
This installation log will be saved to /var/log/installer.log \
on your new system after the installer completes. If you have a \
problem, read this file as a first step to finding what went wrong.\n\n\
You must perform the following steps to use this installer:\n\n\
1: Select the device from which your system boots.\n\n\
2: Select a target partition for wolvix.\n\
(Run the gparted utility if you need to create/view partitions).\n\n\
3: Optionally, you may choose to locate your home directory on a separate \
partition. This will enable you to keep all your personal settings & files \
if you reinstall Wolvix at a later date.\n\n\
4: Select a swap partition - not strictly necessary, but strongly recommended.\n\n\
5: Select filesystem to use - if you're not sure, ext3 is a good choice. \n\n\
6: Choose bootloader options - if you choose not to install a bootloader \
to the hard disk (and you don't already have a bootloader which you can \
configure to boot Wolvix) you will need to make a boot disk. This is recommended \
in any case for use in emergencies.\n\n\
7: Click 'Start Install' and go get a coffee while your Wolvix system is installed.\n\n\
8: Reboot. Enjoy!\n\n")
		self.textbuffer.connect("changed", self.TextBufferChange, None)
		self.textview.set_buffer(self.textbuffer)
		self.sw.add(self.textview)
		self.rightbox.pack_start(self.sw, True, True, 10)
		self.sw.show()
		self.textview.show()
		self.topbox.pack_start(self.leftbox, False, False, 10)
		self.topbox.pack_end(self.rightbox, True, True, 10)
		self.leftbox.show()
		self.rightbox.show()
		self.partsel.connect("changed", self.PartSelClick, None)
		self.homesel.connect("changed", self.HomeSelClick, None)
		self.swapsel.connect("changed", self.SwapSelClick, None)
		self.fssel.connect("changed", self.FSSelClick, None)

		self.middlebox = gtk.HBox(False, 10)
		self.pbar = gtk.ProgressBar()
		self.middlebox.pack_start(self.pbar, True, True, 10)
		self.pbar.show()
		
		self.bottombox = gtk.HBox(False, 10)
		self.button4 = gtk.Button("Run gparted?")
		self.button4.set_size_request(110, 30)
		self.button4.connect_object("clicked", self.Button4Click, self.window, None)
		self.button4.set_flags(gtk.CAN_DEFAULT)
		self.bottombox.pack_start(self.button4, True, False, 10)
		self.button4.show()
		self.button5 = gtk.Button("7: Start Install")
		self.button5.set_size_request(110, 30)
		self.button5.connect("clicked", self.Button5Click)
		self.bottombox.pack_start(self.button5, True, False, 10)
		self.button5.show()
		self.button6 = gtk.Button("Help")
		self.button6.set_size_request(110, 30)
		self.button6.connect("clicked", self.Button6Click)
		self.bottombox.pack_start(self.button6, True, False, 10)
		self.button6.show()
		self.button8 = gtk.Button("Close")
		self.button8.set_size_request(110, 30)
		self.button8.connect("clicked", self.close_application)
		self.button8.set_flags(gtk.CAN_DEFAULT)
		self.bottombox.pack_start(self.button8, True, False, 10)
		self.button8.show()

		self.mainbox.pack_start(self.topbox, True, True, 0)
		self.topbox.show()
		self.mainbox.pack_start(self.middlebox,  False, False, 10)
		self.middlebox.show()
		self.mainbox.pack_start(self.bottombox, False, False, 0)
		self.bottombox.show()

		self.window.add(self.mainbox)
		self.mainbox.show()
		self.window.show()

		self.get_wolvix_size(None)
Beispiel #40
0
    sys.exit(1)

import gobject      # for using custom signals
import pango        # for adjusting the text alignment in CellRendererText
import gio          # for inquiring mime types information
import cairo

import poppler      #for the rendering of pdf pages
from pypdf113.pdf import PdfFileWriter, PdfFileReader

from pdfshuffler_iconview import CellRendererImage
gobject.type_register(CellRendererImage)

import time

gtk.rc_parse("./gtkrc")

class PdfShuffler:
    prefs = {
        'window width': min(700, gtk.gdk.screen_get_default().get_width() / 2),
        'window height': min(600, gtk.gdk.screen_get_default().get_height() - 50),
        'window x': 0,
        'window y': 0,
        'initial thumbnail size': 300,
        'initial zoom level': -14,
    }

    MODEL_ROW_INTERN = 1001
    MODEL_ROW_EXTERN = 1002
    TEXT_URI_LIST = 1003
    MODEL_ROW_MOTION = 1004
Beispiel #41
0
    def __init__(self):
	
	try:
	    if ( not os.path.exists(os.path.expanduser("~/.ruleuser")) ):
		os.makedirs(os.path.expanduser("~/.ruleuser"))
	except:
	    print "System error create folder "+os.path.expanduser("~/.ruleuser")
	    raise SystemExit

	
	self.logger = logging.getLogger('MyLogger')
	self.logger.setLevel(logging.DEBUG)
	handler = logFileHandler(logFile, maxBytes=100000)
	self.logger.addHandler(handler)

	self.config = ConfigParser.SafeConfigParser(cfg_defaults)
	self.config.read(configFile)
	
	#
	self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
	self.window.set_icon(gtk.gdk.pixbuf_new_from_file(icon_path+"ruleuser_16.png"))
	# 
	self.global_widget()
	
	#statusicon = gtk.StatusIcon()
	#statusIcon = gtk.status_icon_new_from_file(icon_path+"ruleuser_16.png")
	#statusicon.set_visible(True)
		
	# Курсор
	self.cursor_wait_status = False
	
	# Сохранение списка
	self.save_userList_busy = False
	
	# 
	self.entry_error_busy = False
	
	# Секунды
	self.demo_check_interval = 1
	self.timers_check_interval = 1
	
	# userList
	# Первые 10 лучше не менять местами
	self.z = [
		'alias',
		'user',
		'host',
		'ip',
		'server',
		'client',
		'client_id',
		'mac',
		'desktop',
		'group',
		    
		'host_port',
		'server_port',
		'server_user',
		'host_user',
		'dhcp',
		    
		'vnc_pass',
		'vnc_pass_file',
		'vnc_command',
		'vnc_client',
		'over_server',
		    
		'vnc_normal',
		'vnc_ssh',
		'timeout',
		'vnc_server',
		'vncport',
		    
		'server_key',
		'host_key',
		'27',
		'display',
		'uid',
		    
		'console_server',
		'console_host',
		'ssh_key_root',
		'folder_user',
		'show_local_sessions',

		'vnc_gtk_color',
		'vnc_autostart',
		'vnc_gtk_lossy',
		'vnc_gtk_pointer',
		'dhcp_arp',

		'vnc_gtk_pointer_grab',
		'vnc_gtk_keyboard_grab',
		'start_time',
		'vnc_server_window',
		'vnc_client_window',

		'dynamic_user',
		'vnc_autostart_command',
		'vnc_nx_thin',
		'vnc_nx_scan',
		'ping',
		
		# временные
		'demo_user',
		'demo_ip',
		'demo_ssh_port',
		'demo_port',
		'54',

		'demo_key',
		'demo_mode',
		'demo_address',
		'demo_server_pid',
		'demo_client_pid',
		#
		
		'60',
		'61',
		'62',
		'63',
		'64',

		'vnc_gtk_encoding',
		'vnc_nx_autostart',
		'67',
		'68',
		'69',

		'70',
		'71',
		'72',
		'73',
		'74',

		'75',
		'76',
		'77',
		'78',
		'79',

		'demo_vlc',
		'demo_vlc_fps',
		'demo_vlc_vcodec',
		'demo_vlc_scale_full',
		'demo_vlc_scale_window',

		'demo_vlc_audio',
		'demo_vlc_caching',
		'demo_vlc_rtp',
		'demo_ssh',
		'89',

		'demo_vlc_client',
		'demo_vlc_client_command',
		'92',
		'93',
		'94',

		'95',
		'96',
		'97',
		'98',
		'demo_pixbuf'
		]
	
	self.dn = {}
        for x in range(len(self.z)):
    	    self.dn[self.z[x]] = int(x)

	self.scale_list = [
    		"1280x1024",
    		"720x576",
    		"640x512",
    		"-",
    		"1024x768",
    		"800x600",
    		"640x480",
    		"-",
    		"1680x1050",
    		"1440x900",
    		"1280x800",
    		"1024x640",
    		"768x480",
    		"640x400",
    		"-",
    		"1920x1080",
    		"1366x768",
    		"1280x720",
    		"1024x576",
    		"854x480",
    		"640x360"
    		]


    	self.null = [None,""]
    	self.true = ["y", "True", True]
    	self.false = ["n", "False", False]
		    
	self.mount_point = None

	self.local_console = ""
	proc = subprocess.Popen(['which', 'konsole', 'gnome-terminal'], stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
	proc.wait()
	out = proc.stdout.read()
	if ( "konsole" in out ):
	    self.local_console = "konsole --noclose -e "
	elif ( "gnome-terminal" in out):
	    self.local_console = "gnome-terminal -x "
	else:
	    self.local_console = "xterm -e "
	
	try:
	    self.local_hostname = socket.gethostname()
	    self.local_ip = socket.gethostbyname(self.local_hostname)
	except:
	    self.local_hostname = ""
	    self.local_ip = ""
	    
	self.localhost = [
	    'localhost',
	    '127.0.0.1',
	    self.local_hostname,
	    self.local_ip]

	self.local_user = os.environ.get("USER")
	self.local_display = os.environ.get("DISPLAY")
	self.local_home = os.environ.get("HOME")
		
	self.arp_command = "/sbin/arp -a "
	self.nmap_command= "nmap "
	self.wol_command = "wol "
	self.who_command = "who "
	self.ps_command = "ps "
	self.netstat_command = "netstat "
    	

	self.known_desktop = ["kde3", "kde4", "gnome2", "gnome3", "lxde", "xfce", "linux", "windows", "unknown"]
	self.unknown_desktop = ["windows", "unknown"]

	self.message_system = {
		'kde3': 'kdialog --msgbox ',
		'kde4': 'kdialog --msgbox ',
		'gnome2': 'zenity --info --text ',
		'gnome3': 'zenity --info --text ',
		'lxde': 'zenity --info --text ',
		'xfce': 'zenity --info --text ',
		'linux': 'xmessage -center '
		}
	
	#свернуть все окна - qdbus org.kde.plasma-desktop /App local.PlasmaApp.toggleDashboard;
	self.lock = {
		'kde3': 'dcop kdesktop KScreensaverIface lock',
		'kde4': 'qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock;qdbus org.freedesktop.ScreenSaver /ScreenSaver SetActive 1',
		'gnome2': 'gnome-screensaver;gnome-screensaver-command -a',
		'gnome3': 'gnome-screensaver;gnome-screensaver-command -a',
		'lxde': 'xscreensaver-command -lock',
		'xfce': 'xscreensaver-command -lock',
		'linux': 'xscreensaver-command -lock'
		}

	self.unlock = {
		'kde3': 'killall -s 15 -u $USER kdesktop_lock',
		'kde4': 'killall -s 15 -u $USER kscreenlocker',
		'gnome2': 'killall -s 15 -u $USER gnome-screensaver',
		'gnome3': 'killall -s 15 -u $USER gnome-screensaver',
		'lxde': 'killall -s 15 -u $USER xscreensaver;xscreensaver &',
		'xfce': 'killall -s 15 -u $USER xscreensaver;xscreensaver &',
		'linux': 'killall -s 15 -u $USER xscreensaver;xscreensaver &'
		}


	self.logout = {
		'kde3': 'dcop ksmserver default logout 0 0 0',
		'kde4': 'qdbus org.kde.ksmserver /KSMServer logout 0 0 0',
		'gnome2': 'killall gnome-session',
		'gnome3': 'gnome-session-quit --logout --force --no-prompt',
		'lxde': 'pkill -9 -u $USER',
		'xfce': 'pkill -9 -u $USER',
		'linux': 'pkill -9 -u $USER'
		}
	
	# Тема
	self.gtkrc = self.read_config("window","gtkrc")
	if ( self.gtkrc != "" ):
	    gtk.rc_parse(os.path.expanduser(self.gtkrc))
	    
	self.phandle_size = 0
    	gtk.rc_parse_string("style 'my_style' {\n"
			    "GtkPaned::handle-size = 0\n"
                            " }\n"
                            "widget '*' style 'my_style'")
    	gtk.rc_parse_string("gtk-menu-bar-accel = ''")
    
	self.slider_size = 15
    	gtk.rc_parse_string("style 'my_style' {\n"
			    "GtkScrollbar::slider-width = 15\n"
			    "GtkScrollbar::trough-border = 0\n"
                            " }\n"
                            "widget '*' style 'my_style'")
	# F10 отключить
    	gtk.rc_parse_string("gtk-menu-bar-accel = ''")
Beispiel #42
0
from progenitus.client import gui as clientgui
from progenitus.editor import gui as editorgui
from progenitus.updater import gui as updatergui

import glib
import gio
import gtk


# Change current directory to this script's location
if os.name == 'posix':
	os.chdir(os.path.dirname(os.path.realpath(__file__)))

# Initialize gtk properly on windows
if os.name == 'nt':
	gtk.rc_parse("gtkrc")
	gtk.rc_find_module_in_path(".")

async.method_queuer = glib.idle_add
gtk.gdk.threads_init()


# Command line argument parser
optparser = optparse.OptionParser(
	version=config.VERSION,
	description=_("Deck editor and network client for "
		"Wizard of the Coast's Magic the Gathering trading card game"),
	add_help_option=True,
	epilog=_("Written by TheGurke 2011, GPL3-licenced.")
)
optparser.add_option("--editor", action="store_const", const="editor",
Beispiel #43
0
def rc_setup(rc_resource):
    """Run gtk.rc_parse on the resource, to setup the gtk settings."""
    gtk.rc_parse(rc_resource)
Beispiel #44
0
###############################################################################
# Detalles de configuración:
# os.environ['LANG'] = "es_ES"
# os.environ['LANGUAGE'] = 'es_ES'
settings = gtk.settings_get_default()
try:
    settings.props.gtk_button_images = True
except AttributeError:  # Versión anterior de GTK.
    pass
# Si hay ficheros de estilo gtk, los cargo por orden: General de la
# aplicación y específico del usuario en WIN y UNIX. Se machacan opciones
# de por ese orden.
GTKRC = "gtkrc"
# gtk.rc_parse(os.path.join("..", GTKRC))
gtk.rc_parse(GTKRC)
if "HOME" in os.environ:
    gtk.rc_parse(os.path.join(os.environ["HOME"], GTKRC))
if "HOMEPATH" in os.environ:
    gtk.rc_parse(os.path.join(os.environ["HOMEPATH"], GTKRC))
# Ver http://www.pygtk.org/docs/pygtk/class-gtkrcstyle.html para la
# referencia de estilos. Ejemplo:
# bogado@cpus006:~/Geotexan/geotexinn02/formularios$ cat ../gtkrc
# style 'blanco_y_negro' { bg[NORMAL] = '#FFFFFF'
#                          fg[NORMAL] = '#000000'
#                          base[NORMAL] = '#FFFFFF'
#                          text[NORMAL] = '#000000'
#                        }
# class '*' style 'blanco_y_negro'
###############################################################################
# TODO: Esto de parsear el gtkrc está repetido aquí y en el menu.py. Debería dejarlo en un solo sitio y tener cuidado con el tema MS-Windows en Windows 8, Vista y algunos XP. La solución pasa por poner el tema Industrial o Redmond con el GTK2-prefs.exe. O bien usar esto:
Beispiel #45
0
from ginga import FitsImage
from ginga import cmap, imap
from ginga.misc import Bunch

moduleHome = os.path.split(sys.modules[__name__].__file__)[0]
sys.path.insert(0, moduleHome)
childDir = os.path.join(moduleHome, 'plugins')
sys.path.insert(0, childDir)

from ginga.gtkw import FitsImageCanvasGtk, ColorBar, Readout, FileSelection, \
     PluginManagerGtk, GtkHelp, GtkMain, FitsImageCanvasTypesGtk

icon_path = os.path.abspath(os.path.join(moduleHome, '..', 'icons'))
rc_file = os.path.join(moduleHome, "gtk_rc")
if os.path.exists(rc_file):
    gtk.rc_parse(rc_file) 

try:
    screen = gtk.gdk.screen_get_default()
    screen_ht = screen.get_height()
    screen_wd = screen.get_width()
    root = None
except:
    screen_wd = 1600
    screen_ht = 1200
#print "screen dimensions %dx%d" % (screen_wd, screen_ht)

default_height = min(900, screen_ht - 100)
default_width  = min(1600, screen_wd)

# svg not supported well on pygtk/MacOSX yet
Beispiel #46
0
        if can_autoinstall:
            self._autoinstall = True
            glib.timeout_add(300, self.action_auto_install)

        gtk.main()


gobject.type_register(MainFrameMod)

if '__main__' == __name__:

    def timeout_func(obj):
        mfm.fresh_ui()
        return True

    #gtk.rc_parse('Luna/gtk-2.0/gtkrc')
    gtk.rc_parse('gtkrc/gtkrc')
    win = gtk.Window()
    glib.threads_init()
    mfm = MainUIFrame(insenv)
    win.add(mfm.install_box)
    mfm.install_progressbar.set_fraction(0.50)
    mfm.install_progress_button.set_sensitive(True)
    #glib.timeout_add(1000*5,timeout_func,mfm)
    label = gtk.Label("\n\nHello,World !\n\n")
    mfm.install_info_pad.add(label)
    label.show()
    win.show()
    print mfm.install_info_pad.path()
    gtk.main()
Beispiel #47
0
    if opts.gtk_workaround:
        # work around https://bugs.launchpad.net/ubuntu/+source/pygtk/+bug/507739
        # this makes widget and widget_class matches in gtkrc and theme files actually work
        dbg("activating GTK bug workaround for gtkrc files")
        for o in builder.get_objects():
            if isinstance(o, gtk.Widget):
                # retrieving the name works only for GtkBuilder files, not for
                # libglade files, so be cautious about it
                name = gtk.Buildable.get_name(o)
                if name: o.set_name(name)

    if opts.gtk_rc:
        dbg("**** GLADE VCP INFO: %s reading gtkrc file '%s'" %
            (opts.component, opts.gtk_rc))
        gtk.rc_add_default_file(opts.gtk_rc)
        gtk.rc_parse(opts.gtk_rc)

    if opts.theme:
        dbg("**** GLADE VCP INFO:    Switching %s to '%s' theme" %
            (opts.component, opts.theme))
        settings = gtk.settings_get_default()
        settings.set_string_property("gtk-theme-name", opts.theme, "")

    # This needs to be done after geometry moves so on dual screens the window maxumizes to the actual used screen size.
    if opts.maximum:
        window.window.maximize()

    if opts.halfile:
        cmd = ["halcmd", "-f", opts.halfile]
        res = subprocess.call(cmd, stdout=sys.stdout, stderr=sys.stderr)
        if res:
Beispiel #48
0
from ginga import cmap, imap
from ginga.misc import Bunch
from ginga.util.six.moves import map, zip

moduleHome = os.path.split(sys.modules[__name__].__file__)[0]
sys.path.insert(0, moduleHome)
childDir = os.path.join(moduleHome, 'plugins')
sys.path.insert(0, childDir)

from ginga.gtkw import ImageViewCanvasGtk, ColorBar, Readout, FileSelection, \
     PluginManagerGtk, GtkHelp, GtkMain, ImageViewCanvasTypesGtk

icon_path = os.path.abspath(os.path.join(moduleHome, '..', 'icons'))
rc_file = os.path.join(moduleHome, "gtk_rc")
if os.path.exists(rc_file):
    gtk.rc_parse(rc_file) 

root = None

# svg not supported well on pygtk/MacOSX yet
#icon_ext = '.svg'
icon_ext = '.png'

class GingaViewError(Exception):
    pass

class GingaView(GtkMain.GtkMain):
     
    def __init__(self, logger, ev_quit):
        GtkMain.GtkMain.__init__(self, logger=logger, ev_quit=ev_quit)
        # defaults
Beispiel #49
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()
Beispiel #50
0
    try_gtk_imports()
   
   
    gobject.threads_init() # enable threads for gtk
    
    #init global definitions:
    Globals.initialize(determine_path())
    
    #init logging
    Log(loglevel)
    
    if sys.platform == 'win32':
        #apply gtk style for win32 (wimp theme)
        gtkrcpath = os.path.normpath(os.path.join(Globals.resource_dir, \
                                                               'win_gtk/gtkrc'))
        gtk.rc_parse(gtkrcpath)
    
    window = Window() # create the urtsb window
    guicontroller = GuiController() # initialize the gui controller
    guicontroller.setWindow(window)  
       
    gtk.main() # run the gtk main loop
    
    #on exit save the window size informations
    Log.log.info('Exiting....')
    fm = FileManager()
    Log.log.debug('Saving window size informations')
    fm.save_window_sizing()
    
if __name__ == "__main__":
    start()
Beispiel #51
0
    if opts.gtk_workaround:
        # work around https://bugs.launchpad.net/ubuntu/+source/pygtk/+bug/507739
        # this makes widget and widget_class matches in gtkrc and theme files actually work
        dbg( "activating GTK bug workaround for gtkrc files")
        for o in builder.get_objects():
            if isinstance(o, gtk.Widget):
                # retrieving the name works only for GtkBuilder files, not for
                # libglade files, so be cautious about it
                name = gtk.Buildable.get_name(o)
                if name: o.set_name(name)

    if opts.gtk_rc:
        dbg( "**** GLADE VCP INFO: %s reading gtkrc file '%s'" %(opts.component,opts.gtk_rc))
        gtk.rc_add_default_file(opts.gtk_rc)
        gtk.rc_parse(opts.gtk_rc)

    if opts.theme:
        dbg("**** GLADE VCP INFO:    Switching %s to '%s' theme" %(opts.component,opts.theme))
        settings = gtk.settings_get_default()
        settings.set_string_property("gtk-theme-name", opts.theme, "")

    # This needs to be done after geometry moves so on dual screens the window maxumizes to the actual used screen size.
    if opts.maximum:
        window.window.maximize()
    if opts.always_above_flag:
        window.set_keep_above(True)
    if opts.halfile:
        if opts.halfile[-4:] == ".tcl":
            cmd = ["haltcl", opts.halfile]
        else:
Beispiel #52
0
    def __init__(self):
        rcfile = '/usr/share/themes/Xfce-smooth/gtk-2.0/gtkrc'
        gtk.rc_parse(rcfile)

        self._isChecking = False
        self._isPhraseKey = True  #False
        self.DashVelocity = VelocityManage.VelocityManage()
        self.keyState = ArrowKey()

        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("destroy", self.destroy)
        self.window.set_border_width(10)
        self.window.set_title('Dash Control')
        self.window.set_default_size(1600, 940)
        self.window.add_events(gtk.gdk.KEY_PRESS_MASK)
        self.window.connect('key-press-event', self.onPressKey)
        self.window.connect('key-release-event', self.onReleaseKey)

        #Core
        self.cmd = DashCommandSender()
        #Core End

        #Panel Layout
        mainPanel = gtk.VBox(False, 10)
        firstRow = gtk.HBox(False, 10)
        secondRow = gtk.HBox(False, 10)
        thirdRow = gtk.HBox(False, 10)
        self.window.add(mainPanel)
        #Panel Layout End

        #First Row
        self.clEventbox = gtk.EventBox()
        self.connectLabel = gtk.Label(' No connection ')
        self.clEventbox.add(self.connectLabel)
        self.clEventbox.modify_bg(gtk.STATE_NORMAL,
                                  gtk.gdk.color_parse('black'))
        self.connectLabel.modify_fg(gtk.STATE_NORMAL,
                                    gtk.gdk.color_parse('white'))
        self.connectLabel.set_justify(gtk.JUSTIFY_CENTER)
        self.connectLabel.set_markup(
            "<span font_desc=\"24.0\">No connection</span>")
        firstRow.pack_start(self.clEventbox, False, True)
        self.connectButton = gtk.Button(' Connect ')
        self.connectButton.get_children()[0].set_markup(
            "<span font_desc=\"24.0\"> Connect </span>")
        self.connectButton.connect('clicked', self.onConnect, None)
        firstRow.pack_start(self.connectButton, True, True)
        #First Row End

        #Second Row
        self.speedAdj = gtk.Adjustment(0, 0, 400, 1, 100, 4)
        self.speedScale = gtk.HScale(self.speedAdj)
        secondRow.pack_start(self.speedScale, True, True)
        #Second Row End

        #Third Row
        self.goButton = gtk.ToggleButton(label='Go', use_underline=True)
        self.goButton.get_children()[0].modify_fg(gtk.STATE_NORMAL,
                                                  gtk.gdk.color_parse('white'))
        self.goButton.get_children()[0].modify_fg(gtk.STATE_ACTIVE,
                                                  gtk.gdk.color_parse('white'))
        self.goButton.get_children()[0].modify_fg(gtk.STATE_PRELIGHT,
                                                  gtk.gdk.color_parse('white'))
        self.goButton.modify_bg(gtk.STATE_NORMAL,
                                gtk.gdk.color_parse('#0080FF'))
        self.goButton.modify_bg(gtk.STATE_ACTIVE,
                                gtk.gdk.color_parse('#FF8000'))
        self.goButton.modify_bg(gtk.STATE_PRELIGHT,
                                gtk.gdk.color_parse('#FF8000'))
        self.goButton.get_children()[0].set_markup(
            "<span font_desc=\"24.0\"> Go </span>")
        thirdRow.pack_start(self.goButton, True, True)
        #Third Row End

        #Pack Panel
        mainPanel.pack_start(firstRow, False, False)
        mainPanel.pack_start(secondRow, False, False)
        mainPanel.pack_start(thirdRow, False, False)
        #Pack Panel End

        #Show All
        self.connectButton.show()
        self.connectLabel.show()
        self.clEventbox.show()
        self.goButton.show()
        self.speedScale.show()
        firstRow.show()
        secondRow.show()
        thirdRow.show()
        mainPanel.show()
        self.window.show()
Beispiel #53
0
def _interact(func_name):
	(blurb, help, author, copyright, date,
	 menupath, imagetypes, plugin_type,
	 params, results, function) = _registered_plugins_[func_name]

	# short circuit for no parameters ...
	if len(params) == 0: return []

	import gtk
	import gimpui

	gtk.rc_parse(gimp.gtkrc())
	
	defaults = _get_defaults(func_name)
	# define a mapping of param types to edit objects ...
	class StringEntry(gtk.GtkEntry):
		def __init__(self, default=''):
			import gtk
			gtk.GtkEntry.__init__(self)
			self.set_text(str(default))
		def get_value(self):
			return self.get_text()
	class IntEntry(StringEntry):
		def get_value(self):
			import string
			return string.atoi(self.get_text())
	class FloatEntry(StringEntry):
		def get_value(self):
			import string
			return string.atof(self.get_text())
	class ArrayEntry(StringEntry):
		def get_value(self):
			return eval(self.get_text())
	class SliderEntry(gtk.GtkHScale):
		# bounds is (upper, lower, step)
		def __init__(self, default=0, bounds=(0, 100, 5)):
			import gtk
			self.adj = gtk.GtkAdjustment(default, bounds[0],
						     bounds[1], bounds[2],
						     bounds[2], bounds[2])
			gtk.GtkHScale.__init__(self, self.adj)
		def get_value(self):
			return self.adj.value
	class SpinnerEntry(gtk.GtkSpinButton):
		# bounds is (upper, lower, step)
		def __init__(self, default=0, bounds=(0, 100, 5)):
			import gtk
			self.adj = gtk.GtkAdjustment(default, bounds[0],
						     bounds[1], bounds[2],
						     bounds[2], bounds[2])
			gtk.GtkSpinButton.__init__(self, self.adj, 1, 0)
		def get_value(self):
			return int(self.adj.value)
	class ToggleEntry(gtk.GtkToggleButton):
		def __init__(self, default=0):
			import gtk
			gtk.GtkToggleButton.__init__(self)
			self.label = gtk.GtkLabel("No")
			self.add(self.label)
			self.label.show()
			self.connect("toggled", self.changed)
			self.set_active(default)
		def changed(self, tog):
			if tog.active:
				self.label.set_text("Yes")
			else:
				self.label.set_text("No")
		def get_value(self):
			return self.get_active()

	_edit_mapping = {
		PF_INT8        : IntEntry,
		PF_INT16       : IntEntry,
		PF_INT32       : IntEntry,
		PF_FLOAT       : FloatEntry,
		PF_STRING      : StringEntry,
		PF_INT8ARRAY   : ArrayEntry,
		PF_INT16ARRAY  : ArrayEntry,
		PF_INT32ARRAY  : ArrayEntry,
		PF_FLOATARRAY  : ArrayEntry,
		PF_STRINGARRAY : ArrayEntry,
		PF_COLOUR      : gimpui.ColourSelector,
		PF_REGION      : IntEntry,  # should handle differently ...
		PF_IMAGE       : gimpui.ImageSelector,
		PF_LAYER       : gimpui.LayerSelector,
		PF_CHANNEL     : gimpui.ChannelSelector,
		PF_DRAWABLE    : gimpui.DrawableSelector,

		PF_TOGGLE      : ToggleEntry,
		PF_SLIDER      : SliderEntry,
		PF_SPINNER     : SpinnerEntry,
	
		PF_FONT        : gimpui.FontSelector,
		PF_FILE        : gimpui.FileSelector,
		PF_BRUSH       : gimpui.BrushSelector,
		PF_PATTERN     : gimpui.PatternSelector,
		PF_GRADIENT    : gimpui.GradientSelector,
	}

	tooltips = gtk.GtkTooltips()

	dialog = gtk.GtkDialog()
	dialog.set_title(func_name)
	table = gtk.GtkTable(len(params), 3, gtk.FALSE)
	table.set_border_width(5)
	table.set_row_spacings(2)
	table.set_col_spacings(10)
	dialog.vbox.pack_start(table)
	table.show()

	vbox = gtk.GtkVBox(gtk.FALSE, 15)
	table.attach(vbox, 0,1, 0,len(params), xoptions=gtk.FILL)
	vbox.show()
	pix = _get_logo(vbox.get_colormap())
	vbox.pack_start(pix, expand=gtk.FALSE)
	pix.show()
	
	label = gtk.GtkLabel(blurb)
	label.set_line_wrap(TRUE)
	label.set_justify(gtk.JUSTIFY_LEFT)
	label.set_usize(100, -1)
	vbox.pack_start(label, expand=gtk.FALSE)
	label.show()

	edit_wids = []
	for i in range(len(params)):
		type = params[i][0]
		name = params[i][1]
		desc = params[i][2]
		def_val = defaults[i]

		label = gtk.GtkLabel(name)
		label.set_alignment(1.0, 0.5)
		table.attach(label, 1,2, i,i+1, xoptions=gtk.FILL)
		label.show()

		if type in (PF_SPINNER, PF_SLIDER):
			wid = _edit_mapping[type](def_val, params[i][4])
		else:
			wid = _edit_mapping[type](def_val)
		table.attach(wid, 2,3, i,i+1)
		tooltips.set_tip(wid, desc, None)
		wid.show()
		edit_wids.append(wid)

	def delete_event(win, event=None):
		import gtk
		win.hide()
		gtk.mainquit()
		return TRUE

	# this is a hack ...
	finished = [ 0 ]
	def ok_clicked(button, win=dialog, finished=finished):
		import gtk
		win.hide()
		finished[0] = 1
		gtk.mainquit()
	b = gtk.GtkButton("OK")
	b.set_flags(gtk.CAN_DEFAULT)
	dialog.action_area.pack_start(b)
	b.grab_default()
	b.connect("clicked", ok_clicked)
	b.show()

	b = gtk.GtkButton("Cancel")
	b.set_flags(gtk.CAN_DEFAULT)
	dialog.action_area.pack_start(b)
	b.connect("clicked", delete_event)
	b.show()

	dialog.show()
	tooltips.enable()
	# run the main loop
	gtk.mainloop()
	ret = None
	if finished[0]:
		# OK was clicked
		ret = map(lambda wid: wid.get_value(), edit_wids)
		_set_defaults(func_name, ret)
	dialog.destroy()
	return ret
Beispiel #54
0
    def _setup_widgets(self):
        """
        create all the window staticaly placed widgets.
        """
        #load the saved setting before start.
        self.set_settings(Utils.load_conffile(CONF_FILENAME))

        # basic window definitions
        self.connect("destroy", self.destroy)
        self.connect("focus_in_event", self.on_window_focus)
        self.connect("configure_event", self.on_window_resize)

        self.set_default_size(self.win_size[0], self.win_size[1])
        self.set_keep_above(True)

        #self.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
        self.move(self.win_pos[0], self.win_pos[1])

        # parse gimp theme gtkrc
        gtkrc_path = self._get_theme_gtkrc(gimp.personal_rc_file('themerc'))

        if os.name != 'nt':  # try apply the theme by parse a gtkrc file if is not a windows system.
            gtk.rc_parse(gtkrc_path)
        else:  # if error occur them parse the file in another way.
            gtk.rc_add_default_file(gtkrc_path)
            gtk.rc_reparse_all()

        # start creating basic layout
        base = gtk.VBox()

        # commands bar widgets
        cbar = gtk.HBox()
        cbar.pack_start(self._setup_playbackbar(), False, False, 10)
        cbar.pack_start(self._setup_editbar(), False, False, 10)
        cbar.pack_start(self._setup_onionskin(), False, False, 10)
        cbar.pack_start(self._setup_config(), False, False, 10)
        cbar.pack_start(self._setup_generalbar(), False, False, 10)

        # frames bar widgets
        self.frame_bar = gtk.HBox()
        scroll_window = gtk.ScrolledWindow()
        scroll_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroll_window.add_with_viewport(self.frame_bar)
        scroll_window.set_size_request(-1, 140)

        # mount the widgets together
        base.pack_start(cbar, False, False, 0)
        base.pack_start(scroll_window, True, True, 0)
        self.add(base)

        # invert the image so onionskin can be used propely, with backward frames be
        # above the actual frame, sinse GIMP upper layers are firstly visible they cant
        # be backward frames.
        pdb.script_fu_reverse_layers(self.image, None)
        # scan all layers
        self._scan_image_layers()
        self.active = 0
        self.on_goto(None, GIMP_ACTIVE)

        # finalize showing all widgets
        self.show_all()
Beispiel #55
0
 def readGtkRCFiles(self, *args):
     for file in plugins.findDataPaths([".gtkrc-2.0*"], *args):
         gtk.rc_parse(file)
Beispiel #56
0
 def theme_ui(self):
     theme = os.path.join(THEMES_DIR, "default.gtkrc")
     gtk.rc_parse(theme)