Skip to content

Instantly share code, notes, and snippets.

View Phuket2's full-sized avatar

Ian Joicey Phuket2

  • Pattaya, Thailand
View GitHub Profile
@Phuket2
Phuket2 / simple_view2.py
Created September 27, 2016 08:28
simple_view2.py
# Pythonista Forum - @Phuket2
import ui, editor
'''
a_path = os.path.expanduser('~/Documents/MyProjects/MyViews')
sys.path.append(a_path)
import class_walker as cw
'''
# https://gist.github.com/42924cb9a311ae47084e7f0d05f362f4
@Phuket2
Phuket2 / simple_view2.py
Created September 26, 2016 17:33
simple_view2.py
# Pythonista Forum - @Phuket2
import ui, editor
'''
a_path = os.path.expanduser('~/Documents/MyProjects/MyViews')
sys.path.append(a_path)
import class_walker as cw
'''
def add_labels_to_sv(parent):
@Phuket2
Phuket2 / simple_view.py
Created September 26, 2016 11:56
simple_view.py
# Pythonista Forum - @Phuket2
import ui, editor
def add_labels_to_sv(parent):
# just for debuging. add a label to each subview with the views name
for v in parent.subviews:
lb = ui.Label()
lb.text = v.name
lb.size_to_fit()
lb.center = v.bounds.center()
@Phuket2
Phuket2 / safe_css_color.py
Created September 22, 2016 12:26
safe_css_color.py
'''
Pythonista Forum - @Phuket2
'''
import ui
_css_colors=['rosybrown', 'antiquewhite', 'lightsteelblue', 'white', 'darkblue', 'darkviolet', 'plum', 'darkcyan', 'blanchedalmond', 'chocolate', 'sienna', 'tomato', 'peachpuff', 'lightyellow', 'bisque', 'aqua', 'oldlace', 'maroon', 'palegreen', 'chartreuse', 'darkturquoise', 'linen', 'magenta', 'lemonchiffon', 'powderblue', 'papayawhip', 'gold', 'khaki', 'lightseagreen', 'darkred', 'floralwhite', 'turquoise', 'mediumspringgreen', 'indianred', 'lightgreen', 'crimson', 'mintcream', 'lavender', 'purple', 'orchid', 'darkslateblue', 'whitesmoke', 'moccasin', 'beige', 'mistyrose', 'dodgerblue', 'hotpink', 'lightcoral', 'goldenrod', 'coral', 'cadetblue', 'black', 'mediumseagreen', 'gainsboro', 'paleturquoise', 'darkgreen', 'darkkhaki', 'mediumblue', 'dimgray', 'darkorchid', 'deeppink', 'mediumvioletred', 'lightgray', 'darkgrey', 'lightsalmon', 'lightblue', 'lightslategrey', 'slategray', 'slateblue', 'greenyellow', 'darkgray', 'lawngreen', 'cornflowerblue', 'midnightbl
@Phuket2
Phuket2 / css_color_selector.py
Created September 20, 2016 13:51
css_color_selector.py
'''
Pythonista Forum - @Phuket2
CSS Color Lookup - wrench item
A very basic utility to look up a css name in a list with a filter
function and a copy to clipbord the color, quoted.
Only works for Python 3.xx, i think only because of the use of
super().__init__ in the classes
Very basic, but can be handy. Personally, i like using css colors
@Phuket2
Phuket2 / css_color_selector.py
Created September 20, 2016 12:16
css_color_selector.py
'''
Pythonista Forum - @Phuket2
CSS Color Lookup - wrench item
A very basic utility to look up a css name in a list with a filter
function and a copy to clipbord the color, quoted.
Only works for Python 3.xx, i think only because of the use of
super().__init__ in the classes
Very basic, but can be handy. Personally, i like using css colors
@Phuket2
Phuket2 / tester.py
Created August 24, 2016 17:25
tester.py
import editor
import math
import ui
import circular_slider as CS
def css_clr_to_rgba(css_name, a):
c = ui.parse_color(css_name)
return (c[0], c[1], c[2], a)
@Phuket2
Phuket2 / tester.py
Created August 24, 2016 13:35
tester.py
import editor
import math
import ui
import circular_slider as CS
def css_clr_to_rgba(css_name, a):
c = ui.parse_color(css_name)
return (c[0], c[1], c[2], a)
@Phuket2
Phuket2 / PYUIhelper.py
Created August 20, 2016 16:24
PYUIhelper.py
import ui, editor, clipboard
import base64, bz2, json, textwrap
_pyui_str = \
'''
QlpoOTFBWSZTWZism/sAAR7fgFUQUOd/0D/AFY6/r9/KMAF5qwwSiTTQp7Qnok09QaAbU9
R6QeoMaj0g0Co8piANMg0ADQAAAEiiaCnppHqb1Q9QaHqAAAA02pISuSGAc+YNeVsQiyii
ARtlFRalIpEJFIAb6AkKoBQXb4wKWSUP3cy89WpMI2EGmUIw6n+lY6hsxid+BnkQjkkCJK
Skaqimig1ViFXva0dCqXpfnYnCEGlwivUhQZideAUAwYLSOZnTFfMwhEKJgFoykQWBXRik
HXLEAKGJ1aIKFD54dSXBdBanX1TzzvhLKTXyAJfUj446sEp09NktmFO1PdwGg69VeWzZty
@Phuket2
Phuket2 / datepicker.py
Created August 20, 2016 12:34
datepicker.py
import ui, editor
import calendar
from datetime import datetime, timedelta
import time
from datetime import date as Date
c = calendar.Calendar()
# seems like a good idea, mostly. But feels it should have a stronger