code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env python
'''Testing flat map scrolling.
Press arrow keys to move view focal point (little ball) around map.
You will be able to move "off" the map.
Press escape or close the window to finish the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import unittest
from render_base import ... | Python |
#!/usr/bin/env python
'''Base class for rendering tests.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import os
import unittest
from pyglet.gl import *
import pyglet.window
from pyglet.window.event import *
from pyglet.window import key
from pyglet import clock
from scene2d import *
from scene2d.draw... | Python |
#!/usr/bin/env python
'''Testing a sprite.
The ball should bounce off the sides of the window. You may resize the
window.
This test should just run without failing.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import os
import unittest
from pyglet.gl import glClear
import pyglet.window
import pygl... | Python |
#!/usr/bin/env python
'''Testing rect map debug rendering.
You should see a checkered square grid.
Press escape or close the window to finish the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import unittest
from render_base import RenderBase
import scene2d
from scene2d.debug import gen_rect_ma... | Python |
#!/usr/bin/env python
'''Testing the map model.
This test should just run without failing.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import unittest
from pyglet.window import Window
from scene2d import RectMap, HexMap, RectCell, HexCell
from scene2d.debug import gen_hex_map, gen_rect_map
rmd = [... | Python |
#!/usr/bin/env python
'''Testing hex map debug rendering.
You should see a checkered hex map.
Press escape or close the window to finish the test.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import unittest
from render_base import RenderBase
import scene2d
from scene2d.debug import gen_hex_map
cla... | Python |
#!/usr/bin/env python
'''Testing mouse interaction
The cell the mouse is hovering over should highlight in red.
Clicking in a cell should highliht that cell green. Clicking again will
clear the highlighting.
Clicking on the ball sprite should highlight it and not underlying cells.
You may press the arrow keys to s... | Python |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: //depot/task/DEV-99/client/tests.py#13 $'
import sys
sys.path.insert(0, '../../')
sys.path.insert(0, '../layout/')
from pyglet.window import *
from pyglet import clock
from pyglet.gl import *
from pyglet import media
import layout... | Python |
from pyglet.window import mouse
import event
def DragHandler(rule, buttons=mouse.LEFT):
class _DragHandler(object):
original_position = None
mouse_buttons = buttons
@event.select(rule)
def on_drag(self, widget, x, y, dx, dy, buttons, modifiers):
if not buttons & self.... | Python |
'''Define the core `Element` class from which all gui widgets are derived.
All gui elements have:
- the parent widget
- an id, element name and list of classes
- a list of children widgets
- a position in 3D space, relative to their parent's position
- dimensions available as width, height, rect and inner_rect
- scal... | Python |
import math
class RestartLayout(Exception):
'''During layout an element has mutated the scene (eg. through adding
scrollbars) and thus layout must be restarted).
'''
def parse_value(value, base_value=0):
'''Parse a numeric value spec which is one of:
NNN integer
NN.MMM float
... | Python |
import math
from pyglet import clock
linear = lambda t: t
cosine90 = lambda t: 1-math.cos(t * math.pi/2)
cosine180 = lambda t: 1-abs(math.cos(t * math.pi))
exponential = lambda t: (math.exp(t)-1) / (math.exp(1)-1)
half_parabola = lambda t: (1000*t)**2 / 1000**2
inverted_half_parabola = lambda t: 1-((1000*t)**2 / 1000... | Python |
from pyglet.gl import *
from pyglet.window import mouse
from pyglet import media, clock
from wydget import element, event, util, data, layouts, anim
from wydget.widgets.frame import Frame
from wydget.widgets.label import Image, Label
from wydget.widgets.button import Button
class Movie(Frame):
name='movie'
de... | Python |
from pyglet.gl import *
from wydget import loadxml
from wydget import util
from wydget.widgets.label import Label
class Progress(Label):
name = 'progress'
def __init__(self, parent, value=0.0, show_value=True,
bar_color='gray', bgcolor=(.3, .3, .3, 1), color='white',
width=None, height... | Python |
import sys
import string
from pyglet.gl import *
from pyglet.window import key, mouse
from wydget import event, anim, util, element
from wydget.widgets.frame import Frame
from wydget.widgets.label import Label
from wydget import clipboard
# for detecting words later
letters = set(string.letters)
class Cursor(elemen... | Python |
import sys
import xml.sax.saxutils
from pyglet.gl import *
from pyglet.window import mouse, key
from wydget import event, layouts, loadxml
from wydget.widgets.frame import Frame
from wydget.widgets.label import Label
class MenuItem(Label):
name = 'menu-item'
@event.default('menu-item')
def on_element_enter(item... | Python |
import os
from pyglet.gl import *
from pyglet.window import mouse
from pyglet import media, clock
from wydget import element, event, util, data, layouts
from wydget.widgets.frame import Frame
from wydget.widgets.label import Image, Label
from wydget.widgets.button import Button
class Music(Frame):
name='music'
... | Python |
import xml.sax.saxutils
from pyglet.window import mouse, key
from pyglet.gl import *
from wydget import element, event, layouts, loadxml, util, data
from wydget.widgets.frame import Frame
from wydget.widgets.button import TextButton, Button
from wydget.widgets.label import Label, Image
class SelectionCommon(Frame):
... | Python |
import operator
import xml.sax.saxutils
from xml.etree import ElementTree
from pyglet.gl import *
import pyglet.image
from wydget import element, event, loadxml, util, data, style
TOP = 'top'
BOTTOM = 'bottom'
LEFT = 'left'
RIGHT = 'right'
CENTER = 'center'
class ImageCommon(element.Element):
image = None
bl... | Python |
from pyglet.gl import *
from wydget import element, event, layouts, util, loadxml
from wydget.widgets.label import Label, Image
class FrameCommon(element.Element):
need_layout = True
def setDirty(self):
super(FrameCommon, self).setDirty()
self.need_layout = True
def intrinsic_width(self):... | Python |
from wydget import anim
from wydget.widgets.frame import Frame
class Drawer(Frame):
'''A *transparent container* that may hide and expose its contents.
'''
name='drawer'
HIDDEN='hidden'
EXPOSED='exposed'
LEFT='left'
RIGHT='right'
TOP='top'
BOTTOM='bottom'
def __init__(self, pa... | Python |
import xml.sax.saxutils
from pyglet.gl import *
from pyglet import clock
from pyglet.window import key, mouse
from wydget import element, event, util, anim, data, loadxml
from wydget.widgets.label import ImageCommon, Label
class ButtonCommon(object):
is_focusable = True
is_pressed = False
is_over = Fals... | Python |
from pyglet.gl import *
from pyglet import clock
from pyglet.window import key, mouse
from wydget import element, event, util, anim, data
class Checkbox(element.Element):
name='checkbox'
is_focusable = True
def __init__(self, parent, value=False, width=16, height=16, **kw):
self.parent = parent
... | Python |
from wydget.widgets.button import Button, TextButton, RepeaterButton
from wydget.widgets.frame import Frame, TabbedFrame
from wydget.widgets.drawer import Drawer
from wydget.widgets.label import Image, Label, XHTML
from wydget.widgets.menu import MenuItem, PopupMenu
from wydget.widgets.movie import Movie
from wydget.wi... | Python |
import datetime
import xml.sax.saxutils
from pyglet.gl import *
from wydget import element, event, layouts, loadxml, util
from wydget.widgets.frame import Frame, ContainerFrame
from wydget.widgets.slider import VerticalSlider, HorizontalSlider
from wydget.widgets.label import Label
class Table(element.Element):
... | Python |
from pyglet.gl import *
from pyglet import clock
from pyglet.window import mouse
from wydget import element, event, data, util, anim
from wydget.widgets.button import Button, RepeaterButton
from wydget.widgets.label import Label
from wydget.widgets.frame import Frame
class SliderCommon(Frame):
slider_size = 16
... | Python |
'''Implement event handling for wydget GUIs.
The `GUIEventDispatcher` class is automatically mixed into the `wydget.GUI`
class and is activated by pushing the gui onto a window's event handlers
stack::
gui = GUI(window)
window.push_handlers(gui)
Events
------
Standard pyglet events are passed through if ha... | Python |
from xml.etree import ElementTree
class XMLLoadError(Exception):
pass
xml_registry = {}
def fromFile(parent, file):
'''Load a gui frame and any child elements from the XML file.
The elements will be added as children on "parent" which may be any
other widget or a GUI instance.
'''
try:
... | Python |
import os
from pyglet import image
_data = {}
filename = os.path.join
dirname = os.path.dirname(__file__)
def load_gui_image(filename):
if not os.path.isabs(filename):
filename = os.path.join(dirname, 'data', filename)
return load_image(filename)
def load_image(*filename):
filename = os.path.jo... | Python |
'''wydget is a graphical user interface (GUI) toolkit for pyglet.
This module allows applications to create a user interface comprised of
widgets and attach event handling to those widgets.
GUIs are managed by the top-level GUI class::
from pyglet.window import Window
from wydget import GUI
window = Win... | Python |
'''Clipboard implementation for X11 using xlib.
'''
from ctypes import *
from pyglet import window
from pyglet.window.xlib import xlib
XA_PRIMARY = xlib.Atom(1)
XA_STRING = xlib.Atom(31)
CurrentTime = 0
AnyPropertyType = 0
class XlibClipboard(object):
def get_text(self):
display = window.get_platform().g... | Python |
'''Clipboard implementation for OS X using Win32
Based on implementation from:
http://aspn.activestate.com/ASPN/Mail/Message/ctypes-users/1771866
'''
from ctypes import *
from pyglet.window.win32.constants import CF_TEXT, GHND
OpenClipboard = windll.user32.OpenClipboard
EmptyClipboard = windll.user32.EmptyClipboard
... | Python |
'''Clipboard implementation for OS X using Carbon
Based on information from:
http://developer.apple.com/carbon/pasteboards.html
'''
import sys
from ctypes import *
import pyglet.lib
from pyglet.window.carbon import _create_cfstring, carbon, _oscheck
from pyglet.window.carbon.constants import *
from pyglet.window.c... | Python |
'''Interaction with the Operating System text clipboard
'''
import sys
def get_text():
'''Get a string from the clipboard.
'''
return _clipboard.get_text()
def put_text(text):
'''Put the string onto the clipboard.
'''
return _clipboard.put_text(text)
# Try to determine which platform to use.... | Python |
from wydget import widgets, event
class Dialog(widgets.Frame):
def __init__(self, parent, x=0, y=0, z=0, width=None, height=None,
classes=(), border='black', bgcolor='white', padding=2, **kw):
if 'dialog' not in classes:
classes = ('dialog', ) + classes
super(Dialog, self).... | Python |
import os, sys
from wydget import event, widgets, layouts
from wydget.dialogs import base
if sys.platform == 'darwin':
default_dir = os.path.expanduser('~/Desktop')
elif sys.platform in ('win32', 'cygwin'):
default_dir = 'c:/'
else:
default_dir = os.path.expanduser('~/Desktop')
class FileOpen(base.Dialog... | Python |
from wydget.dialogs.question import Question, Message
from wydget.dialogs.file import FileOpen
| Python |
from wydget import event
from wydget import widgets
from wydget import layouts
from wydget.dialogs import base
class Question(base.Dialog):
id = '-question-dialog'
name = 'question-dialog'
classes = ('dialog', )
def __init__(self, parent, text, callback=None, cancel=True,
font_size=None, p... | Python |
import operator
import math
from wydget import util
from wydget.widgets.label import Label
TOP = 'top'
BOTTOM = 'bottom'
LEFT = 'left'
RIGHT = 'right'
CENTER = 'center'
FILL = 'fill'
intceil = lambda i: int(math.ceil(i))
class Layout(object):
'''Absolute positioning layout -- also base class for other layouts.
... | Python |
from pyglet.gl import *
from pyglet import font
from layout import *
import util
class Style(object):
font_name = ''
font_size = 14
def getFont(self, name=None, size=None):
if name is None: name = self.font_name
if size is None: size = self.font_size
return font.load(name, size)... | Python |
import random
import math
from pyglet import window
from pyglet import image
from pyglet import clock
from pyglet import gl
from pyglet import resource
from pyglet.window import key
import spryte
win = window.Window(width=640, height=400,vsync=False)
fps = clock.ClockDisplay(color=(1, 1, 1, 1))
balls = spryte.Sprit... | Python |
import sys
import random
from pyglet import window
from pyglet import image
from pyglet import clock
from pyglet import resource
import spryte
NUM_BOOMS = 20
if len(sys.argv) > 1:
NUM_BOOMS = int(sys.argv[1])
win = window.Window(vsync=False)
fps = clock.ClockDisplay(color=(1, 1, 1, 1))
explosions = spryte.Spri... | Python |
# Lots Of Sprites
'''
Results for 2000 sprites:
platform us per sprite per frame
---------------------------------------------------------------------
Intel C2Quad Q6600 (2.4GHz), GeForce 7800 18.2478245656
Intel C2Duo T7500 (2.2GHz), GeForce 8400M GS 19.115903827
AMD 64 3500... | Python |
import os
import math
from pyglet import image, gl, clock, graphics, sprite
class SpriteBatchGroup(graphics.Group):
def __init__(self, x, y, parent=None):
super(SpriteBatchGroup, self).__init__(parent)
self.x, self.y = x, y
def set(self):
if self.x or self.y:
gl.glTranslat... | Python |
import os
import math
from pyglet import window
from pyglet import resource
from pyglet import image
from pyglet.window import key
from pyglet import clock
import spryte
import view
win = window.Window(vsync=False)
fps = clock.ClockDisplay(color=(1, 1, 1, 1))
map = [
[ 0, 1, 1, 1, 2, 3],
[ 5, 6, 16, 1... | Python |
class Rect(object):
'''Define a rectangular area.
Many convenience handles and other properties are also defined - all of
which may be assigned to which will result in altering the position
and sometimes dimensions of the Rect.
The Rect area includes the bottom and left borders but not the top an... | Python |
# desktop tower defense clone
import math
import random
from pyglet import window
from pyglet import image
from pyglet import resource
from pyglet import clock
from pyglet.window import mouse
import view
import tilemap
import spryte
import path
field_cells = '''
+++++++++++EEEEE++++++++++++
+##########.....########... | Python |
Blocker = object()
Start = False
End = object()
class Path(dict):
@classmethod
def determine_path(cls, field, width, height):
path = cls()
path.width = width
path.height = height
path.ends = set()
path.starts = []
cells = []
for y in range(height):
... | Python |
import operator
from pyglet import gl, event
import spryte
import tilemap
class View(object):
'''Render a flat view of a scene2d.Scene.
Attributes:
scene -- a scene2d.Scene instance
allow_oob -- indicates whether the viewport will allow
viewing of ... | Python |
import sys
import random
import math
from pyglet import window
from pyglet import clock
from pyglet import resource
import spryte
NUM_CARS = 100
if len(sys.argv) > 1:
NUM_CARS = int(sys.argv[1])
win = window.Window(vsync=False)
fps = clock.ClockDisplay(color=(1, 1, 1, 1))
cars = spryte.SpriteBatch()
car = reso... | Python |
from pyglet import image
import spryte
class Map(spryte.SpriteBatch):
'''Rectangular map.
"cells" argument must be a row-major list of lists of Sprite instances.
'''
def set_cells(self, cell_width, cell_height, cells, origin=None):
self.cell_width, self.cell_height = cell_width, cell_height
... | Python |
import math
import pyglet
from pyglet.gl import *
class SmoothLineGroup(pyglet.graphics.Group):
def set_state(self):
glPushAttrib(GL_ENABLE_BIT)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glEnable(GL_LINE_SMOOTH)
glLineWidth(2)
def unset_state... | Python |
'''
Code by Richard Jones, released into the public domain.
Inspired by http://screamyguy.net/lines/index.htm
This code uses a single drawing buffer so that successive drawing passes
may be used to create the line fading effect. The fading is achieved
by drawing a translucent black quad over the entire scene before d... | Python |
'''
Code by Richard Jones, released into the public domain.
Beginnings of something like http://en.wikipedia.org/wiki/Thrust_(video_game)
'''
import sys
import math
import euclid
import primitives
import pyglet
from pyglet.window import key
from pyglet.gl import *
window = pyglet.window.Window(fullscreen='-fs' in ... | Python |
#!/usr/bin/env python
#
# euclid graphics maths module
#
# Copyright (c) 2006 Alex Holkner
# Alex.Holkner@mail.google.com
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version ... | Python |
import os
import sys
import inspect
# Events
from sphinx.ext.autodoc import MethodDocumenter, FunctionDocumenter
from sphinx.ext.autodoc import ModuleDocumenter, ClassDocumenter
class EventDocumenter(MethodDocumenter):
objtype = "event"
member_order = 45
priority = 5
@classmethod
de... | Python |
# -*- coding: utf-8 -*-
''' pyglet specific docstring transformations.
'''
_debug = False
def debug(lines):
with open('debug.log', 'a') as f:
for line in lines:
f.write(line+"\n")
if _debug:
with open('debug.log', 'w') as f:
f.write("Docstring modifications.\n\n")
... | Python |
# -*- coding: utf-8 -*-
"""
sphinx.ext.autosummary.generate
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Usable as a library or script to generate automatic RST source files for
items referred to in autosummary:: directives.
Each generated RST file contains a single auto*:: directive which
extracts the doc... | Python |
# -*- coding: utf-8 -*-
"""
sphinx.ext.autosummary
~~~~~~~~~~~~~~~~~~~~~~
Sphinx extension that adds an autosummary:: directive, which can be
used to generate function/method/attribute/etc. summary lists, similar
to those output eg. by Epydoc and other API doc generation tools.
An :autolink: r... | Python |
# -*- coding: utf-8 -*-
#
# pyglet documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
import os
import sys
import time
import datetime
sys.is_epydoc = True
document_modules = ["pyglet", "tests"]
# Patched extensions base path.
sys.path.insert(... | Python |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import os
import shutil
import sys
import time
from xml.dom.minidom import parse
try:
from xml.etree import ElementTree
except ImportError:
from elementtree import ElementTree
def get_elem_by_id(doc, name, id):
for el... | Python |
#!/user/bin/env python
import os, glob, string
path = './'
for infile in glob.glob(os.path.join(path,'*.*')):
#print infile.lower()[3:]
os.system("mv "+infile+" m_"+infile.lower()[2:])
| Python |
#!/user/bin/env python
import os, glob, string
path = './'
for infile in glob.glob(os.path.join(path,'*.*')):
#print infile.lower()[3:]
os.system("mv "+infile+" m_"+infile.lower()[2:])
| Python |
# -*- coding: utf-8 -*-
# python
# process emacs's command frequency file.
# See: http://xahlee.org/emacs/command-frequency.html
# 2007-08
# Xah Lee
import re
from unicodedata import *
# a list of files to read in
input_files = [
"command-frequency_marc.txt",
"command-frequency_marc2.txt",
"command-frequency_xah.txt... | Python |
#!/usr/bin/env python
# This script reads the auto-properties defined in the
# $HOME/.subversion/config file and applies them recursively to all
# the files and directories in the current working copy. It may
# behave differently than the Subversion command line; where the
# subversion command line may only apply a s... | Python |
#!/usr/bin/env python
# This script reads the auto-properties defined in the
# $HOME/.subversion/config file and applies them recursively to all
# the files and directories in the current working copy. It may
# behave differently than the Subversion command line; where the
# subversion command line may only apply a s... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, signal, os
global_debug = False
if "-d" in sys.argv:
global_debug = True
def debug(msg, fr=None):
if global_debug:
if fr: msg = "[%s] %s" % (fr, msg)
print msg
if global_debug: debug("*** Debug output enabled ***", "app")
# find ... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import gtk
from gtk import gdk
def units(bytes):
pref = " KMGT"
bytes = float(bytes)
for x in xrange(5):
d = 10**(x*3)
if bytes < d*1024:
return "%s%sB" % (bytes/d % 1 and round(bytes/d, 1) or int(bytes/d), pref[x])
def unic(string):
... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import fnmatch
import gtk
icon_theme = gtk.icon_theme_get_default()
default_size = 22
match_mappings = {
'*.r[0-9][0-9]': 'package',
'README*': 'ascii',
}
ending_mappings = {
'video': ['.avi', '.wmv', '.asf', '.ogm', '.mkv', '.mpg', '.mpeg'],
'package': ['.ra... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import gtk
from ConfigParser import SafeConfigParser
import app
class Config(SafeConfigParser):
def read(self):
read = SafeConfigParser.read(self,
[os.path.join(app.data_dir, "default.config"), app.config_file])
app.debug("Read: %s"%'... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import gtk
from gtk import glade
import flash
class AboutDialog:
def url(self, dialog, link, user_data):
import webbrowser
webbrowser.open(link, 0, 1)
def __init__(self):
gtk.about_dialog_set_url_hook(self.url, None)
self.w... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os, os.path
import pango
import gobject
import gtk
from gtk import glade
import ftp
import icons
import connectdialog
import about
import app
from gtkmisc import *
class BrowserStore(gtk.TreeStore):
I_FILENAME = 0
I_SIZE = 1
I_ITEM = 2
I_AC... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import gtk
from gtk import gdk
def units(bytes):
pref = " KMGT"
bytes = float(bytes)
for x in xrange(5):
d = 10**(x*3)
if bytes < d*1024:
return "%s%sB" % (bytes/d % 1 and round(bytes/d, 1) or int(bytes/d), pref[x])
def unic(string):
... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
__name__ = "Flash!"
__version__ = "0.1"
__version_str__ = '.'.join([str(x) for x in __version__])
__author__ = "Tumi Steingrímsson <tumi.st@gmail.com>"
__licence__ = "GPL"
| Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import gobject
import pango
import time
import gtk
import ftp
import about
import icons
import app
from gtkmisc import *
def nullifnegative(n):
if n < 0:
return 0
else: return n
def get_status_icon(column, cell, model, iter):
direction = model.... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import gtk
from gtk import glade
import app
import ftp
import icons
class ConnectDialog:
def __init__(self, appinst, browser=None):
self.appinst = appinst
self.config = appinst.config
self.browser = browser
self.wTree = ... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, signal, os
global_debug = False
if "-d" in sys.argv:
global_debug = True
def debug(msg, fr=None):
if global_debug:
if fr: msg = "[%s] %s" % (fr, msg)
print msg
if global_debug: debug("*** Debug output enabled ***", "app")
# find ... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import fnmatch
import gtk
icon_theme = gtk.icon_theme_get_default()
default_size = 22
match_mappings = {
'*.r[0-9][0-9]': 'package',
'README*': 'ascii',
}
ending_mappings = {
'video': ['.avi', '.wmv', '.asf', '.ogm', '.mkv', '.mpg', '.mpeg'],
'package': ['.ra... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import socket
import threading
import ftplib
import os
def debugmsg(msg):
"""Override as fits."""
CRLF = ftplib.CRLF
def clearwhites(s):
"""This is not a racist function. I takes all
multiple whitespaces away."""
return ' '.join([x for x in s.spl... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import gtk
from ConfigParser import SafeConfigParser
import app
class Config(SafeConfigParser):
def read(self):
read = SafeConfigParser.read(self,
[os.path.join(app.data_dir, "default.config"), app.config_file])
app.debug("Read: %s"%'... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os, os.path
import pango
import gobject
import gtk
from gtk import glade
import ftp
import icons
import connectdialog
import about
import app
from gtkmisc import *
class BrowserStore(gtk.TreeStore):
I_FILENAME = 0
I_SIZE = 1
I_ITEM = 2
I_AC... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import gtk
from gtk import glade
import app
import ftp
import icons
class ConnectDialog:
def __init__(self, appinst, browser=None):
self.appinst = appinst
self.config = appinst.config
self.browser = browser
self.wTree = ... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import gobject
import pango
import time
import gtk
import ftp
import about
import icons
import app
from gtkmisc import *
def nullifnegative(n):
if n < 0:
return 0
else: return n
def get_status_icon(column, cell, model, iter):
direction = model.... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import gtk
from gtk import glade
import flash
class AboutDialog:
def url(self, dialog, link, user_data):
import webbrowser
webbrowser.open(link, 0, 1)
def __init__(self):
gtk.about_dialog_set_url_hook(self.url, None)
self.w... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
__name__ = "Flash!"
__version__ = "0.1"
__version_str__ = '.'.join([str(x) for x in __version__])
__author__ = "Tumi Steingrímsson <tumi.st@gmail.com>"
__licence__ = "GPL"
| Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import socket
import threading
import ftplib
import os
def debugmsg(msg):
"""Override as fits."""
CRLF = ftplib.CRLF
def clearwhites(s):
"""This is not a racist function. I takes all
multiple whitespaces away."""
return ' '.join([x for x in s.spl... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A startup file for FlashFTP.
Signals an already running flashftp to start
a Browser if running, else imports flash.app
and creates a new Application.
"""
import sys
try:
import dbus
except ImportError:
dbus = None
def isrunning():
return False
if isrunning... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A startup file for FlashFTP.
Signals an already running flashftp to start
a Browser if running, else imports flash.app
and creates a new Application.
"""
import sys
try:
import dbus
except ImportError:
dbus = None
def isrunning():
return False
if isrunning... | Python |
#!/usr/bin/env python
try:
from sugar.activity import bundlebuilder
bundlebuilder.start("HelloWorldActivity")
except ImportError:
import os
os.system("find ./ | sed 's,^./,HelloWorldActivity.activity/,g' > MANIFEST")
os.system('rm HelloWorldActivity.xo')
os.chdir('..')
os.system('zip -r HelloWorldActivi... | Python |
#!/usr/bin/env python
try:
from sugar.activity import bundlebuilder
bundlebuilder.start("HelloWorldActivity")
except ImportError:
import os
os.system("find ./ | sed 's,^./,HelloWorldActivity.activity/,g' > MANIFEST")
os.system('rm HelloWorldActivity.xo')
os.chdir('..')
os.system('zip -r HelloWorldActivi... | Python |
#! /usr/bin/env python
# scriptedfun.com 1945
# http://www.scriptedfun.com/
# June 5, 2006
# MIT License
# 1945.bmp
# taken from the Spritelib by Ari Feldman
# http://www.flyingyogi.com/fun/spritelib.html
# Common Public License
import math, os, pygame, random, sys#, olpcgames
from pygame.locals import ... | Python |
#! /usr/bin/env python
# scriptedfun.com 1945
# http://www.scriptedfun.com/
# June 5, 2006
# MIT License
# 1945.bmp
# taken from the Spritelib by Ari Feldman
# http://www.flyingyogi.com/fun/spritelib.html
# Common Public License
import math, os, pygame, random, sys#, olpcgames
from pygame.locals import ... | Python |
from sugar.activity import activity
import logging
import sys, os
import gtk
class HelloWorldActivity(activity.Activity):
def hello(self, widget, data=None):
logging.info('Hello World')
def __init__(self, handle):
print "running activity init", handle
activity.Activity.__i... | Python |
#!/usr/bin/python2
'''
Copyright (c) 2013, Andrew Klaus <andrewklaus@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,... | Python |
'''
Copyright (c) 2013, Andrew Klaus <andrewklaus@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of co... | Python |
#!/usr/bin/env python
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation,... | Python |
#!/usr/bin/env python
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation,... | Python |
#!/usr/bin/env python
# This file is part of Androguard.
#
# Copyright (C) 2012/2013, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Founda... | Python |
#!/usr/bin/env python
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation,... | Python |
#!/usr/bin/env python
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation,... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.