Example #1
0
   def __init__(self,gyotoytop):
      GObject.set_application_name("Gyotoy")
      GObject.set_prgname("Gyotoy")

      self.gyotoytop = gyotoytop
      self._pyk_blocked=0
      self.length_unit="geometrical"

      # read GUI definition
      self.builder = Gtk.Builder()
      self.builder.add_from_file(os.path.join(self.gyotoytop,'gyotoy.xml'))
      
      # handle destroy event (so that we can kill the window through window bar)
      self.window = self.builder.get_object('window1')
      if (self.window):
         self.window.connect('destroy', self.destroy)

      # autoconnect to callback functions
      # this will automatically connect the event handler "on_something_event"
      # to the here-defined function of the same name. This avoid defining a
      # long dictionary that serves the same purpose
      self.builder.connect_signals(self)

      # set stdin non blocking, this will prevent readline to block
      # stdin is coming from yorick (yorick spawned this python process)
      fd = sys.stdin.fileno()
      flags = fcntl.fcntl(fd, fcntl.F_GETFL)
      fcntl.fcntl(fd, fcntl.F_SETFL, flags | os.O_NONBLOCK)
      
      # ... and add stdin to the event loop (yorick input pipe by spawn)
      GObject.io_add_watch(sys.stdin,GObject.IO_IN|GObject.IO_HUP,self.yo2py,None)

      # run: realize the interface, start event management
      Gtk.main()
Example #2
0
#    You must obey the GNU General Public License in all respects for all of
#    the code used other than OpenSSL. If you modify file(s) with this
#    exception, you may extend this exception to your version of the file(s),
#    but you are not obligated to do so. If you do not wish to do so, delete
#    this exception statement from your version. If you delete this exception
#    statement from all source files in the program, then also delete it here.
#
#
from deluge.log import LOG as log

import gi
gi.require_version("Gtk", "3.0")
gi.require_version("Gdk", "3.0")

from gi.repository import GObject
GObject.set_prgname("deluge")

# Install the twisted reactor
from twisted.internet import gtk3reactor

try:
    from twisted.internet.error import ReactorAlreadyInstalledError
except ImportError:
    # ReactorAlreadyInstalledError not available in Twisted version < 10
    pass

try:
    reactor = gtk3reactor.install()
except ReactorAlreadyInstalledError:
    # Running unit tests so trial already installed a rector
    pass
Example #3
0
from locale import gettext as _

log = logging.getLogger(__name__)

instance = None
RESPONSE_FORWARD = 0
RESPONSE_BACKWARD = 1

# Disable find feature until python-vte hasn't been updated
enable_find = False

GObject.threads_init()

# Setting gobject program name
GObject.set_prgname(NAME)

GDK_WINDOW_STATE_WITHDRAWN = 1
GDK_WINDOW_STATE_ICONIFIED = 2
GDK_WINDOW_STATE_STICKY = 8
GDK_WINDOW_STATE_ABOVE = 32

# Transparency max level (should be always 100)
MAX_TRANSPARENCY = 100


class Guake(SimpleGladeApp):
    """Guake main class. Handles specialy the main window.
    """
    def __init__(self):
        def load_schema():
Example #4
0
File: sagi.py Project: LucaGas/Sagi
# 
# Sagi is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along
# with this program.  If not, see <http://www.gnu.org/licenses/>.

from gi.repository import Gtk, GdkPixbuf, Gdk
import os, sys
from gi.repository import GObject as gobject

from xdg import BaseDirectory
import ConfigParser
gobject.set_prgname("sagi")



#Aria Object
import aria as Aria



#Comment the first line and uncomment the second before installing
#or making the tarball (alternatively, use project variables)
#UI_FILE = "src/sagi.ui"
UI_FILE = "/usr/local/share/sagi/ui/sagi.ui"

class Config(object):
    def __init__(self):
Example #5
0
File: gajim.py Project: irl/gajim
                except Exception as details:
                    self._error = details
            if self._file is not None:
                self._file.write(text)
                self._file.flush()
        def flush(self):
            if self._file is not None:
                self._file.flush()

    sys.stderr = MyStderr()

# PyGTK2.10+ only throws a warning
warnings.filterwarnings('error', module='gtk')
try:
    from gi.repository import GObject
    GObject.set_prgname('gajim')
    from gi.repository import Gtk
    from gi.repository import Gdk
    from gi.repository import GLib
except Warning as msg2:
    if str(msg2) == 'could not open display':
        print(_('Gajim needs X server to run. Quiting...'), file=sys.stderr)
    else:
        print(_('importing PyGTK failed: %s') % str(msg2), file=sys.stderr)
    sys.exit()
warnings.resetwarnings()


if os.name == 'nt':
    warnings.filterwarnings(action='ignore')
Example #6
0
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Main application code that ties all the other modules together."""

from __future__ import division

from version import APPNAME, PACKAGE, VERSION
from build_info import PKG_DATA_DIR, REVISION

import gettext
gettext.bindtextdomain(PACKAGE)
gettext.textdomain(PACKAGE)

from gi.repository import GObject, GtkClutter

GObject.threads_init()
GObject.set_prgname(PACKAGE)
GtkClutter.init([])

from gi.repository import Gtk, Gdk
from gi.repository import GdkPixbuf
from gi.repository import Champlain
from os.path import join, basename, abspath
from gettext import gettext as _
from time import clock
from sys import argv

# "If I have seen a little further it is by standing on the shoulders of Giants."
#                                    --- Isaac Newton

from photos import Photograph
from xmlfiles import GPXFile, KMLFile
Example #7
0
                except Exception as details:
                    self._error = details
            if self._file is not None:
                self._file.write(text)
                self._file.flush()
        def flush(self):
            if self._file is not None:
                self._file.flush()

    sys.stderr = MyStderr()

# PyGTK2.10+ only throws a warning
warnings.filterwarnings('error', module='Gtk')
try:
    from gi.repository import GObject
    GObject.set_prgname('gajim')
    from gi.repository import Gtk
    from gi.repository import Gdk
    from gi.repository import GLib
except Warning as msg2:
    if str(msg2) == 'could not open display':
        print(_('Gajim needs X server to run. Quiting...'), file=sys.stderr)
    else:
        print(_('importing PyGTK failed: %s') % str(msg2), file=sys.stderr)
    sys.exit()
warnings.resetwarnings()


if os.name == 'nt':
    warnings.filterwarnings(action='ignore')
Example #8
0
"""Main application code that ties all the other modules together."""

from __future__ import division

from version import APPNAME, PACKAGE, VERSION
from build_info import PKG_DATA_DIR, REVISION

import gettext
gettext.bindtextdomain(PACKAGE)
gettext.textdomain(PACKAGE)

from gi.repository import GObject, GtkClutter

GObject.threads_init()
GObject.set_prgname(PACKAGE)
GtkClutter.init([])

from gi.repository import Gtk, Gdk
from gi.repository import GdkPixbuf
from gi.repository import Champlain
from os.path import join, basename, abspath
from gettext import gettext as _
from time import clock
from sys import argv

# "If I have seen a little further it is by standing on the shoulders of Giants."
#                                    --- Isaac Newton

from photos import Photograph
from xmlfiles import GPXFile, KMLFile
Example #9
0
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.


import sys, os, subprocess
from gettext import gettext as _

from gi.repository import Gtk, Gdk,GObject

from . import config

from . import control
#import ctxsearch.etc as etc

# If you are only interested in Ctrl-c finishing your application and you don't
# need special cleanup handlers, the following will perhaps work for you:
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)

GObject.set_application_name('Context Search')
GObject.set_prgname('ctxsearch')

cfgdir = os.path.join(os.getenv("HOME"), ".ctxsearch")
#cfgdir = "_config"

cfg = config.Config(cfgdir)

control.Control(cfg)

Gtk.main()
Example #10
0
### END LICENSE

import gettext
from gi.repository import Gtk, GObject, Notify

from gmailwatcher.app.preferences import new_preferences_dialog
from gmailwatcher.app.webview import new_webview
from gmailwatcher.app.indicator import new_application_indicator
from gmailwatcher.lib import gmail_imap as gmail_watcher
from gmailwatcher.lib.helpers import get_builder
from gmailwatcher.lib import consts

#gettext.bindtextdomain("gmailwatcher", "/usr/share/locale")
gettext.textdomain('gmailwatcher')
Notify.init('gmailwatcher')
GObject.set_prgname('gmailwatcher')
GObject.set_application_name('Gmail Watcher')


class MainApp(object):
    """
    Main class that of the applications
    Handles all the callbacks and main window UI chrome
    """

    def __init__(self, main_loop, application, args=[]):
        self.main_loop = main_loop
        self.builder = Gtk.Builder()
        self.builder.add_from_file(get_builder('MainApp.glade'))
        self.builder.connect_signals(self)
Example #11
0
#
#   This library is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   Library General Public License for more details.
#
#   You should have received a copy of the GNU Library General Public
#   License along with this library; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

from gi.repository import GObject

# Set program name for gnome shell (before importing gtk, which seems to
# call set_prgname on its own)
if hasattr(GObject, "set_prgname"):
    GObject.set_prgname("Connection Manager")

from gi.repository import Gtk, Gdk
from StringIO import StringIO

import gconf
import os.path
import shutil
import json

import itertools
import re
import sys

VERSION = "0.7.4"
#
#   This library is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   Library General Public License for more details.
#
#   You should have received a copy of the GNU Library General Public
#   License along with this library; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

from gi.repository import GObject

# Set program name for gnome shell (before importing gtk, which seems to
# call set_prgname on its own)
if hasattr(GObject, "set_prgname"):
    GObject.set_prgname('Connection Manager')

from gi.repository import Gtk, Gdk
from StringIO import StringIO

import gconf
import os.path
import shutil
import json

import itertools
import re
import sys

VERSION = '0.8'
Example #13
0
#    You must obey the GNU General Public License in all respects for all of
#    the code used other than OpenSSL. If you modify file(s) with this
#    exception, you may extend this exception to your version of the file(s),
#    but you are not obligated to do so. If you do not wish to do so, delete
#    this exception statement from your version. If you delete this exception
#    statement from all source files in the program, then also delete it here.
#
#
from deluge.log import LOG as log

import gi
gi.require_version("Gtk", "3.0")
gi.require_version("Gdk", "3.0")

from gi.repository import GObject
GObject.set_prgname("deluge")

# Install the twisted reactor
from twisted.internet import gtk3reactor

try:
    from twisted.internet.error import ReactorAlreadyInstalledError
except ImportError:
    # ReactorAlreadyInstalledError not available in Twisted version < 10
    pass

try:
    reactor = gtk3reactor.install()
except ReactorAlreadyInstalledError:
    # Running unit tests so trial already installed a rector
    pass
Example #14
0
from locale import gettext as _

log = logging.getLogger(__name__)

instance = None
RESPONSE_FORWARD = 0
RESPONSE_BACKWARD = 1

# Disable find feature until python-vte hasn't been updated
enable_find = False

GObject.threads_init()

# Setting gobject program name
GObject.set_prgname(NAME)

GDK_WINDOW_STATE_WITHDRAWN = 1
GDK_WINDOW_STATE_ICONIFIED = 2
GDK_WINDOW_STATE_STICKY = 8
GDK_WINDOW_STATE_ABOVE = 32


class Guake(SimpleGladeApp):

    """Guake main class. Handles specialy the main window.
    """

    def __init__(self):

        def load_schema():