mirror of
https://github.com/Guake/guake.git
synced 2025-10-26 11:27:13 +00:00
commit
3ec8b38fb0
10
.travis.yml
10
.travis.yml
@ -8,12 +8,14 @@ virtualenv:
|
||||
compiler:
|
||||
- gcc
|
||||
before_install:
|
||||
- sudo apt-get install -qq build-essential python autoconf
|
||||
- sudo apt-get install -qq gnome-common gtk-doc-tools libglib2.0-dev libgtk2.0-dev libgconf2-dev
|
||||
- sudo apt-get install -qq python-gtk2 python-gtk2-dev python-vte python-appindicator
|
||||
- sudo apt-get install -qq python3-dev
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq --fix-missing build-essential python autoconf
|
||||
- sudo apt-get install -qq --fix-missing gnome-common gtk-doc-tools libglib2.0-dev libgtk2.0-dev libgconf2-dev
|
||||
- sudo apt-get install -qq --fix-missing python-gtk2 python-gtk2-dev python-vte python-appindicator
|
||||
- sudo apt-get install -qq --fix-missing python3-dev
|
||||
install:
|
||||
- pip install -r python-requirements.txt --use-mirrors
|
||||
- find /usr/include
|
||||
script:
|
||||
- ./validate.sh
|
||||
- ./autogen.sh && ./configure && make
|
||||
|
||||
20
README.rst
20
README.rst
@ -72,7 +72,7 @@ dependencies::
|
||||
|
||||
sudo apt-get build-dep guake
|
||||
|
||||
For manual dependency listing (Ubuntu 13.10)::
|
||||
For compiling from these sources, please install the following packages (Ubuntu 13.10)::
|
||||
|
||||
sudo apt-get install build-essential python autoconf
|
||||
sudo apt-get install gnome-common gtk-doc-tools libglib2.0-dev libgtk2.0-dev libgconf2-dev
|
||||
@ -90,6 +90,10 @@ For Fedora 19 and above, Guake is available in the official repositories and can
|
||||
|
||||
sudo yum install guake
|
||||
|
||||
For compiling from these sources, please install the following packages (Fedora 19)::
|
||||
|
||||
TBD
|
||||
|
||||
ArchLinux
|
||||
---------
|
||||
|
||||
@ -98,8 +102,12 @@ and installed by running::
|
||||
|
||||
sudo pacman -S guake
|
||||
|
||||
For compiling from these sources, please install the following packages (TBD)::
|
||||
|
||||
TBD
|
||||
|
||||
Compilation
|
||||
~~~~~~~~~~~~
|
||||
~~~~~~~~~~~
|
||||
|
||||
We are using an autotools based installation, so if you got the source
|
||||
of guake from a release tarball, please do the following::
|
||||
@ -110,10 +118,10 @@ of guake from a release tarball, please do the following::
|
||||
$ sudo make install
|
||||
|
||||
If you receive a message asking you if you have installed
|
||||
guake.schemas properly when launching guake, it means that your
|
||||
``guake.schemas`` properly when launching guake, it means that your
|
||||
default sysconfdir is different from the one chosen by autotools. To
|
||||
fix that, you probably have to append the param `--sysconfdir=/etc' to
|
||||
your `./configure' call, like this::
|
||||
fix that, you probably have to append the param ``--sysconfdir=/etc`` to
|
||||
your ``./configure`` call, like this::
|
||||
|
||||
$ ./configure --sysconfdir=/etc && make
|
||||
|
||||
@ -122,7 +130,7 @@ file by hand by doing the following::
|
||||
|
||||
# GCONF_CONFIG_SOURCE="" gconftool-2 --makefile-install-rule data/guake.schemas
|
||||
|
||||
For more install details, please read the `INSTALL` file.
|
||||
For more install details, please read the ``INSTALL`` file.
|
||||
|
||||
Git hook
|
||||
~~~~~~~~
|
||||
|
||||
3
dev.sh
3
dev.sh
@ -1,5 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script is used by the main developer to quickly compile and install the current version
|
||||
# of Guake sources. Nothing say it will work directly on your environment. Use with caution!
|
||||
|
||||
[ ! -f configure ] && ./autogen.sh
|
||||
|
||||
make && sudo make install && gconftool-2 --install-schema-file=/usr/local/etc/gconf/schemas/guake.schemas || exit 1
|
||||
|
||||
@ -12,17 +12,16 @@
|
||||
# serve to show the default.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
# needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
@ -35,7 +34,7 @@ templates_path = ['_templates']
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
# source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
@ -55,37 +54,37 @@ release = '0.5.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
# language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
# today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = []
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||
#default_role = None
|
||||
# default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
# add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
# add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
# show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
# modindex_common_prefix = []
|
||||
|
||||
|
||||
# -- Options for HTML output ---------------------------------------------------
|
||||
@ -101,26 +100,26 @@ else:
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
# html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
# html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
# html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
# html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
# html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
# html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
@ -129,44 +128,44 @@ html_static_path = ['_static']
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
# html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
# html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
# html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
# html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
# html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
# html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
# html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
# html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
# html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
# html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
# html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
# html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'guakeonlinedoc'
|
||||
@ -175,42 +174,42 @@ htmlhelp_basename = 'guakeonlinedoc'
|
||||
# -- Options for LaTeX output --------------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
# 'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
# 'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
# 'preamble': '',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'guakeonlinehelp.tex', u'Guake Terminal Documentation',
|
||||
u'Gaetan Semet', 'manual'),
|
||||
('index', 'guakeonlinehelp.tex', u'Guake Terminal Documentation',
|
||||
u'Gaetan Semet', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
# latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
# latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
# latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
# latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
# latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
# latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output --------------------------------------------
|
||||
@ -223,7 +222,7 @@ man_pages = [
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
# man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output ------------------------------------------------
|
||||
@ -232,16 +231,16 @@ man_pages = [
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'guakeonlinehelp', u'Guake Terminal Documentation',
|
||||
u'Gaetan Semet', 'guakeonlinehelp', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
('index', 'guakeonlinehelp', u'Guake Terminal Documentation',
|
||||
u'Gaetan Semet', 'guakeonlinehelp', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
# texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
# texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
# texinfo_show_urls = 'footnote'
|
||||
|
||||
3
pylintrc
3
pylintrc
@ -139,7 +139,8 @@ disable=
|
||||
W1001,
|
||||
W1402,
|
||||
W1501,
|
||||
superfluous-parens
|
||||
superfluous-parens,
|
||||
bad-continuation,
|
||||
|
||||
[REPORTS]
|
||||
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
pylint
|
||||
pep8
|
||||
autopep8
|
||||
pyflakes
|
||||
@ -19,16 +19,12 @@ Boston, MA 02110-1301 USA
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import gtk
|
||||
import gconf
|
||||
import sys
|
||||
import os
|
||||
import locale
|
||||
import gettext
|
||||
import time
|
||||
import subprocess
|
||||
import re
|
||||
import gtk
|
||||
import guake.globals
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Internationalization purposes.
|
||||
_ = gettext.gettext
|
||||
@ -37,10 +33,12 @@ __all__ = ['_', 'ShowableError', 'test_gconf',
|
||||
'pixmapfile', 'gladefile', 'hexify_color',
|
||||
'get_binaries_from_path']
|
||||
|
||||
|
||||
class ShowableError(Exception):
|
||||
|
||||
def __init__(self, title, msg, exit_code=1):
|
||||
d = gtk.MessageDialog(type=gtk.MESSAGE_ERROR,
|
||||
buttons=gtk.BUTTONS_CLOSE)
|
||||
buttons=gtk.BUTTONS_CLOSE)
|
||||
d.set_markup('<b><big>%s</big></b>' % title)
|
||||
d.format_secondary_markup(msg)
|
||||
d.run()
|
||||
@ -48,26 +46,31 @@ class ShowableError(Exception):
|
||||
if exit_code != -1:
|
||||
sys.exit(exit_code)
|
||||
|
||||
|
||||
def test_gconf():
|
||||
c = gconf.client_get_default()
|
||||
return c.dir_exists('/apps/guake')
|
||||
|
||||
|
||||
def pixmapfile(x):
|
||||
f = os.path.join(guake.globals.IMAGE_DIR, x)
|
||||
if not os.path.exists(f):
|
||||
raise IOError('No such file or directory: %s' % f)
|
||||
return os.path.abspath(f)
|
||||
|
||||
|
||||
def gladefile(x):
|
||||
f = os.path.join(guake.globals.GLADE_DIR, x)
|
||||
if not os.path.exists(f):
|
||||
raise IOError('No such file or directory: %s' % f)
|
||||
return os.path.abspath(f)
|
||||
|
||||
|
||||
def hexify_color(c):
|
||||
h = lambda x: hex(x).replace('0x', '').zfill(4)
|
||||
return '#%s%s%s' % (h(c.red), h(c.green), h(c.blue))
|
||||
|
||||
|
||||
def get_binaries_from_path(compiled_re):
|
||||
ret = []
|
||||
for i in os.environ.get('PATH', '').split(os.pathsep):
|
||||
@ -77,9 +80,11 @@ def get_binaries_from_path(compiled_re):
|
||||
ret.append(os.path.join(i, j))
|
||||
return ret
|
||||
|
||||
|
||||
def shell_quote(text):
|
||||
""" quote text (filename) for inserting into a shell """
|
||||
return r"\'".join("'%s'" % p for p in text.split("'"))
|
||||
|
||||
|
||||
def clamp(value, lower, upper):
|
||||
return max(min(value, upper), lower)
|
||||
|
||||
@ -18,16 +18,16 @@ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301 USA
|
||||
"""
|
||||
import dbus
|
||||
import dbus.service
|
||||
import dbus.glib
|
||||
import gtk
|
||||
import guake.common
|
||||
import dbus.service
|
||||
dbus.glib.threads_init()
|
||||
|
||||
DBUS_PATH = '/org/guake/RemoteControl'
|
||||
DBUS_NAME = 'org.guake.RemoteControl'
|
||||
|
||||
|
||||
class DbusManager(dbus.service.Object):
|
||||
|
||||
def __init__(self, guakeinstance):
|
||||
self.guake = guakeinstance
|
||||
self.bus = dbus.SessionBus()
|
||||
|
||||
@ -62,8 +62,9 @@ if you want to test your program when it shoud say to the user that the binding
|
||||
failed, you can simply use this program to bind the key that you're running.
|
||||
Because you can bind a key once.
|
||||
"""
|
||||
import gtk
|
||||
import globalhotkeys
|
||||
import gtk
|
||||
|
||||
|
||||
def hammer(*args):
|
||||
print args
|
||||
|
||||
@ -8,11 +8,12 @@ import pygtk
|
||||
|
||||
pygtk.require('2.0')
|
||||
|
||||
|
||||
class ThemeSwatch(gtk.DrawingArea):
|
||||
|
||||
SWATCH_SIZE = 50 #swatch size
|
||||
SWATCH_GAP = 5 #gap
|
||||
SWATCH_LABEL_SIZE = 10 #text size
|
||||
SWATCH_SIZE = 50 # swatch size
|
||||
SWATCH_GAP = 5 # gap
|
||||
SWATCH_LABEL_SIZE = 10 # text size
|
||||
|
||||
STYLES = (
|
||||
"fg",
|
||||
@ -23,14 +24,14 @@ class ThemeSwatch(gtk.DrawingArea):
|
||||
"text",
|
||||
"base",
|
||||
"text_aa"
|
||||
)
|
||||
)
|
||||
STYLE_STATES = {
|
||||
gtk.STATE_NORMAL:"normal",
|
||||
gtk.STATE_ACTIVE:"active",
|
||||
gtk.STATE_PRELIGHT:"prelight",
|
||||
gtk.STATE_SELECTED:"selected",
|
||||
gtk.STATE_INSENSITIVE:"insensitive"
|
||||
}
|
||||
gtk.STATE_NORMAL: "normal",
|
||||
gtk.STATE_ACTIVE: "active",
|
||||
gtk.STATE_PRELIGHT: "prelight",
|
||||
gtk.STATE_SELECTED: "selected",
|
||||
gtk.STATE_INSENSITIVE: "insensitive"
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
gtk.DrawingArea.__init__(self)
|
||||
@ -38,32 +39,36 @@ class ThemeSwatch(gtk.DrawingArea):
|
||||
|
||||
@classmethod
|
||||
def get_min_size(cls):
|
||||
w = (1+len(cls.STYLE_STATES))*(cls.SWATCH_SIZE + cls.SWATCH_GAP)
|
||||
h = (1+len(cls.STYLES))*(cls.SWATCH_SIZE + cls.SWATCH_GAP)
|
||||
return w,h
|
||||
w = (1 + len(cls.STYLE_STATES)) * (cls.SWATCH_SIZE + cls.SWATCH_GAP)
|
||||
h = (1 + len(cls.STYLES)) * (cls.SWATCH_SIZE + cls.SWATCH_GAP)
|
||||
return w, h
|
||||
|
||||
def color_to_cairo_rgba(self, c, a=1):
|
||||
return c.red/65535.0, c.green/65535.0, c.blue/65535.0, a
|
||||
return c.red / 65535.0, c.green / 65535.0, c.blue / 65535.0, a
|
||||
|
||||
def draw_rect(self, x, y, w, h, color):
|
||||
cr = self.context
|
||||
cr.rectangle(x, y, w, h)
|
||||
cr.set_source_rgba(
|
||||
*self.color_to_cairo_rgba(color)
|
||||
)
|
||||
*self.color_to_cairo_rgba(color)
|
||||
)
|
||||
cr.fill()
|
||||
|
||||
def draw_round_rect(self, x, y, w, h, color, r=15):
|
||||
cr = self.context
|
||||
cr.set_source_rgba(
|
||||
*self.color_to_cairo_rgba(color)
|
||||
)
|
||||
*self.color_to_cairo_rgba(color)
|
||||
)
|
||||
|
||||
cr.move_to(x+r,y)
|
||||
cr.line_to(x+w-r,y); cr.curve_to(x+w,y,x+w,y,x+w,y+r)
|
||||
cr.line_to(x+w,y+h-r); cr.curve_to(x+w,y+h,x+w,y+h,x+w-r,y+h)
|
||||
cr.line_to(x+r,y+h); cr.curve_to(x,y+h,x,y+h,x,y+h-r)
|
||||
cr.line_to(x,y+r); cr.curve_to(x,y,x,y,x+r,y)
|
||||
cr.move_to(x + r, y)
|
||||
cr.line_to(x + w - r, y)
|
||||
cr.curve_to(x + w, y, x + w, y, x + w, y + r)
|
||||
cr.line_to(x + w, y + h - r)
|
||||
cr.curve_to(x + w, y + h, x + w, y + h, x + w - r, y + h)
|
||||
cr.line_to(x + r, y + h)
|
||||
cr.curve_to(x, y + h, x, y + h, x, y + h - r)
|
||||
cr.line_to(x, y + r)
|
||||
cr.curve_to(x, y, x, y, x + r, y)
|
||||
cr.close_path()
|
||||
|
||||
cr.fill()
|
||||
@ -84,53 +89,54 @@ class ThemeSwatch(gtk.DrawingArea):
|
||||
cr = self.context
|
||||
rect = self.get_allocation()
|
||||
|
||||
s = self.SWATCH_SIZE #swatch size
|
||||
g = self.SWATCH_GAP #gap
|
||||
t = self.SWATCH_LABEL_SIZE #text size
|
||||
s = self.SWATCH_SIZE # swatch size
|
||||
g = self.SWATCH_GAP # gap
|
||||
t = self.SWATCH_LABEL_SIZE # text size
|
||||
|
||||
x = rect.x+g
|
||||
x = rect.x + g
|
||||
y = rect.y
|
||||
|
||||
#draw style state labels, x axis
|
||||
#cr.rotate(-30)
|
||||
# draw style state labels, x axis
|
||||
# cr.rotate(-30)
|
||||
cr.set_font_size(t)
|
||||
for state,name in self.STYLE_STATES.items():
|
||||
for state, name in self.STYLE_STATES.items():
|
||||
cr.set_source_rgb(0, 0, 0)
|
||||
cr.move_to(x+0.5, y+s/2+t/2)
|
||||
cr.move_to(x + 0.5, y + s / 2 + t / 2)
|
||||
cr.show_text(name)
|
||||
x += g+s
|
||||
#cr.rotate(30)
|
||||
x += g + s
|
||||
# cr.rotate(30)
|
||||
|
||||
y += s
|
||||
x = rect.x+g
|
||||
x = rect.x + g
|
||||
for name in self.STYLES:
|
||||
colors = getattr(self.style, name, None)
|
||||
if colors:
|
||||
for state in self.STYLE_STATES:
|
||||
color = colors[state]
|
||||
|
||||
#self.draw_rect(x, y, s, s, color)
|
||||
# self.draw_rect(x, y, s, s, color)
|
||||
self.draw_round_rect(x, y, s, s, color)
|
||||
print "[%7s,%11s]" % (name, self.STYLE_STATES[state]) ,
|
||||
print "[%7s,%11s]" % (name, self.STYLE_STATES[state]),
|
||||
|
||||
x += g+s
|
||||
x += g + s
|
||||
|
||||
#draw style labels, y axis
|
||||
# draw style labels, y axis
|
||||
cr.set_source_rgb(0, 0, 0)
|
||||
cr.move_to(x+g, y+s/2+t/2)
|
||||
cr.move_to(x + g, y + s / 2 + t / 2)
|
||||
cr.show_text(name)
|
||||
|
||||
x = rect.x+g
|
||||
y += g+s
|
||||
x = rect.x + g
|
||||
y += g + s
|
||||
print ""
|
||||
|
||||
|
||||
def main():
|
||||
window = gtk.Window()
|
||||
theme = ThemeSwatch()
|
||||
|
||||
window.set_size_request(
|
||||
*theme.get_min_size()
|
||||
)
|
||||
*theme.get_min_size()
|
||||
)
|
||||
window.add(theme)
|
||||
|
||||
window.connect("destroy", gtk.main_quit)
|
||||
|
||||
@ -24,9 +24,9 @@ pynotify.init("Guake")
|
||||
|
||||
__all__ = ['show_message']
|
||||
|
||||
RETRY_INTERVAL = 3 # seconds
|
||||
RETRY_INTERVAL = 3 # seconds
|
||||
|
||||
retry_limit = 5 # tries
|
||||
retry_limit = 5 # tries
|
||||
|
||||
|
||||
def show_message(brief, body=None, icon=None):
|
||||
|
||||
@ -160,6 +160,7 @@ PALETTES = [
|
||||
|
||||
|
||||
class PrefsCallbacks(object):
|
||||
|
||||
"""Holds callbacks that will be used in the PrefsDialg class.
|
||||
"""
|
||||
|
||||
@ -347,8 +348,10 @@ class PrefsCallbacks(object):
|
||||
|
||||
|
||||
class PrefsDialog(SimpleGladeApp):
|
||||
|
||||
"""The Guake Preferences dialog.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
"""Setup the preferences dialog interface, loading images,
|
||||
adding filters to file choosers and connecting some signals.
|
||||
@ -857,6 +860,7 @@ class PrefsDialog(SimpleGladeApp):
|
||||
|
||||
|
||||
class KeyEntry(object):
|
||||
|
||||
def __init__(self, keycode, mask):
|
||||
self.keycode = keycode
|
||||
self.mask = mask
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
import pygtk
|
||||
import gtk
|
||||
|
||||
|
||||
def format_color_string( Color ):
|
||||
return "%s %s %s" % (Color.red /256, Color.green/256, Color.blue/256)
|
||||
def format_color_string(color):
|
||||
return "%s %s %s" % (color.red / 256, color.green / 256, color.blue / 256)
|
||||
|
||||
def print_hex_color( Color ):
|
||||
return "#" + hex(Color.red/256)[2:] + hex(Color.green/256)[2:] + hex(Color.blue/256)[2:]
|
||||
|
||||
def format_color_key( key, Color):
|
||||
return "\"%s\"=\"%s\" (%s)\n" % (key, format_color_string( Color ), print_hex_color( Color ))
|
||||
def print_hex_color(color):
|
||||
return "#" + hex(color.red / 256)[2:] + hex(color.green / 256)[2:] + hex(color.blue / 256)[2:]
|
||||
|
||||
|
||||
def format_color_key(key, color):
|
||||
return "\"%s\"=\"%s\" (%s)\n" % (key, format_color_string(color), print_hex_color(color))
|
||||
|
||||
invisible1 = gtk.Invisible()
|
||||
style1 = invisible1.style
|
||||
@ -18,7 +19,7 @@ style1 = invisible1.style
|
||||
button1 = gtk.Button()
|
||||
buttonstyle = button1.style
|
||||
|
||||
scroll1 = gtk.VScrollbar()
|
||||
scroll1 = gtk.VScrollbar()
|
||||
scrollbarstyle = scroll1.style
|
||||
|
||||
menu1 = gtk.Menu()
|
||||
|
||||
@ -31,20 +31,21 @@ import pygtk
|
||||
pygtk.require('2.0')
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import sys
|
||||
|
||||
import tokenize
|
||||
import gtk
|
||||
import gtk.glade
|
||||
import weakref
|
||||
import inspect
|
||||
import tokenize
|
||||
import weakref
|
||||
|
||||
__version__ = "1.0"
|
||||
__author__ = 'Sandino "tigrux" Flores-Moreno'
|
||||
|
||||
|
||||
def bindtextdomain(app_name, locale_dir=None):
|
||||
"""
|
||||
"""
|
||||
Bind the domain represented by app_name to the locale directory locale_dir.
|
||||
It has the effect of loading translations, enabling applications for different
|
||||
languages.
|
||||
@ -55,7 +56,7 @@ def bindtextdomain(app_name, locale_dir=None):
|
||||
locale_dir:
|
||||
a directory with locales like locale_dir/lang_isocode/LC_MESSAGES/app_name.mo
|
||||
If omitted or None, then the current binding for app_name is used.
|
||||
"""
|
||||
"""
|
||||
try:
|
||||
import locale
|
||||
import gettext
|
||||
@ -65,10 +66,10 @@ def bindtextdomain(app_name, locale_dir=None):
|
||||
gettext.textdomain(app_name)
|
||||
gtk.glade.bindtextdomain(app_name, locale_dir)
|
||||
gtk.glade.textdomain(app_name)
|
||||
gettext.install(app_name, locale_dir, unicode = 1)
|
||||
except (IOError,locale.Error), e:
|
||||
gettext.install(app_name, locale_dir, unicode=1)
|
||||
except (IOError, locale.Error), e:
|
||||
print "Warning", app_name, e
|
||||
__builtins__.__dict__["_"] = lambda x : x
|
||||
__builtins__.__dict__["_"] = lambda x: x
|
||||
|
||||
|
||||
class SimpleGladeApp(object):
|
||||
@ -100,15 +101,15 @@ class SimpleGladeApp(object):
|
||||
It is useful to set attributes of new instances, for example:
|
||||
glade_app = SimpleGladeApp("ui.glade", foo="some value", bar="another value")
|
||||
sets two attributes (foo and bar) to glade_app.
|
||||
"""
|
||||
"""
|
||||
if os.path.isfile(path):
|
||||
self.glade_path = path
|
||||
else:
|
||||
glade_dir = os.path.dirname( sys.argv[0] )
|
||||
glade_dir = os.path.dirname(sys.argv[0])
|
||||
self.glade_path = os.path.join(glade_dir, path)
|
||||
for key, value in kwargs.items():
|
||||
try:
|
||||
setattr(self, key, weakref.proxy(value) )
|
||||
setattr(self, key, weakref.proxy(value))
|
||||
except TypeError:
|
||||
setattr(self, key, value)
|
||||
self.glade = None
|
||||
@ -151,7 +152,7 @@ class SimpleGladeApp(object):
|
||||
callbacks_proxy:
|
||||
an instance with methods as code of callbacks.
|
||||
It means it has methods like on_button1_clicked, on_entry1_activate, etc.
|
||||
"""
|
||||
"""
|
||||
self.glade.signal_autoconnect(callbacks_proxy)
|
||||
|
||||
def normalize_names(self):
|
||||
@ -166,12 +167,12 @@ class SimpleGladeApp(object):
|
||||
for widget in self.get_widgets():
|
||||
widget_name = gtk.Widget.get_name(widget)
|
||||
prefixes_name_l = widget_name.split(":")
|
||||
prefixes = prefixes_name_l[ : -1]
|
||||
prefixes = prefixes_name_l[: -1]
|
||||
widget_api_name = prefixes_name_l[-1]
|
||||
widget_api_name = "_".join(re.findall(tokenize.Name, widget_api_name))
|
||||
gtk.Widget.set_name(widget, widget_api_name)
|
||||
if hasattr(self, widget_api_name):
|
||||
raise AttributeError("instance %s already has an attribute %s" % (self,widget_api_name))
|
||||
raise AttributeError("instance %s already has an attribute %s" % (self, widget_api_name))
|
||||
else:
|
||||
setattr(self, widget_api_name, widget)
|
||||
if prefixes:
|
||||
@ -191,18 +192,18 @@ class SimpleGladeApp(object):
|
||||
prefix_actions_proxy:
|
||||
An instance with methods as prefix actions.
|
||||
It means it has methods like prefix_foo, prefix_bar, etc.
|
||||
"""
|
||||
"""
|
||||
prefix_s = "prefix_"
|
||||
prefix_pos = len(prefix_s)
|
||||
|
||||
is_method = lambda t : callable( t[1] )
|
||||
is_prefix_action = lambda t : t[0].startswith(prefix_s)
|
||||
drop_prefix = lambda (k,w): (k[prefix_pos:],w)
|
||||
is_method = lambda t: callable(t[1])
|
||||
is_prefix_action = lambda t: t[0].startswith(prefix_s)
|
||||
drop_prefix = lambda (k, w): (k[prefix_pos:], w)
|
||||
|
||||
members_t = inspect.getmembers(prefix_actions_proxy)
|
||||
methods_t = filter(is_method, members_t)
|
||||
prefix_actions_t = filter(is_prefix_action, methods_t)
|
||||
prefix_actions_d = dict( map(drop_prefix, prefix_actions_t) )
|
||||
prefix_actions_d = dict(map(drop_prefix, prefix_actions_t))
|
||||
|
||||
for widget in self.get_widgets():
|
||||
prefixes = gtk.Widget.get_data(widget, "prefixes")
|
||||
@ -213,8 +214,8 @@ class SimpleGladeApp(object):
|
||||
prefix_action(widget)
|
||||
|
||||
def custom_handler(self,
|
||||
glade, function_name, widget_name,
|
||||
str1, str2, int1, int2):
|
||||
glade, function_name, widget_name,
|
||||
str1, str2, int1, int2):
|
||||
"""
|
||||
Generic handler for creating custom widgets, internally used to
|
||||
enable custom widgets (custom widgets of glade).
|
||||
@ -268,7 +269,7 @@ class SimpleGladeApp(object):
|
||||
"""
|
||||
widget.destroy()
|
||||
|
||||
def gtk_window_activate_default(self, window, *args):
|
||||
def gtk_window_activate_default(self, widget, *args):
|
||||
"""
|
||||
Predefined callback.
|
||||
The default widget of the window is activated.
|
||||
@ -316,7 +317,7 @@ class SimpleGladeApp(object):
|
||||
"""
|
||||
Quit processing events.
|
||||
The default implementation calls gtk.main_quit()
|
||||
|
||||
|
||||
Useful for applications that needs a non gtk main loop.
|
||||
For example, applications based on gstreamer needs to override
|
||||
this method with gst.main_quit()
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import unittest
|
||||
import guake
|
||||
import unittest
|
||||
|
||||
print os.sys
|
||||
|
||||
class TestQuickEdit(unittest.TestCase):
|
||||
|
||||
def testMatch(self):
|
||||
print guake
|
||||
|
||||
|
||||
91
validate.sh
91
validate.sh
@ -1,5 +1,21 @@
|
||||
#! /bin/bash
|
||||
REVRANGE="$1..HEAD"
|
||||
|
||||
if [[ ! -z $1 ]] && [[ $1 == "--help" ]]; then
|
||||
echo "USAGE: validate.sh [oldrev [--quick]]"
|
||||
echo " This script will test a set of patches (oldrev..HEAD) for basic acceptability as a patch"
|
||||
echo " Run it in an activated virtualenv with the current Buildbot installed, as well as"
|
||||
echo " sphinx, pyflakes, mock, and so on"
|
||||
echo "To use a different directory for tests, pass TRIALTMP=/path as an env variable"
|
||||
echo "if --quick is passed validate will skip unit tests and concentrate on coding style"
|
||||
echo
|
||||
echo "If no argument is given, all files from current directory will be inspected"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REVRANGE=
|
||||
if [ ! -z $1 ]; then
|
||||
REVRANGE="$1..HEAD"
|
||||
fi
|
||||
TRIAL_TESTS=
|
||||
|
||||
# some colors
|
||||
@ -12,15 +28,6 @@ LTCYAN="$_ESC[1;36m"
|
||||
YELLOW="$_ESC[1;33m"
|
||||
NORM="$_ESC[0;0m"
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "USAGE: validate.sh oldrev [--quick]"
|
||||
echo " This script will test a set of patches (oldrev..HEAD) for basic acceptability as a patch"
|
||||
echo " Run it in an activated virtualenv with the current Buildbot installed, as well as"
|
||||
echo " sphinx, pyflakes, mock, and so on"
|
||||
echo "To use a different directory for tests, pass TRIALTMP=/path as an env variable"
|
||||
echo "if --quick is passed validate will skip unit tests and concentrate on coding style"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
status() {
|
||||
echo "${LTCYAN}-- ${*} --${NORM}"
|
||||
@ -65,39 +72,45 @@ run_tests() {
|
||||
trial --reporter text ${TEMP_DIRECTORY_OPT} ${TRIAL_TESTS}
|
||||
}
|
||||
|
||||
if ! git diff --no-ext-diff --quiet --exit-code; then
|
||||
not_ok "changed files in working copy"
|
||||
if [ -z $REVRANGE ]; then
|
||||
py_files=$(find . -name '*.py' | grep -E '(src\/guake$|\.py$)' | grep -v 'src/globals.py')
|
||||
echo "Validating files: "
|
||||
echo $py_files
|
||||
else
|
||||
|
||||
if ! git diff --no-ext-diff --quiet --exit-code; then
|
||||
not_ok "changed files in working copy"
|
||||
if $slow; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
# get a list of changed files, used below; this uses a tempfile to work around
|
||||
# shell behavior when piping to 'while'
|
||||
tempfile=$(mktemp)
|
||||
trap 'rm -f ${tempfile}' 1 2 3 15
|
||||
git diff --name-only $REVRANGE | grep -E '(src\/guake$|\.py$)' | grep -v '\(^master/\(contrib\|docs\)\|/setup\.py\)' > ${tempfile}
|
||||
py_files=()
|
||||
while read line; do
|
||||
if test -f "${line}"; then
|
||||
py_files+=($line)
|
||||
fi
|
||||
done < ${tempfile}
|
||||
|
||||
echo "${MAGENTA}Validating the following commits:${NORM}"
|
||||
git --no-pager log "$REVRANGE" --pretty=oneline || exit 1
|
||||
|
||||
if $slow; then
|
||||
exit 1
|
||||
status "running tests"
|
||||
run_tests || not_ok "tests failed"
|
||||
fi
|
||||
|
||||
status "checking formatting"
|
||||
check_tabs && not_ok "$REVRANGE adds tabs"
|
||||
|
||||
status "checking for release notes"
|
||||
check_relnotes || warning "$REVRANGE does not add release notes"
|
||||
fi
|
||||
|
||||
# get a list of changed files, used below; this uses a tempfile to work around
|
||||
# shell behavior when piping to 'while'
|
||||
tempfile=$(mktemp)
|
||||
trap 'rm -f ${tempfile}' 1 2 3 15
|
||||
git diff --name-only $REVRANGE | grep -E '(src\/guake$|\.py$)' | grep -v '\(^master/\(contrib\|docs\)\|/setup\.py\)' > ${tempfile}
|
||||
py_files=()
|
||||
while read line; do
|
||||
if test -f "${line}"; then
|
||||
py_files+=($line)
|
||||
fi
|
||||
done < ${tempfile}
|
||||
|
||||
echo "${MAGENTA}Validating the following commits:${NORM}"
|
||||
git --no-pager log "$REVRANGE" --pretty=oneline || exit 1
|
||||
|
||||
if $slow; then
|
||||
status "running tests"
|
||||
run_tests || not_ok "tests failed"
|
||||
fi
|
||||
|
||||
status "checking formatting"
|
||||
check_tabs && not_ok "$REVRANGE adds tabs"
|
||||
|
||||
status "checking for release notes"
|
||||
check_relnotes || warning "$REVRANGE does not add release notes"
|
||||
|
||||
status "checking import module convention in modified files"
|
||||
RES=true
|
||||
for filename in ${py_files[@]}; do
|
||||
|
||||
Loading…
Reference in New Issue
Block a user