Skip to content

Instantly share code, notes, and snippets.

@cvpe
cvpe / WeightWatchers.py
Created Oct 10, 2020
WeightWatchers.py
View 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
View 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')
View 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():
View 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 Apr 15, 2020
customMenuItem.py
View 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 Apr 12, 2020
Double_keyboard.py
View 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 Apr 12, 2020
find_in_files_new_menu.py
View 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 Apr 12, 2020
find_in_files_new_menu.py
View 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 Apr 9, 2020
find_in_files_new_menu.py
View 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
@cvpe
cvpe / Double_keyboard.py
Created Apr 11, 2020
Double_keyboard.py
View 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: