This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: UTF-8 -*- | |
import re,os,gtk,gio,magic | |
def geticon(filename): | |
m = magic.open(magic.MAGIC_MIME) | |
m.load() | |
mime = m.file(filename).split(";")[0] | |
mime = gio.content_type_get_icon(mime).get_names() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert zoomwindow.png -fill darkgrey -transparent white -fuzz 50% -fill white -opaque black test.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from pivy import coin | |
>>> sg=Gui.ActiveDocument.ActiveView.getSceneGraph() | |
>>> clip = coin.SoClipPlane() | |
>>> clip.on.setValue(False) | |
>>> plane = coin.SbPlane(coin.SbVec3f(0,0,1),1000) | |
>>> plane | |
<pivy.coin.SbPlane; proxy of <Swig Object of type 'SbPlane *' at 0x7fd8424b62a0> > | |
>>> clip.plane.setValue(plane) | |
>>> sg.addChild(clip) | |
>>> clip.on.setValue(True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def export(objectslist,filename): | |
gfile = open(filename,"wb") # open the file with write permission | |
for obj in objectslist: | |
if hasattr(obj,"Path"): # not all objects might be paths | |
gfile.write(obj.Path.toGCode()) # this simply dumps the path data as internal gcode | |
commands = obj.Path.Commands # but we could also do stuff with the commands list | |
gfile.close() | |
print "successfully exported " + filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewProviderPath: | |
def __init__(self,vobj): #mandatory | |
obj.addProperty("App::PropertyFloat","SomePropertyName","PropertyGroup","Description of this property") | |
obj.Proxy = self | |
def __getstate__(self): #mandatory | |
return None | |
def __setstate__(self,state): #mandatory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getTool(self,obj,number=0): | |
"retrieves a tool from a hosting object with a tooltable, if any" | |
for o in obj.InList: | |
if hasattr(o,"Tooltable"): | |
return o.Tooltable.getTool(number) | |
# not found? search one level up | |
for o in obj.InList: | |
return self.getTool(o,number) | |
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = open("/path/to/myfile.ncc") | |
s1 = f.read() | |
from PathScripts import pre_example | |
s2 = pre_example.parse(s1) | |
import Path | |
p = Path.Path(s2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require('../../../config/config.php'); | |
date_default_timezone_set("America/Sao_Paulo"); | |
header('Content-Type: text/vcard; charset=utf-8'); //To tell that the data is a visiting card format | |
header('Content-Disposition: attachment; filename=projectpier_contacts.vcf'); //To make the data downloadable | |
$conn = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die('Could not connect to MySQL database. ' . mysql_error()); | |
mysql_select_db(DB_NAME,$conn)or die(mysql_error()); | |
$companies = array(); | |
$comp = mysql_query('SELECT name,id FROM `'.DB_PREFIX.'companies`'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
187,189d186 | |
< $todo = new iCalendar_Todo(); | |
< $todo->setPropertyValue('SUMMARY', $project->getName().": ".$task->getText()); | |
< $todo->setPropertyValue('UID', 'a9idfv00fd99q344o' . rand() . 'cgef733m6bs@google.com'); | |
190a188,191 | |
> $lines = explode("\n",$task->getText()); | |
> $title = $lines[0]; | |
> $title = preg_replace( "/\r|\n/", "", $title ); | |
> $text = preg_replace( "/\r|\n/", " ", $task->getText() ); | |
191a193,195 |