Skip to content

Instantly share code, notes, and snippets.

@cvpe
cvpe / WeightWatchers.py
Created October 10, 2020 19:44
WeightWatchers.py
'''
todo
.. Priorité
ok - record Aliment points_base et base et option ingredients
.. - 1️⃣ revoir add_food
.. - ❗️pas créer aliment si nom existe déjà
check dans ecran où on tape le nom et le ok
.. - ecrans où on doit checker
.. - nom: pas vide, inexistant
.. - kcal: vide? ou numerique
@cvpe
cvpe / MyUITableView.py
Created October 6, 2020 06:05
MyUITableView.py
# coding: utf-8
# https://gist.github.com/shaun-h/da54aafc2aeaf5a316e8de1b56d19fd3
from __future__ import absolute_import
from objc_util import *
import ui
from collections import OrderedDict
from six.moves import range
import console
UITableView = ObjCClass('UITableView')
@cvpe
cvpe / a.py
Created May 14, 2020 16:03
a.py
from objc_util import *
import ui
def preferredInterfaceOrientationForPresentation(_self,_cmd):
#self = ObjCInstance(_self) # UIViewController
#print('preferredInterfaceOrientationForPresentation:',self)
return 3 # UIInterfaceOrientationLandscapeLeft
@on_main_thread
def main():
@cvpe
cvpe / Photos Book.py
Created May 7, 2020 15:16
Photos Book.py
# - bug: if too much photos (10?), previous at left disappears too quickly
# - bug: rerun sometimes crashes even if Pythonista app restarts too quickly
from objc_util import *
import ui
import math
import photos
import time
import threading
load_framework('SceneKit')
@cvpe
cvpe / customMenuItem.py
Created April 15, 2020 11:47
customMenuItem.py
# from https://gist.github.com/jsbain/9edea18951d296ca46aca8868791e04e
# small modifications of @jonB script to:
# - pass to MenuNotificationObserver class, new menu items as
# either one item, as originally
# either as a tuple with 2nd element as title of an existing option
# where to insert before
# - no insert if existing option does not exist to avoid unuseless option
# - 15apr2020: if the searched text did contain long unicode characters,
# text range was erroneous, use anoter way adviced by @jonB
@cvpe
cvpe / Double_keyboard.py
Created April 12, 2020 15:32
Double_keyboard.py
# todo
# - right aligned keys?
import ui
from objc_util import *
import ui
from objc_util import *
def SetTextFieldPad(tf, pad=None, clearButtonMode=False, undo_redo_pasteBarButtons=True, textfield_did_change=None):
if not pad:
@cvpe
cvpe / find_in_files_new_menu.py
Created April 12, 2020 15:00
find_in_files_new_menu.py
import customMenuItem
from objc_util import *
import os
import threading
import ui
class my_thread(threading.Thread):
global main_view
def __init__(self,view,search_term):
threading.Thread.__init__(self)
@cvpe
cvpe / find_in_files_new_menu.py
Created April 12, 2020 14:42
find_in_files_new_menu.py
import customMenuItem
from objc_util import *
import os
import threading
import ui
class my_thread(threading.Thread):
global main_view
def __init__(self,view,search_term):
threading.Thread.__init__(self)
@cvpe
cvpe / Double_keyboard.py
Created April 11, 2020 20:00
Double_keyboard.py
# todo
# - right aligned keys?
import ui
from objc_util import *
import ui
from objc_util import *
def SetTextFieldPad(tf, pad=None, clearButtonMode=False, undo_redo_pasteBarButtons=True, textfield_did_change=None):
if not pad:
@cvpe
cvpe / find_in_files_new_menu.py
Created April 9, 2020 12:26
find_in_files_new_menu.py
import customMenuItem
from objc_util import *
class findInSourcesMenu(customMenuItem.PYUIMenuItem):
__selector__ = 'findInSourcesMenu'
__title__ = 'Find'
def action(self, selected_text, selection, editorview):
import console
import os
import ui