def build(self): self.theme_cls.theme_style = 'Dark' self.theme_cls.primary_palette = 'LightGreen' self.theme_cls.accent_palette = 'Red' self.use_kivy_settings = False Config.set('input', 'mouse', 'mouse,multitouch_on_demand') return self.screen
def __init__(self, **kwargs): super(SimScaleBox, self).__init__(**kwargs) # set pre-saved data self.scale = eval(Config.get('simpanel', 'scale')) self.pos = (eval(Config.get('simpanel', 'posX')), eval(Config.get('simpanel', 'posY')))
def _save_configuration(self): sim_scale_box = self._get_scale_box() Config.read('simpanel.ini') Config.set('simpanel', 'posX', round(sim_scale_box.pos[0], 1)) Config.set('simpanel', 'posY', round(sim_scale_box.pos[1], 1)) Config.set('simpanel', 'scale', round(sim_scale_box.scale, 3)) Config.write()
def preprocess_config(self, config): # TODO this method is copied from the mc.py launcher. Prob a better way kivy_config = config['kivy_config'] try: kivy_config['graphics'].update(config['displays']['window']) except KeyError: pass try: kivy_config['graphics'].update(config['window']) except KeyError: pass if 'top' in kivy_config['graphics'] and 'left' in kivy_config[ 'graphics']: kivy_config['graphics']['position'] = 'custom' for section, settings in kivy_config.items(): for k, v in settings.items(): try: if k in Config[section]: Config.set(section, k, v) except KeyError: continue
def on_color(self, instance): print instance Config.set('modules', 'color_picked', instance.color) Config.write() print instance.color for child in self.children: child.background_color = instance.color
def test_log_handles_cp949(self): with mock.patch("locale.getpreferredencoding", return_value="cp949"): FileHandler.fd = None FileHandler.encoding = "utf-8" Config.set("kivy", "log_enable", 1) Config.set("kivy", "log_level", "trace") for string in ["한국어", "Niñas and niños"]: Logger.trace("Lang: call_fn => value=%r" % (string,))
def test_non_utf8_encoding_raises_exception( self, ): # the old error before utf-8 was standard FileHandler.fd = None FileHandler.encoding = "cp949" Config.set("kivy", "log_enable", 1) Config.set("kivy", "log_level", "trace") with pytest.raises(UnicodeError): Logger.trace("Lang: call_fn => value=%r" % ("Niñas and niños",))
def build(self): """Set up App and return :class:`custom_widgets.MainMenu` as root widget.""" self.bind_theme_cls_and_config() self.file_manager = MDFileManager() Config.set("input", "mouse", "mouse,disable_multitouch") os.makedirs(self.apkg_export_dir, exist_ok=True) return MainMenu( screen_dicts=screens.screen_dicts, screen_dir=str(screens.SCREEN_DIR), image_source=str(ASSETS_DIR / "AnkiCardGen.png"), )
def set_screen_size(): w = Config.getint('graphics', 'width') h = Config.getint('graphics', 'height') dim = Window.size if platform not in ('ios', 'android'): Window.size = (w, h) scalex = dim[0] / float(w) scaley = dim[1] / float(h) scale.set_scale(scalex, scaley)
def __init__(self, **kwargs): super(DesignerCodeInput, self).__init__(**kwargs) parser = Config.get_configparser('DesignerSettings') if parser: parser.add_callback(self.on_codeinput_theme, 'global', 'code_input_theme') self.style_name = parser.getdefault('global', 'code_input_theme', 'emacs')
def WindowsCheck(): # If Windows 10: if platform.system() == 'Windows' and platform.release() == '10': # Check Windows 10 for appropriate environment variable proc = subprocess.Popen( 'if defined KIVY_GL_BACKEND (echo True) else (echo False)', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = proc.communicate() # If environment variable KIVY_GL_BACKEND does NOT exist, then if out == False: # Create environment variable to set KIVY_GL_BACKEND to angle # (instead of glew) to prevent issue detecting OpenGL version subprocess.call('setx KIVY_GL_BACKEND angle_sdl2', shell=True) # Set .kivy\config.ini > graphics > multisamples to '0' (for this instance only) # in order to prevent "black screen" Config.set('graphics', 'multisamples', 0)
def on_touch_down(self, touch): if not self.collide_point(*touch.pos): return False self.touch_x, self.touch_y = touch.x, Window.height - touch.y self.drag_clock = Clock.schedule_interval( self._drag, 1 / int(Config.get('graphics', 'maxfps'))) return super().on_touch_down(touch)
def setup(self) -> None: self._config.set('graphics', 'minimum_width', str(WINDOW_SIZE_X)) self._config.set('graphics', 'minimum_height', str(WINDOW_SIZE_Y)) self._config.set('graphics', 'width', str(WINDOW_SIZE_X)) self._config.set('graphics', 'height', str(WINDOW_SIZE_Y)) self._config.set('kivy', 'log_enable', "1") self._config.set('kivy', 'log_level', "warning") self._config.set('kivy', 'window_icon', 'ui/static/application.ico') self._config.set('kivy', 'default_font', [ 'AveriaSansLibre', 'ui/static/fonts/AveriaSansLibre-Regular.ttf', 'ui/static/fonts/AveriaSansLibre-Italic.ttf', 'ui/static/fonts/AveriaSansLibre-Bold.ttf', 'ui/static/fonts/AveriaSansLibre-BoldItalic.ttf', ]) Config.write()
def __init__(self, **kwargs): self.debug_level = 0 self.game = None self.logger = lambda message, level=OUTPUT_INFO: self.log( message, level) self.config_file = self._load_config() self.debug_level = self.config("general/debug_level", OUTPUT_INFO) Config.set("kivy", "log_level", "error") if self.debug_level >= OUTPUT_DEBUG: Config.set("kivy", "log_enable", 1) Config.set("kivy", "log_level", "info") if self.debug_level >= OUTPUT_EXTRA_DEBUG: Config.set("kivy", "log_level", "trace") self.players_info = {"B": Player("B"), "W": Player("W")} self.reset_players()
def __init__(self, force_package_config=False, debug_level=0, **kwargs): self.debug_level = debug_level self.game = None self.logger = lambda message, level=OUTPUT_INFO: self.log( message, level) self.config_file = self._load_config( force_package_config=force_package_config) self.debug_level = debug_level or self.config("general/debug_level", OUTPUT_INFO) Config.set("kivy", "log_level", "warning") if self.debug_level >= OUTPUT_DEBUG: Config.set("kivy", "log_enable", 1) Config.set("kivy", "log_level", "debug") if self.debug_level >= OUTPUT_EXTRA_DEBUG: Config.set("kivy", "log_level", "trace") self.players_info = {"B": Player("B"), "W": Player("W")} self.reset_players()
import os import sys if sys.platform == "win32": # pragma: no cover # Needed so Kivy behaves properly on Windows. os.environ["KIVY_GL_BACKEND"] = "angle_sdl2" from kivy import Config Config.set("graphics", "multisamples", "0") from .core import Card, CardApp, Inputs, palette __all__ = ["Card", "CardApp", "Inputs", "palette"] # IMPORTANT # --------- # Keep these metadata assignments simple and single-line. They are parsed # somewhat naively by setup.py and the Windows installer generation script. __title__ = "pypercard" __description__ = "A HyperCard inspired GUI framework for beginner developers." __version__ = "0.0.1-alpha.2" __license__ = "MIT" __url__ = "https://github.com/ntoll/pypercard" __author__ = "Nicholas H.Tollervey" __email__ = "*****@*****.**"
) """) connection.commit() if __name__ == '__main__': args = sys.argv if len(args) not in (2, 3): print("Ошибка запуска клиента:") print("client.py addr [port]") sys.exit() addr = args[1] try: port = int(args[2]) except Exception: port = 7777 create_db() client = Client(addr, port) print(os.environ) Config.set('graphics', 'width', 1024) Config.set('graphics', 'height', 800) Config.write() ClientApp().run()
from kivy import Config from view.menu_widget import MenuWidget Config.set('graphics', 'resizable', False) import kivy.app class Chess(kivy.app.App): def build(self): return MenuWidget() if __name__ == '__main__': Chess().run()
from kivy.lang import Builder from kivy import Config __author__ = 'vahid' CoreLabel.register( 'FreeFarsi', 'fonts/FreeFarsi.ttf', fn_bold='fonts/FreeFarsiBold.ttf' ) # # CoreLabel.register('Tahoma', # 'fonts/tahoma.ttf', # fn_bold='fonts/tahoma-bold.ttf') Config.set('graphics', 'width', '2096') Config.set('graphics', 'height', '1424') LOREM_EN = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras hendrerit purus ac ante suscipit, sit amet condimentum ex dapibus. In aliquam suscipit erat eget sodales. Phasellus sit amet nibh in neque viverra consectetur eget nec neque. Phasellus ut sem quis erat dictum pretium. Morbi ullamcorper leo nulla, et ultricies elit dictum nec. Proin eleifend ligula eget felis tempor efficitur. Duis ornare velit ante, sed tristique ipsum faucibus eu. Curabitur gravida ex pulvinar massa blandit fringilla. Nam eget sem aliquet, dictum urna quis, volutpat nibh. Morbi lobortis dolor viverra velit facilisis, eget tincidunt purus fermentum. Aliquam accumsan velit dui, a congue orci imperdiet non. Curabitur vehicula nisl nec fringilla tempus. Pellentesque ut faucibus risus. Suspendisse rutrum vel nunc ut commodo." LOREM_FA = "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است. چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد. کتابهای زیادی در شصت و سه درصد گذشته، حال و آینده شناخت فراوان جامعه و متخصصان را می طلبد تا با نرم افزارها شناخت بیشتری را برای طراحان رایانه ای علی الخصوص طراحان خلاقی و فرهنگ پیشرو در زبان فارسی ایجاد کرد. در این صورت می توان امید داشت که تمام و دشواری موجود در ارائه راهکارها و شرایط سخت تایپ به پایان رسد وزمان مورد نیاز شامل حروفچینی دستاوردهای اصلی و جوابگوی سوالات پیوسته اهل دنیای موجود طراحی اساسا مورد استفاده قرار گیرد." class RTLTextApp(App): def build(self): Builder.load_string(""" <Label>: font_name: 'FreeFarsi'
## controls the behavior of the RootWidget defined in the ## file viscomp.kv. ## ## It's purpose is two-fold: ## (a) It isolates all functions called by the widgets viscomp.kv ## from all other code ## (b) It defines all the routines required for the GUI to operate ## correctly ## import kivy kivy.require('1.9.1') from kivy import Config # disable fullscreen mode Config.set('graphics','fullscreen','0') # do not allow window resizing Config.set('graphics','resizable','0') from kivy.app import App from kivy.uix.label import Label from kivy.properties import StringProperty from kivy.properties import ObjectProperty from kivy.graphics import * from kivy.input.postproc.doubletap import * from kivy.lang import Builder from kivy.uix.floatlayout import FloatLayout from kivy.uix.popup import Popup from kivy.logger import Logger from control import InpaintingControl
from kivy.lang import Builder from kivy.metrics import dp from kivy.properties import ObjectProperty, StringProperty, NumericProperty, \ ListProperty, OptionProperty from kivy.uix.behaviors import ButtonBehavior from kivy.uix.floatlayout import FloatLayout from kivy.uix.gridlayout import GridLayout import material_resources as m_res # from ripplebehavior import RectangularRippleBehavior # from theming import ThemableBehavior # from kivy.core.text import LabelBase from kivy.uix.image import AsyncImage from kivy import Config Config.set('graphics', 'default_font', ["font", ".font.ttf", ".font.ttf", ".font.ttf", ".font.ttf"]) #LabelBase.register(name="OpenSans", fn_regular="Roboto-Regular.ttf") Builder.load_string(''' #:import m_res material_resources #:import get_color_from_hex __main__.get_color_from_hex <MDList> cols: 1 size_hint_y: None height: self._min_list_height+25 padding: 0, self._list_vertical_padding <BaseListItem> size_hint_y: None canvas: Color:
# Author: Asa Holland # Date: 06/04/2020 # Description: A GUI implementation of the game of Gess using Kivy from GessGame import GessGame from kivy.app import App from kivy.lang import Builder from kivy.uix.boxlayout import BoxLayout from kivy.uix.button import Button from kivy.graphics import Color from kivy.graphics import Line from kivy import Config # Set minimum size of the window to avoid texture problems Config.set('graphics', 'minimum_width', '600') Config.set('graphics', 'minimum_height', '600') Config.set('kivy', 'window_icon', None) # Write a kivy builder string representing the main board display including buffer space and buttons kv_string = """ <BackgroundColor@Widget> background_color: 1, 1, 1, 1 canvas.before: Color: rgba: root.background_color Rectangle: size: self.size pos: self.pos
################################# # ----- Importações iniciais ----- # # import kivy # kivy.require('1.11.0') import os from kivy import Config import platform # ----- Soluciona problemas de OpenGL e placas graficas antigas em windows -- # if platform.system() == 'Windows': os.environ['KIVY_GL_BACKEND'] = 'angle_sdl2' Config.set('graphics', 'multisamples', '0') # ----- Configuração da janela ----- # Config.set('graphics', 'resizable', True) Config.set('kivy', 'exit_on_escape', '0') Config.set('graphics', 'width', 350) Config.set('graphics', 'heigth', 500) # ----- Importações ----- # import json from kivy.app import App from kivy.uix.floatlayout import FloatLayout # ----- Cria pastas ----- #
from kivy.graphics import Color, Ellipse, Rectangle from kivy.properties import ListProperty from kivy.uix.behaviors import ButtonBehavior from kivy.uix.boxlayout import BoxLayout from kivy.uix.actionbar import ActionBar from kivy.uix.label import Label from kivy.uix.screenmanager import Screen, ScreenManager kivy.require('1.7.0') __version__ = "0.1.0" from kivy.app import App from kivy.graphics.context import Clock Config.set('graphics', 'width', '700') Config.set('graphics', 'height', '700') Config.write() class TextoClick(ButtonBehavior, Label): cor = ListProperty([0.1, 0.5, 0.7, 0]) cor2 = ListProperty([0.1, 0.1, 0.1, 0]) class Botao(ButtonBehavior, Label): cor = ListProperty([0.1, 0.5, 0.7, 1]) cor2 = ListProperty([0.1, 0.1, 0.1, 1]) def __init__(self, **kwards): super(Botao, self).__init__(**kwards)
# -- Set config options -- from kivy import Config Config.set('graphics', 'minimum_width', '800') Config.set('graphics', 'minimum_height', '500') Config.set('input', 'mouse', 'mouse,multitouch_on_demand') # -- Core kivy modules -- from kivy.app import App from kivy.core.window import Window from kivy.uix.floatlayout import FloatLayout from kivy.uix.boxlayout import BoxLayout from kivy.properties import ObjectProperty, StringProperty from kivy.uix.button import Button from kivy.uix.treeview import TreeViewNode, TreeViewLabel, TreeView from kivy.uix.popup import Popup from kivy.uix.tabbedpanel import TabbedPanel, TabbedPanelItem from kivy.factory import Factory from kivy.clock import Clock from kivy_garden.graph import MeshLinePlot, Graph # -- Other python modules -- import numpy as np from pubsub import pub import random import time import concurrent # -- Namespace modules -- from ..data.spectrum import Spectrum, Trace from ..data.models import Model
from kivy import Config from kivy.uix.image import Image import pdf Config.set('graphics', 'width', 1500) Config.set('graphics', 'height', 800) from kivy.app import App import util from kivy.uix.boxlayout import BoxLayout from kivy.uix.button import Button from kivy.uix.gridlayout import GridLayout from kivy.uix.textinput import TextInput class MyApp(App): dict_of_update = {} watcher = None def __init__(self, **kwargs): super().__init__(**kwargs) self.title = 'Система паспортного учета' self.main_layout = BoxLayout( orientation='horizontal', ) # создаем главный макет, в котором будут макеты поиска и остальные self.list_of_data = { 'Введите фамилию': 'last_name', # словарь с данными кнопошек 'Введите имя': 'first_name', 'Введите отчество': 'patronymic', 'Серия': 'series', 'Номер': 'number_', 'Пол': 'sex',
from kivy.core.window import Window from kivy.garden.contextmenu import ContextMenu, ContextMenuTextItem from kivy.graphics import Color, Rectangle, Ellipse from kivy.graphics import Translate, ScissorPush, ScissorPop, Scale from kivy.graphics.vertex_instructions import Line, Quad from kivy.lang import Builder from kivy.properties import Property from kivy.uix.popup import Popup from kivy.uix.widget import Widget from map import Map """This needs for .kv file""" ContextMenu, ContextMenuTextItem Config.set('input', 'mouse', Config.get('input', 'mouse') + ',disable_multitouch') __author__ = 'leon.ljsh' class CurrentAction(Enum): none = 0 wall = 1 headline = 2 car = 3 finish = 4 edit = 5 class MapDrawer(Widget): action = Property(CurrentAction.none)
from kivy import Config Config.set('graphics', 'width', '780') Config.set('graphics', 'height', '360') Config.set('graphics', 'minimum_width', '650') Config.set('graphics', 'minimum_height', '300') from kivy.app import App from kivy.lang import Builder from kivy.metrics import dp from kivy.properties import ObjectProperty, NumericProperty, Clock from kivy.uix.relativelayout import RelativeLayout from kivy.uix.widget import Widget from audio_engine import AudioEngine from sound_kit_service import SoundKitService from track import TrackWidget Builder.load_file("track.kv") Builder.load_file("play_indicator.kv") TRACK_NB_STEPS = 16 MIN_BPM = 80 MAX_BPM = 160 class VerticalSpacingWidget(Widget): pass class MainWidget(RelativeLayout): tracks_layout = ObjectProperty()
from kivy import Config Config.set('graphics', 'multisamples', '0') import visa from kivy.app import App from kivy.lang import Builder from kivy.uix.boxlayout import * from kivy.properties import * from kivy.uix.label import * from kivy.uix.button import * from kivy.uix.listview import * from kivy.uix.anchorlayout import * from kivy.uix.screenmanager import Screen, ScreenManager from kivy.uix.listview import ListView from kivy.clock import Clock import bode import gen, osc from math import * import numpy as np rm = visa.ResourceManager() Builder.load_file("test.kv") wait_time_scale = np.linspace(0.001, 10, 10000) points_scale = np.linspace(10, 100, 100) freq_scale = np.logspace(2, 7.3, 1000)
def build(self): if self.parent == None: raise KivyAppException("Variable parent not defined in KivyApp") Config.set('kivy', 'exit_on_escape', 0) Config.set('kivy', 'log_enable', 0) Clock.schedule_interval(self.on_update, 0) #Schedule main update
''' ProgressSpinner =============== Android Lollipop style progress spinner. ''' from kivy.lang import Builder from kivy.core.image import Image as CoreImage from kivy.properties import NumericProperty, ListProperty, BoundedNumericProperty, StringProperty, ObjectProperty from kivy.animation import Animation from kivy.clock import Clock from kivy.properties import BooleanProperty from kivy.uix.widget import Widget from kivy import Config Config.set('graphics', 'multisamples', '0') #sdl error Builder.load_string(''' <ProgressSpinnerBase>: _size: min(self.height, self.width) _rsize: self._size / 2. _stroke: max(0.1, self._rsize / 20. if self.stroke_width is None else self.stroke_width) _radius: self._rsize - self._stroke * 2. <ProgressSpinner>: canvas: Color: rgba: self.color Line: circle: (self.center_x, self.center_y, self._radius,
def make_fake_fullscreen(self): Window.fullscreen = 0 Window.borderless = 1 Window.pos = 0, 0 Window.left = 0 Window.top = 0 width, height = int(Config.get('graphics', 'screen_width')), int( Config.get('graphics', 'screen_height')) Config.set('graphics', 'width', width) Config.set('graphics', 'height', height) Config.set('graphics', 'left', 0) Config.set('graphics', 'top', 0) Config.write() Window.size = width, height self.width, self.height = width, height
os.environ['KIVY_GL_BACKEND'] = 'sdl2' from kivy.core.window import Window from kivy import Config from kivy.app import App from kivy.uix.floatlayout import FloatLayout from kivy.lang import Builder, Parser, ParserException from kivy.graphics.texture import Texture import tkinter import tkinter.filedialog import src.detect_utils as det import src.draw_utils as draw from widgets.result_item import ResultItem Config.read(os.path.expanduser('~/.kivy/config.ini')) Config.set('graphics', 'width', '1200') Config.set('graphics', 'height', '800') Config.set('graphics', 'resizeable', 0) Builder.load_file('./Alpr.kv') # APP_ROOT = os.path.dirname(__file__) class AlprScreen(FloatLayout): image_path = "" top_plate = "" img = None def __init__(self, **kwargs): super(AlprScreen, self).__init__(**kwargs) self.result_list = ["asd"]