This file contains hidden or 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
| # coding: utf-8 | |
| import ui | |
| import functools | |
| import time | |
| import string | |
| # decorator memoize copied from .... | |
| # https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize | |
| # note that this decorator ignores **kwargs |
This file contains hidden or 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 threading import Timer | |
| import threading | |
| import datetime as dt | |
| from datetime import timedelta | |
| import ui | |
| class MyTimer(object): | |
| def __init__(self, *args, **kwargs): | |
| self.thread = None |
This file contains hidden or 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
| import ui | |
| import datetime as dt | |
| from time import time, strftime | |
| _sfn = 'Arial Rounded MT Bold' | |
| def current_time_str(): | |
| return strftime('%H:%M:%S') | |
| def _make_label(name, text, font, color): |
This file contains hidden or 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
| import ui | |
| import copy | |
| class UIText(object): | |
| dict_list = [] | |
| def __init__(self, r = ui.Rect(), *args, **kwargs): | |
| r = ui.Rect(*r) | |
| # defaults |
This file contains hidden or 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
| import ui | |
| import copy, math, functools | |
| ''' | |
| @Phuket2 | |
| Class - UIText | |
| For writing text in rects. | |
| the instance attrs are preserved if used as a context manager | |
| ie, 'with' | |
| ''' |
This file contains hidden or 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
| import ui, io | |
| def get_max_fontsize(rect, font_name): | |
| r = ui.Rect(*rect) | |
| last_w = last_h = 0 | |
| for i in range(5, 1000): | |
| w, h = ui.measure_string('W', max_width=0, |
This file contains hidden or 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
| import ui | |
| import base64, bz2, textwrap | |
| import clipboard, editor | |
| # wrapper.py, Pythonista Forum @JonB | |
| # https://forum.omz-software.com/topic/3176/use-a-pyui-file-in-another-pyui-file | |
| # remember to add the the name of the class to the 'Custom View Class' | |
| # in the .pyui | |
| __the_view = \ |
This file contains hidden or 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
| # Forum @Phuket2 | |
| import ui, editor | |
| class UIShapeBase(object): | |
| def __init__(self, frame, *args, **kwargs): | |
| self.frame = ui.Rect(*frame) | |
| self.margin = (0, 0) | |
| self.origin = (0, 0) | |
| self.shape = None | |
| self.alpha = 1 |
This file contains hidden or 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
| import ui | |
| ''' | |
| Forum user: @Phuket2 | |
| licence: I will pay you to use it, license :) | |
| 3 controls that just manipulate ui.Button's attrs | |
| This is more proof of concept rather than finished code. | |