code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
from assigned_cases_model import AssignedCasesModel
from case import Case
from list_people import get_name_for_email
| Python |
import logging
from PyQt4 import QtCore
from fogmini import global_objects
from fogmini.utils import get_config_value
from case import Case
from list_people import get_name_for_email
class AssignedCasesModel(QtCore.QAbstractListModel):
def __init__(self, *args, **kwargs):
QtCore.QAbstractListModel.__ini... | Python |
import sys
from PyQt4 import QtCore, QtGui
from fogmini import global_objects
from fogmini.application import FogMiniApplication
from fogmini.login import login
from fogmini.tray_icon import SystemTrayIcon
def main():
global_objects.app = FogMiniApplication(sys.argv)
base_widget = QtGui.QWidget()
global... | Python |
import os.path
from PyQt4 import QtGui
import fogmini
from fogmini import global_objects
from fogmini.api.fogbugz import FogBugzAPIError
from fogmini.dialogs import LoginDetails
from fogmini.tray_menu import TrayMenu
base_path = os.path.dirname(fogmini.__file__)
class SystemTrayIcon(QtGui.QSystemTrayIcon):
def... | Python |
from PyQt4 import QtCore, QtGui
class FogMiniApplication(QtGui.QApplication):
login_successful = QtCore.pyqtSignal()
| Python |
from fogmini import global_objects
from fogmini.api.fogbugz import FogBugz
from fogmini.utils import get_config_value, set_config_value
def login():
base_url = get_config_value("base_url", "").toString()
if base_url == "":
global_objects.tray.showMessage("Settings Required", "Left click on the FogBugz ... | Python |
from login import LoginDetails
| Python |
from PyQt4 import QtGui
from fogmini.login import login
from fogmini.utils import get_config_value, set_config_value
class LoginDetails(QtGui.QDialog):
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
layout = QtGui.QFormLayout()
self.host_name = QtGui.QLineEdit(get_... | Python |
from PyQt4 import QtGui
from fogmini.data import AssignedCasesModel, Case
class TrayMenu(QtGui.QMenu):
def __init__(self, *args, **kwargs):
QtGui.QMenu.__init__(self, *args, **kwargs)
self.aboutToShow.connect(self.populate)
def populate(self):
self.clear()
startWorkLabelActi... | Python |
from config import get_config_value, set_config_value
| Python |
from PyQt4 import QtCore
CONFIG = None
def _load_config():
"""Load the config object."""
global CONFIG # pylint: disable-msg=W0603
CONFIG = QtCore.QSettings("Andrew Wilkinson", "DjangoDE")
def get_config_value(key, default=None):
"""Get the value from settings that was stored with key."""
if CON... | Python |
#!/usr/bin/python -S
import os
import sys
import commands
program_name = sys.argv[1]
candidates = sorted([x.strip() for x in commands.getoutput(""" wmctrl -l -x | awk -v win="%s" 'tolower($0) ~ win {print $1;}' """ % (program_name, )).split("\n") if x !=''])
out_file = file("/home/soma/debug.txt", "a")
print candi... | Python |
#!/usr/bin/python -S
import os
import sys
import commands
program_name = sys.argv[1]
candidates = sorted([x.strip() for x in commands.getoutput(""" wmctrl -l -x | awk -v win="%s" 'tolower($0) ~ win {print $1;}' """ % (program_name, )).split("\n") if x !=''])
out_file = file("/home/soma/debug.txt", "a")
print candi... | Python |
#!/usr/bin/env python
import os
import sys
import json
import csv
from bs4 import BeautifulSoup
from aisikl.app import Application, assert_ops
from fladgejt.login import create_client
from fladgejt.helpers import find_option, find_row
from console import settings
def prihlas_sa():
username = os.environ['AIS_USE... | Python |
#!/usr/bin/python
import sys;
root_dict = {}
x = sys.stdin.read()
for file in x.rstrip().split(' '):
path_components = file.split('/');
current_dict = root_dict;
for path_segment in path_components:
path_segment = path_segment.replace(".", "_").replace("-","_");
if path_segment not in current_dict:
... | Python |
import os
import sys
import json
from os.path import join, dirname, abspath
anketa_root = join(dirname(abspath(__file__)), '../../..')
votr_root = join(anketa_root, 'vendor/svt/votr')
sys.path.insert(0, votr_root)
# --------------------------------------------------
def main():
from fladgejt.login import creat... | Python |
#!/usr/bin/env python
import codecs
import re
import jinja2
import markdown
def process_slides():
with codecs.open('../../presentation-output.html', 'w', encoding='utf8') as outfile:
md = codecs.open('slides.md', encoding='utf8').read()
md_slides = md.split('\n---\n')
print 'Compiled %s slides.' % len(m... | Python |
#!/usr/bin/env python
# This script will convert all TABs to SPACEs in the Fog root directory
# and all sub-directories (recursive).
#
# Converted sequences:
# - The \r\n sequence is converted to \n (To UNIX line-ending).
# - The \t (TAB) sequence is converted to TAB_REPLACEMENT which should
# be two spaces.
... | Python |
#!/usr/bin/env python
# This script will convert all TABs to SPACEs in the Fog root directory
# and all sub-directories (recursive).
#
# Converted sequences:
# - The \r\n sequence is converted to \n (To UNIX line-ending).
# - The \t (TAB) sequence is converted to TAB_REPLACEMENT which should
# be two spaces.
... | Python |
#!/usr/bin/env python
# This script will convert all TABs to SPACEs in the Fog root directory
# and all sub-directories (recursive).
#
# Converted sequences:
# - The \r\n sequence is converted to \n (To UNIX line-ending).
# - The \t (TAB) sequence is converted to TAB_REPLACEMENT which should
# be two spaces.
... | Python |
#!/usr/bin/env python
# Unicode Reports:
#
# http://www.unicode.org/reports/tr44/
# (Unicode Character Database)
# =============================================================================
# generate-unicode.py - Generate unicode tables, based on Unicode 6.0.
#
# This script must be modified when new unicode ... | Python |
#!/usr/bin/env python
# Unicode Reports:
#
# http://www.unicode.org/reports/tr44/
# (Unicode Character Database)
# =============================================================================
# generate-unicode.py - Generate unicode tables, based on Unicode 6.0.
#
# This script must be modified when new unicode ... | Python |
#!/usr/bin/env python
# This script will convert all TABs to SPACEs in the Fog root directory
# and all sub-directories (recursive).
#
# Converted sequences:
# - The \r\n sequence is converted to \n (To UNIX line-ending).
# - The \t (TAB) sequence is converted to TAB_REPLACEMENT which should
# be two spaces.
... | Python |
#Just a utility I used to rename the files once they've been exported.
import os,json
l = json.load(open(input("list> ")))
os.chdir(input("directory> "))
for f in os.listdir(os.getcwd()):
try:os.rename(f,l[int(f[:f.rfind('.')].lower())-1])
except:continue | Python |
# > Logic only. Program this as if it were multiplayer.
# That's why we don't need to import OS or JSON
# Because we won't be loading any of our own data,
# Right?
import math
def get_nature_multiplier(nature,stat):
if stat==nature['dec']:return 0.9
elif stat==nature['inc']:return 1.1
else:return 1
def calculate_... | Python |
from bottle import route, run, request,template,static_file,response
from data import *
from os import getcwd,path
import json
DATA_TYPES=['species','moves','abilities','info','trainers','saves']
data=dict([(type,load_data(type)) for type in DATA_TYPES])
data['data-types']=data#Lol. YAY RECURSION?
def ret_di... | Python |
#!/usr/bin/python3
import os,sys
from inspect import getmembers
def class_list(t,m=None):
m=m or sys.modules[__name__]
for name,obj in getmembers(m,inspect.isclass):
if issubclass(obj,t) and obj is not t:yield obj
def dir_name(a=None):
if not a:a=os.getcwd()
return a[a.rfind(os.path.sep)+1:]
def list_files(d,k... | Python |
from engine import Engine,Task,ThreadedTask,Runner
import pygame,textwrap
def combine(a,b,c):return [c(a[i],b[i]) for i in range(0,len(a))]
def trykey(a,b,c):
try:return a[b]
except KeyError:return c
def sidechain(f,o,*args,**kwargs):
f(o,*args,**kwargs)
return o
def transparent(surf, colorkey=[0,0... | Python |
#!/usr/bin/python3
import os,sys
from inspect import getmembers
def class_list(t,m=None):
m=m or sys.modules[__name__]
for name,obj in getmembers(m,inspect.isclass):
if issubclass(obj,t) and obj is not t:yield obj
def dir_name(a=None):
if not a:a=os.getcwd()
return a[a.rfind(os.path.sep)+1:]
def list_files(d,k... | Python |
#!/usr/bin/python3.2
# coding: utf-8
from __future__ import division, print_function, unicode_literals
import pygame
import json
from engine import *
from data import *
import tile_rpg
def mix(a,b,c):return [c(a[i],b[i]) for i in range(0,len(a))]
def max(a,b):return a if a>b else b
def min(a,b):return a if a<b else b
... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | Python |
#This script is designed to combine sprites from multiple sources into one image
#Designed for a directory structure.
#Also make sure your sources are consistent in dimensions
import os
import pygame
pygame.init()
def load_dir(dir): return [pygame.image.load(os.path.join(dir,f)) for f in os.listdir(dir)]
sou... | Python |
#!/usr/bin/python3.2
# coding: utf-8
from __future__ import division, print_function, unicode_literals
import pygame
import json
from engine import *
from data import *
import tile_rpg
def mix(a,b,c):return [c(a[i],b[i]) for i in range(0,len(a))]
def max(a,b):return a if a>b else b
def min(a,b):return a if a<b else b
... | Python |
#Script used to Convert a spritesheet
#Into several sprite files
#Into their own directory
import os
import pygame
pygame.init()
src=None
while not src:
try:src=pygame.image.load(input("input filename> "))
except:pass
name=input("output directory> ")
try:os.mkdir(name)
except:pass
try:os.chdir(name)
... | Python |
import pygame
import random
random.seed()
from engine import*
def mix(a,b,c):return [c(a[i],b[i]) for i in range(0,len(a))]
def lookup(a, x, y, w, h, z):
if 0 <= x < w and 0 <= y < h:return a[x+y*w]
return z
def dualiter(w, h):
for y in range(h):
for x in range(w):yield x, y
class NPC(Task,pyg... | Python |
from engine import Task,ThreadedTask,Runner,EventHandler
from sdlengine import Period,load_font,Period,AnimationFromGenerator,SDLEngine as Engine,load_trans_image,transparent
from threading import Thread
from integrate import load_dict
import pygame,os,json
from data import Cache
from math import floor
import ra... | Python |
import pickle
import json
import os
def sidechain(func, data, *args, **kw):
func(data, *args, **kw)
return data
def listdir(path):
return [ fn for v in [[ os.path.join(*b) for b in [ (a[0], c) for c in a[2]]] for a in [ [r,d,f] for r,d,f in os.walk(path)]] for fn in v]
def filename_from_key(key):return os.sep.jo... | Python |
from __future__ import print_function
from threading import Thread
def trykey(o,k,d):
try:return o[k]
except KeyError:return d
class Runner:
def __init__(self,task):self.task=task
def __call__(self):
t=self.task
t.process_signal('start')
while t.running:
try:t.process_signal('frame')
exc... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | Python |
import json
import os
import pygame
from data import *
from engine import *
import tile_rpg
if __name__ == "__main__":
def mix(a,b,func=lambda a,b:a+b):
l = len(a)
assert l==len(b)
return [ func(a[i],b[i]) for i in range(0,l)]
def render_palette(src,width):
pos=[0,0]
num_per_row = int(wid... | Python |
#!/usr/bin/python
#
# Script to generate distorted text images for a captcha system.
#
# Copyright (C) 2005 Neil Harris
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the ... | Python |
#!/usr/bin/python
#
# Script to generate distorted text images for a captcha system.
#
# Copyright (C) 2005 Neil Harris
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the ... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @author Philip
import tarfile as tf
import zipfile as zf
import os, re, shutil, sys, platform
pyversion = platform.python_version()
islinux = platform.system().lower() == 'linux'
if pyversion[:3] in ['2.6', '2.7']:
import urllib as urllib_request
import codecs
... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @author Philip
import tarfile as tf
import zipfile as zf
import os, re, shutil, sys, platform
pyversion = platform.python_version()
islinux = platform.system().lower() == 'linux'
if pyversion[:3] in ['2.6', '2.7']:
import urllib as urllib_request
import codecs
... | Python |
#!/usr/bin/python
#
# Copyright 2007 Google Inc. All Rights Reserved.
"""CSS Lexical Grammar rules.
CSS lexical grammar from http://www.w3.org/TR/CSS21/grammar.html
"""
__author__ = ['elsigh@google.com (Lindsey Simon)',
'msamuel@google.com (Mike Samuel)']
# public symbols
__all__ = [ "NEWLINE", "HEX",... | Python |
#!/usr/bin/python
#
# Copyright 2008 Google Inc. All Rights Reserved.
"""Converts a LeftToRight Cascading Style Sheet into a RightToLeft one.
This is a utility script for replacing "left" oriented things in a CSS file
like float, padding, margin with "right" oriented values.
It also does the opposite.
The... | Python |
#!/usr/bin/python
#
# Copyright 2007 Google Inc. All Rights Reserved.
"""CSS Lexical Grammar rules.
CSS lexical grammar from http://www.w3.org/TR/CSS21/grammar.html
"""
__author__ = ['elsigh@google.com (Lindsey Simon)',
'msamuel@google.com (Mike Samuel)']
# public symbols
__all__ = [ "NEWLINE", "HEX",... | Python |
#!/usr/bin/python
#
# Copyright 2008 Google Inc. All Rights Reserved.
"""Converts a LeftToRight Cascading Style Sheet into a RightToLeft one.
This is a utility script for replacing "left" oriented things in a CSS file
like float, padding, margin with "right" oriented values.
It also does the opposite.
The... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#MIT License
#By : cocobear.cn@gmail.com
#Ver:0.2
import urllib
import urllib2
import sys,re
import binascii
import hashlib
import socket
import os
import time
import exceptions
import logging
from hashlib import md5
from hashlib import sha1
from uuid import uuid1
from th... | Python |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#MIT License
#By : cocobear.cn@Gmail.com
#Ver:0.2
from PyFetion import *
from threading import Thread
from time import sleep
from copy import copy
import time
import sys
import exceptions
import cmd,wave
#from PIL import ImageGrab
ISOTIMEFORMAT='%Y-%m-%d %H:%M:%S'
userh... | Python |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#MIT License
#By : cocobear.cn@Gmail.com
#Ver:0.2
from PyFetion import *
from threading import Thread
from time import sleep
from copy import copy
import time
import sys
import exceptions
import cmd,wave
#from PIL import ImageGrab
ISOTIMEFORMAT='%Y-%m-%d %H:%M:%S'
userh... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#MIT License
#By : cocobear.cn@gmail.com
#Ver:0.2
import urllib
import urllib2
import sys,re
import binascii
import hashlib
import socket
import os
import time
import exceptions
import logging
from hashlib import md5
from hashlib import sha1
from uuid import uuid1
from th... | Python |
#! /usr/bin/python -u
#-*- coding: utf-8 -*-
#
# After connecting to a jabber server it will echo messages, and accept any
# presence subscriptions. This bot has basic Disco support (implemented in
# pyxmpp.jabber.client.Client class) and jabber:iq:vesion.
import sys,os,time,cmd,re
from threading import Thread
import ... | Python |
#! /usr/bin/python -u
#-*- coding: utf-8 -*-
#
# After connecting to a jabber server it will echo messages, and accept any
# presence subscriptions. This bot has basic Disco support (implemented in
# pyxmpp.jabber.client.Client class) and jabber:iq:vesion.
import sys,os,time,cmd,re
from threading import Thread
import ... | Python |
#! /usr/bin/python -u
#-*- coding: utf-8 -*-
#
#
| Python |
'''
FogBugz Abstraction to facilitate the posting and editing of new cases
through interfaces that are not FogBugz. Oh and please, let the tests
drive any changes to this class. If you don't a man will come to you
in your sleep... I'm not saying what he'll do, just FYI.
Wayne Witzel III
... | Python |
'''
FogBugz Abstraction to facilitate the posting and editing of new cases
through interfaces that are not FogBugz. Oh and please, let the tests
drive any changes to this class. If you don't a man will come to you
in your sleep... I'm not saying what he'll do, just FYI.
Wayne Witzel III
... | Python |
'''
FogBugz Abstraction to facilitate the posting and editing of new cases
through interfaces that are not FogBugz. Oh and please, let the tests
drive any changes to this class. If you don't a man will come to you
in your sleep... I'm not saying what he'll do, just FYI.
Wayne Witzel III
Tower H... | Python |
#!/usr/bin/env python
""" Setup file for PyFoo package """
from distutils.core import setup
setup(name='folc',
version='0.1',
description='Folc package',
long_description = "Fiction Book online to local converter",
author='Sergei Danilov',
author_email='sergeidanilov@gmail.com',... | Python |
#!/usr/bin/python
import sys
from folc.Folc import httpWidget
from PyQt4 import QtCore, QtGui
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = httpWidget()
myapp.show()
sys.exit(app.exec_()) | Python |
# Requires wxPython. This sample demonstrates:
#
# - single file exe using wxPython as GUI.
from distutils.core import setup
import py2exe
import sys
# If run without args, build executables, in quiet mode.
if len(sys.argv) == 1:
sys.argv.append("py2exe")
sys.argv.append("-q")
class Target:
... | Python |
#!/usr/bin/python
import sys
from folc.Folc import httpWidget
from PyQt4 import QtCore, QtGui
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = httpWidget()
myapp.show()
sys.exit(app.exec_()) | Python |
#!/usr/bin/env python
""" Setup file for PyFoo package """
from distutils.core import setup
setup(name='folc',
version='0.1',
description='Folc package',
long_description = "Fiction Book online to local converter",
author='Sergei Danilov',
author_email='sergeidanilov@gmail.com',... | Python |
# Requires wxPython. This sample demonstrates:
#
# - single file exe using wxPython as GUI.
from distutils.core import setup
import py2exe
import sys
# If run without args, build executables, in quiet mode.
if len(sys.argv) == 1:
sys.argv.append("py2exe")
sys.argv.append("-q")
class Target:
... | Python |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'httpWidget.ui'
#
# Created: Thu Mar 05 12:19:53 2009
# by: PyQt4 UI code generator 4.4.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_HttpWidget(object):
def setupUi... | Python |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup parses a (possibly invalid) XML or HTML document into a
tree representation. It provides methods and Pythonic idioms that make
it easy to navigate, search, and modify the tree.
A well-formed X... | Python |
# -*- coding: utf-8 -*-
import sys
from PyQt4 import QtCore, QtGui
from httpWidget import Ui_HttpWidget
import os
class httpWidget(QtGui.QWidget):
def __init__(self, parent=None):
self.isParametersValid=True
self.currentPage = ''
self.currentPageNumber = 0
self.lastPageNumber=0
self.lastDownloadResult = Tr... | Python |
import sys
import folc
from PyQt4 import QtCore, QtGui
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = httpWidget()
myapp.show()
sys.exit(app.exec_()) | Python |
def is_rect_nonzero(r):
(_,_,w,h) = r
return (w > 0) and (h > 0)
class fm_command:
"""A simple example class"""
def help(self):
return 'fm_command help'
def on_msg(self,msg):
print (msg)
if __name__=="__main__":
a = fm_command()
a.help()
| Python |
#!/usr/bin/env python
from Tkinter import *
root = Tk()
def key(event):
print "pressed", repr(event.char)
def callback(event):
frame.focus_set()
print "clicked at", event.x, event.y
frame = Frame(root, width=100, height=100)
frame.bind("<Key>", key)
frame.bind("<Button-1>", callback)
fr... | Python |
# Echo server program
import socket
import sys
HOST = None # Symbolic name meaning all available interfaces
PORT = 50007 # Arbitrary non-privileged port
s = None
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,
socket.SOCK_STREAM, 0, socket.AI... | Python |
#!/usr/bin/env python
import cv2.cv as cv
def is_rect_nonzero(r):
(_,_,w,h) = r
return (w > 0) and (h > 0)
class fmUIdemo:
def __init__(self):
self.capture = cv.CaptureFromCAM(0) # Capture image from device "0"
cv.NamedWindow( "fmUIdemo", 1 )
cv.NamedWindow( "fmProce... | Python |
import sys
print "hello world 11"
| Python |
#!/usr/bin/env python
import cv2.cv as cv
import numpy as np
def is_rect_nonzero(r):
(_,_,w,h) = r
return (w > 0) and (h > 0)
class fmTrackingDemo:
def __init__(self):
self.font = cv.InitFont(cv.CV_FONT_HERSHEY_SIMPLEX, 1, 1, 0, 2, 2)
cv.NamedWindow( "fmTracking_Preview_W... | Python |
#!/usr/bin/env python
import cv2.cv as cv
def is_rect_nonzero(r):
(_,_,w,h) = r
return (w > 0) and (h > 0)
class CamShiftDemo:
def __init__(self):
self.capture = cv.CaptureFromCAM(1)
cv.NamedWindow( "CamShiftDemo", 1 )
cv.NamedWindow( "Histogram", 1 )
cv.Set... | Python |
#!/usr/bin/env python
from Tkinter import *
root = Tk()
def key(event):
print "pressed", repr(event.char)
def callback(event):
frame.focus_set()
print "clicked at", event.x, event.y
frame = Frame(root, width=100, height=100)
frame.bind("<Key>", key)
frame.bind("<Button-1>", callback)
fr... | Python |
#! /usr/bin/env python
import cv2.cv as cv
color_tracker_window = "Color Tracker"
class ColorTracker:
def __init__(self):
cv.NamedWindow( color_tracker_window, 1 )
self.capture = cv.CaptureFromCAM(0)
def run(self):
while True:
img = c... | Python |
#!/usr/bin/env python
import cv2.cv as cv
def is_rect_nonzero(r):
(_,_,w,h) = r
return (w > 0) and (h > 0)
class fmUIdemo:
def __init__(self):
self.capture = cv.CaptureFromCAM(0) # Capture image from device "0"
cv.NamedWindow( "fmUIdemo", 1 )
cv.NamedWindow( "fmProce... | Python |
#!/usr/bin/env python
import cv2.cv as cv
def is_rect_nonzero(r):
(_,_,w,h) = r
return (w > 0) and (h > 0)
class CamShiftDemo:
def __init__(self):
self.capture = cv.CaptureFromCAM(1)
cv.NamedWindow( "CamShiftDemo", 1 )
cv.NamedWindow( "Histogram", 1 )
cv.Set... | Python |
import cv2.cv as cv
import sys
imgco = cv.LoadImage('UPC_A.jpg')
img = cv.CreateImage(cv.GetSize(imgco),8,1)
imgx = cv.CreateImage(cv.GetSize(img),cv.IPL_DEPTH_16S,1)
imgy = cv.CreateImage(cv.GetSize(img),cv.IPL_DEPTH_16S,1)
thresh = cv.CreateImage(cv.GetSize(img),8,1)
### Convert image to grayscale ###
cv.Cv... | Python |
import cv2.cv as cv
vidFile = cv.CaptureFromFile( 'video.wmv' )
nFrames = int( cv.GetCaptureProperty( vidFile, cv.CV_CAP_PROP_FRAME_COUNT ) )
fps = cv.GetCaptureProperty( vidFile, cv.CV_CAP_PROP_FPS )
waitPerFrameInMillisec = int( 1/fps * 1000/1 )
print 'Num. Frames = ', nFrames
print 'Frame Rate = ', fps,... | Python |
import cv2.cv as cv
import time
## main program
cv.NamedWindow("fm_camera", 1)
capture = cv.CaptureFromCAM(1)
my_width=1280
my_height=720
cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_HEIGHT, my_height)
cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_WIDTH, my_width)
cv.SetCaptureProperty(capture, cv.CV_C... | Python |
#!/usr/bin/env python
import cv2.cv as cv
import numpy as np
def is_rect_nonzero(r):
(_,_,w,h) = r
return (w > 0) and (h > 0)
class fmTrackingDemo:
def __init__(self):
self.font = cv.InitFont(cv.CV_FONT_HERSHEY_SIMPLEX, 1, 1, 0, 2, 2)
cv.NamedWindow( "fmTracking_Preview_W... | Python |
import cv2
import sys
import numpy as np
if len(sys.argv)!=2: ## Check for error in usage syntax
print "Usage : python display_image.py <image_file>"
else:
img = cv2.imread(sys.argv[1],cv2.CV_LOAD_IMAGE_COLOR) ## Read image file
if (img == None): ## Check ... | Python |
class Foo(object):
def __init__(self):
self._bar_observers = []
def add_bar_observer(self, observer):
self._bar_observers.append(observer)
def notify_bar(self, param):
for observer in self._bar_observers:
observer(param)
def notify_barEx(self, param):
observer(param)
... | Python |
## {{{ http://code.activestate.com/recipes/578333/ (r1)
#! /usr/bin/env python
""" (Q): which way to use for concatenating strings?
(A): run the script and find out yourself.
"""
import time
bloated_string = 'bloat me' * 10
# method 1, simple concatenation
def slow():
test_string = ''
st... | Python |
import cv
import time
cv.NamedWindow("camera", 1)
capture = cv.CaptureFromCAM(0)
while True:
img = cv.QueryFrame(capture)
cv.ShowImage("camera", img)
if cv.WaitKey(10) == 27:
break
| Python |
##################################################################
class fm_command(object):
def __init__(self):
self.__myStr=''
self.__myTerm='\r'
def on_msgArrival(self,iStr):
self.__myStr += iStr
pos = self.__myStr.find(self.__myTerm)
while (... | Python |
#! /usr/bin/env python
import cv2.cv as cv
color_tracker_window = "Color Tracker"
class ColorTracker:
def __init__(self):
cv.NamedWindow( color_tracker_window, 1 )
self.capture = cv.CaptureFromCAM(0)
def run(self):
while True:
img = c... | Python |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
#####################################################################
# Drawing methods comparison (part of FoFiX) #
# Copyright (C) 2009 Pascal Giard <evilynux@gmail.com> #
# ... | Python |
"""
Lamina module
When you set the display mode for OpenGL, you enable all the coolness of 3D rendering,
but you disable the bread-and-butter raster SDL functionality like fill() and blit().
Since the GUI libraries use those surface methods extensively, they cannot readily be
used in OpenGL displays.
Lamin... | Python |
#####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Kyostila ... | Python |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
#####################################################################
# Drawing methods comparison (part of FoFiX) #
# Copyright (C) 2009 Pascal Giard <evilynux@gmail.com> #
# ... | Python |
#!/usr/bin/python
import os, fnmatch
for root, dirs, files in os.walk("."):
for svg in fnmatch.filter(files, "*.svg"):
svg = os.path.join(root, svg)
print svg, os.system("inkscape -e '%s' -D '%s' -b black -y 0.0" % (svg.replace(".svg", ".png"), svg))
| Python |
#!/usr/bin/env python
# Font tests for FoFiX by Pascal Giard <evilynux@gmail.com>
# based on the demo of laminar.PanelOverlaySurface, by
# David Keeney 2006 which is
# based on version of Nehe's OpenGL lesson04
# by Paul Furber 2001 - m@verick.co.za
from OpenGL.GL import *
from OpenGL.GLU import *
import py... | Python |
#####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire X (FoFiX) #
# Copyright (C) 2009 Team FoFiX ... | Python |
#####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire #
# Copyright (C) 2009 Vlad Emelyanov ... | Python |
#####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire #
# Copyright (C) 2009 Team FoFiX ... | Python |
""" Locale support.
The module provides low-level access to the C lib's locale APIs
and adds high level number formatting APIs as well as a locale
aliasing engine to complement these.
The aliasing engine includes support for many commonly used locale
names and maps them to values suitable for pass... | Python |
#!/usr/bin/env python
# Font tests for FoFiX by Pascal Giard <evilynux@gmail.com>
# based on the demo of laminar.PanelOverlaySurface, by
# David Keeney 2006 which is
# based on version of Nehe's OpenGL lesson04
# by Paul Furber 2001 - m@verick.co.za
from OpenGL.GL import *
from OpenGL.GLU import *
import py... | 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.