def __init__(self, **kwargs): super().__init__(**kwargs) self.theme_day = Theme(Theme.WHITE, Theme.DARK_GRAY, Theme.BLACK, Theme.BLACK, Theme.ORANGE, Theme.BLACK, Theme.LIGHT_GRAY, Theme.BLACK) self.theme_night = Theme(Theme.BLACK, Theme.DARK_GRAY, Theme.NIGHT_RED, Theme.NIGHT_RED, Theme.NIGHT_RED2, Theme.BLACK, Theme.DARK_GRAY, Theme.BLACK) self.theme = self.theme_day
def read_config(self, path): """parse alot's config file from path""" spec = os.path.join(DEFAULTSPATH, 'alot.rc.spec') newconfig = read_config(path, spec, checks={ 'mail_container': mail_container, 'force_list': force_list, 'align': align_mode, 'attrtriple': attr_triple, 'gpg_key_hint': gpg_key }) self._config.merge(newconfig) hooks_path = os.path.expanduser(self._config.get('hooksfile')) try: self.hooks = imp.load_source('hooks', hooks_path) except: logging.debug('unable to load hooks file:%s' % hooks_path) if 'bindings' in newconfig: newbindings = newconfig['bindings'] if isinstance(newbindings, Section): self._bindings.merge(newbindings) # themes themestring = newconfig['theme'] themes_dir = self._config.get('themes_dir') if themes_dir: themes_dir = os.path.expanduser(themes_dir) else: configdir = os.environ.get('XDG_CONFIG_HOME', os.path.expanduser('~/.config')) themes_dir = os.path.join(configdir, 'alot', 'themes') logging.debug(themes_dir) # if config contains theme string use that if themestring: if not os.path.isdir(themes_dir): err_msg = 'cannot find theme %s: themes_dir %s is missing' raise ConfigError(err_msg % (themestring, themes_dir)) else: theme_path = os.path.join(themes_dir, themestring) try: self._theme = Theme(theme_path) except ConfigError as e: err_msg = 'Theme file %s failed validation:\n' raise ConfigError((err_msg % themestring) + str(e.message)) # if still no theme is set, resort to default if self._theme is None: theme_path = os.path.join(DEFAULTSPATH, 'default.theme') self._theme = Theme(theme_path) self._accounts = self._parse_accounts(self._config) self._accountmap = self._account_table(self._accounts)
def __init__(self, group, class_group=None, desktop_entry=None, identifier=None): self.dockbar_r = weakref.ref(group.dockbar_r()) self.theme = Theme() self.globals = Globals() connect(self.globals, "color-changed", self.reset_surfaces) self.desktop_entry = desktop_entry self.identifier = identifier self.class_group = class_group # Setting size to something other than zero to # avoid crashes if surface_update() is runned # before the size is set. self.size = 15 self.icon = None self.surfaces = {} self.average_color = None self.max_win_nr = self.theme.get_windows_cnt() self.types_in_theme = 0 for type in self.theme.get_types(): if not type in self.TYPE_DICT: continue self.types_in_theme = self.types_in_theme | self.TYPE_DICT[type]
def __init__(self, geo=None): cad_geometry.__init__(self) self.list_patchInfo = [] if geo is not None: for i in range(0, geo.npatchs): P = geo[i] # this is really a clone and not a copy patch = P.clone() self.append(patch) # add attributs from xml description when it exists self.list_patchInfo.append(PatchInfo(patch)) self.set_internal_faces(geo.internal_faces) self.set_external_faces(geo.external_faces) self.set_connectivity(geo.connectivity) self.set_attributs(geo.attributs) self.MeshColor = COLOR_DEFAULT_MESH self.NurbsColor = Theme().color_viewer( 'default_patch') #COLOR_DEFAULT_GEOMETRY self.PointsColor = COLOR_DEFAULT_POINTS self.PointsSize = SIZE_GEOMETRY_POINTS self.showPoints = False self.showMesh = False self._show = True # needed for the tree inspector self._treeItem = None # needed when extracting faces for the instpector tree self.face = None
def __init__(self): self.ss = Size() self.theme = Theme() ### CRAZY COULD BE: # 0 - Boring. Very boring. Classical pong # 1 - Better than prev. Buffs appeared 1 time a 30*250 ms # 2 - If you don't know what to choose, use it. Buffs appeared 1 time a 30*100 ms # 3 - <del>CRAZIEST</del> FUNNIEST CHOICE EVER. BUFFS APEARED 1 TIME A 0.3 S # 4 - epileptic self.CRAZY = PositionList(("Classic", "Soft", "Normal", "Best", "Hard"), 2) # root window self.root = Tk() self.root.title("FPong") self.root.geometry("+0+0") self.root.iconphoto(False, PhotoImage(file="./images/window_icon.png")) self.root.resizable(False, False) # Create Canvas wit elements on it self.__init_canva() self.root.mainloop()
def load_theme(self): """Load custom user theme, global theme or default.""" # custom theme requested by user via command line properties self.runtime['theme'] = {} self.runtime['theme']['path'] = self.theme_search( self.parameters.THEME) if self.runtime['theme']['path'] is None: self.runtime['theme']['path'] = os.path.join( GPATH['THEMES'], 'default') self.log.warning("[SETUP] - Fallback to default theme") theme_conf = os.path.join(self.runtime['theme']['path'], "theme.adoc") if not os.path.exists(theme_conf): self.log.error("[SETUP] - Theme config file not found: %s", theme_conf) sys.exit(-1) # load theme configuration with open(theme_conf, 'r') as fth: theme = json.load(fth) for prop in theme: self.runtime['theme'][prop] = theme[prop] self.log.info("[APP] - Theme: %s" % self.runtime['theme']['name']) self.log.debug("[SETUP] - Theme %s v%s for KB4IT v%s", theme['name'], theme['version'], theme['kb4it']) # Get theme directories self.runtime['theme']['templates'] = os.path.join( self.runtime['theme']['path'], 'templates') self.runtime['theme']['logic'] = os.path.join( self.runtime['theme']['path'], 'logic') # Get date-based attributes from theme. Date attributes aren't # displayed as properties but used to build events pages. try: ignored_keys = self.runtime['theme']['ignored_keys'] for key in ignored_keys: self.log.debug( "[SETUP] - Ignored key(s) defined by this theme: %s", key) self.srvdtb.ignore_key(key) except KeyError: self.log.debug("[SETUP] - No ignored_keys defined in this theme") # Register theme service sys.path.insert(0, self.runtime['theme']['logic']) try: from theme import Theme self.app.register_service('Theme', Theme()) self.srvthm = self.get_service('Theme') except Exception as error: self.log.warning( "[SETUP] - Theme scripts for '%s' couldn't be loaded", self.runtime['theme']['id']) self.log.error("[SETUP] - %s", error) raise self.log.debug("[SETUP] - Loaded theme '%s'", self.runtime['theme']['id'])
def __init__(self, filename, Objects=Alpha1): self.Objects = Objects self.vars = {} self.jlyreader = JLYReader(filename) self.actionListeners = [] self.head = Head(self) self.theme = Theme(self) self.body = Body(self)
def get_theme(order): # try: # theme = Theme(order).get() # except: # abort(404) theme = Theme(order).get() result = {"result": True, "data": {"opinions": theme}} return make_response(jsonify(result))
def start(self): self.screen = curses.initscr() curses.noecho() curses.cbreak() curses.curs_set(0) curses.start_color() self.screen.nodelay(1) # Needs to be done after `initscr()` call self.theme = Theme()
def __init__(self): """TODO: INSERT DOCSTRING.""" # Set the exception callback to handle any of the exceptions # that are raised. tk.Tk.report_callback_exception = exception.unhandled_error # Set what the program will do when closed (stop / restart). self.return_status: FormReturnStatus = FormReturnStatus.STOP # Load all of the 'quiz' elements. self.grader: Grader = Grader(Settings.active_files) # Set form values from the settings. self.font_style: str = Settings.typeface self.font_size: int = Settings.font_size # The segment of the data objects to display. self.display_item: int = Settings.display_item self.theme: Theme = Theme() self.settings_form: SettingsForm = None # Tracks if the settings form has closed. If so preform singe action # updates, such as updating the Grader, this is to limit number # of unnessicary file reads. self.update_after_settings_finish: bool = False # Create the main form and configure it. self.form = tk.Tk() self.form.geometry(INIT_SCREEN_SIZE) self.form.minsize(MIN_SCREEN_SIZE[0], MIN_SCREEN_SIZE[1]) self.form.title(SCREEN_TITLE) # Create the main frame to hold all the elements. self.frame: Frame = Frame(self.form) # Make the main frame fit the size of the window. self.frame.pack(fill=BOTH, expand=1) self.theme.add_to_group(self.frame, ThemeGroup.MAIN_GROUP) # Tracks if the user is in the review state (i.e. looking at the # anwser) self.is_reviewing: bool = True # Tracks if the user is allowed to move on. This is activated # for a short time when the user gets a question wrong. This # allows them time to review the correct answer, and prevents # them from accidentaly skipping it. self.progress_blocked: bool = False # A queue that other threads can store function calls to be # executed by the main thread on a form update. self.scheduled_actions: Queue = Queue() self.create_widgets() # Populate the form. # Set the 'Enter' key to activate the submit button so the user # can submit using the keyboard. self.form.bind(RETURN_KEY, self.submit_callback) self.theme.set_theme_color() # Theme the form. self.display(INITAL_MESSAGE) # Show the user the welcome message.
def create_theme(self, name: str, variant: str = "", intensity: int = 100) -> Theme: """ Create a theme """ return Theme(f'base16-{name.lstrip("base16-")}', self.colours, variant, intensity, path=self.path)
def __init__(self, liststore): self.liststore = liststore self.gui = gui = Gtk.Builder() gui.add_from_file(SHARED_DATA_FILE('gfeedline.glade')) self.window = window = gui.get_object('main_window') self.column = MultiColumnDict(gui) # multi-columns for Notebooks self.theme = Theme() self.font = FontSet() self.notification = StatusNotification(liststore) dnd_list = [ Gtk.TargetEntry.new("text/uri-list", 0, 1), Gtk.TargetEntry.new("text/x-moz-url", 0, 4), ] window.drag_dest_set(Gtk.DestDefaults.ALL, dnd_list, Gdk.DragAction.COPY) target = Gtk.TargetList.new([]) target.add(Gdk.Atom.intern("text/x-moz-url", False), 0, 4) target.add(Gdk.Atom.intern("text/uri-list", False), 0, 1) window.drag_dest_set_target_list(target) window.connect("drag-data-received", self.on_drag_data_received) SETTINGS.connect("changed::window-sticky", self.on_settings_sticky_change) self.on_settings_sticky_change(SETTINGS, 'window-sticky') SETTINGS_VIEW.connect("changed::theme", self.on_settings_theme_change) self.on_settings_theme_change(SETTINGS_VIEW, 'theme') is_multi_column = SETTINGS_VIEW.get_boolean('multi-column') menuitem_multicolumn = gui.get_object('menuitem_multicolumn') menuitem_multicolumn.set_active(is_multi_column) menuitem_update = MenuItemUpdate(gui, liststore) x, y, w, h = self._get_geometry_from_settings() # window.show() # for wrong position when auto-start if x >= 0 and y >= 0: window.move(x, y) window.resize(w, h) window.show() gui.connect_signals(self)
def __init__(self): """ Attributes ---------- metadata: dict presentation metadata; each element of the dictionary if a dict with ['value', 'user'] items: value contains the metadata value and user indicates if the value comes from user (if True) or from defaults (if False). """ self.reset() self.metadata = { 'title': Metadata(name='title', value=''), 'subtitle': Metadata(name='subtitle', value=''), 'authors': Metadata(name='authors', value=[]), 'authors_short': Metadata(name='authors_short', value=[]), 'emails': Metadata(name='emails', value=[]), 'affiliations': Metadata(name='affiliations', value=[]), 'affiliations_short': Metadata(name='affiliations_short', value=[]), 'logo': Metadata(name='logo', value=''), 'timer': Metadata(name='timer', value=''), 'location': Metadata(name='location', value=''), 'location_short': Metadata(name='location_short', value=''), 'date': Metadata(name='date', value=''), 'conference': Metadata(name='conference', value=''), 'conference_short': Metadata(name='conference_short', value=''), 'session': Metadata(name='session', value=''), 'session_short': Metadata(name='session_short', value=''), 'max_time': Metadata(name='max_time', value='25'), 'total_slides_number': Metadata(name='total_slides_number', value=''), 'dirs_to_copy': Metadata(name='dirs_to_copy', value=[]), 'toc': Metadata(name='toc', value=OrderedDict()), 'toc_depth': Metadata(name='toc_depth', value='2'), 'chaptertitle': Metadata(name='chaptertitle', value=''), 'chapternumber': Metadata(name='chapternumber', value=''), 'sectiontitle': Metadata(name='sectiontitle', value=''), 'sectionnumber': Metadata(name='sectionnumber', value=''), 'subsectiontitle': Metadata(name='subsectiontitle', value=''), 'subsectionnumber': Metadata(name='subsectionnumber', value=''), 'slidetitle': Metadata(name='slidetitle', value=''), 'slidenumber': Metadata(name='slidenumber', value=''), 'css_overtheme': Metadata(name='css_overtheme', value=[]), 'custom': Metadata(name='custom-[0-9]*', value='') } self.theme = Theme() self.parser = Parser() self.chapters = [] self.position = Position() return
def __init__(self, filename, Objects=Alpha1): self.Objects = Objects self.actionListeners = [] self.vars = {} self.jlyreader = JLYReader(filename) self.jlyreader.read() self.input = Input(self) self.theme = Theme(self) self.head = Head(self) self.body = Body(self) self.input.build(self.jlyreader.get('In'))
def __init__(self, theme=None, **params): """Create a new application given the (optional) theme instance.""" self.set_global_app() if theme == None: from theme import Theme theme = Theme() self.theme = theme params['decorate'] = 'app' container.Container.__init__(self, **params) self._quit = False self.widget = None self._chsize = False self._repaint = False self.screen = None self.container = None
def __init__(self, number, position=None, title=None, contents=None): """" Paramters --------- number: int slide global numeration position: dict position dictionary containing {'x': posx, 'y': posy, 'z': posz, 'rotx': rotx, 'roty': roty, 'rotz': rotz, 'scale': scaling} title: str contents: str """ self.number = number self.position = None self.set_position(position) self.title = title self.contents = contents self.overtheme = Theme() return
def __init__(self,theme=None,**params): App.app = self if theme == None: from theme import Theme theme = Theme() self.theme = theme params['decorate'] = 'app' container.Container.__init__(self,**params) self._quit = False self.widget = None self._chsize = False self._repaint = False self.screen = None self.container = None self.events = []
def __init__(self, config=None): if not config: config = {} self.config = config.get("qboard", {}) x, y = get_preferred_resolution(self.config) if running_on_rpi(): self.screen, self.screen_dimensions = setup_frame_buffer() else: self.screen, self.screen_dimensions = setup_dev_screen(x, y) self.rects = { "screen": pygame.Rect(0, 0, self.screen_dimensions.width, self.screen_dimensions.height) } self.theme = Theme(self.config.get("theme")) self.blit = self.screen.blit pygame.mouse.set_visible(False) self.clear_screen() self.show_loading() pygame.display.update() self.tasks = [] self.modules = {} for module_config in config["modules"]: module_name = module_config["name"] module_id = module_config["id"] logger.info(f"Loading module {module_name} for id {module_id}") module_class = modules[module_config["name"]] module_instance = module_class(module_config, self) self.modules[module_config["id"]] = module_instance if module_config.get("run_every"): count, time_scale = module_config["run_every"].split(" ") count = int(count) getattr(schedule.every(count), time_scale).do(module_instance.prepare) if self.debug: from debug import Debug self.modules["debug"] = Debug(self.config, self)
def post_theme(): order = request.json['message'] try: theme = Theme(order).get() except: abort(404) except: result = { "result": True, "data": { "keywords": theme.keywords, "opinions": theme.opinions } } return make_response(jsonify(result)) @app.route('/opinion', methods=['POST']) def post_opinion(): keywords = request.json['keywords'] opinion = request.json['opinion'] try: op = Opinion(keywords, opinion).get() except: abort(404) result = { "result": True, "data": { "posOpinions": op.positives, "negOpinions": op.negatives } } return make_response(jsonify(result)) @app.errorhandler(404) def not_found(error): return make_response(jsonify({'error': 'Not found'}), 404) if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)
def read_config(self, path): """parse alot's config file from path""" spec = os.path.join(DEFAULTSPATH, 'alot.rc.spec') newconfig = read_config(path, spec, checks={ 'mail_container': mail_container, 'force_list': force_list, 'gpg_key_hint': gpg_key }) self._config.merge(newconfig) hooks_path = os.path.expanduser(self._config.get('hooksfile')) try: self.hooks = imp.load_source('hooks', hooks_path) except: logging.debug('unable to load hooks file:%s' % hooks_path) if 'bindings' in newconfig: newbindings = newconfig['bindings'] if isinstance(newbindings, Section): self._bindings.merge(newbindings) # themes themestring = newconfig['theme'] themes_dir = self._config.get('themes_dir') if themes_dir: themes_dir = os.path.expanduser(themes_dir) else: themes_dir = os.path.join( os.environ.get('XDG_CONFIG_HOME', os.path.expanduser('~/.config')), 'alot', 'themes') logging.debug(themes_dir) if themestring: if not os.path.isdir(themes_dir): err_msg = 'cannot find theme %s: themes_dir %s is missing' raise ConfigError(err_msg % (themestring, themes_dir)) else: theme_path = os.path.join(themes_dir, themestring) self._theme = Theme(theme_path) self._accounts = self._parse_accounts(self._config) self._accountmap = self._account_table(self._accounts)
def __init__(self, alot_rc=None, notmuch_rc=None, theme=None): """ :param alot_rc: path to alot's config file :type alot_rc: str :param notmuch_rc: path to notmuch's config file :type notmuch_rc: str :theme: path to initially used theme file :type theme: str """ self.hooks = None self._mailcaps = mailcap.getcaps() theme_path = theme or os.path.join(DEFAULTSPATH, 'default.theme') self._theme = Theme(theme_path) self._bindings = ConfigObj() self._config = ConfigObj() self._accounts = None self._accountmap = None self.read_config(alot_rc) self.read_notmuch_config(notmuch_rc)
def Draw(self, nrb=None \ , MeshColor=None \ , NurbsColor=None \ , PointsColor=None \ , alpha=ALPHA \ , blend=False): if NurbsColor is None: if self.NurbsColor is None: NurbsColor = list( asarray(Theme().color_viewer('default_patch')).copy()) else: NurbsColor = list(asarray(self.NurbsColor).copy()) if self.show: if nrb is not None: list_nrb = [nrb] else: list_nrb = self._list for i in range(0, len(list_nrb)): nrb = list_nrb[i] nrbInfo = self.list_patchInfo[i] if nrbInfo.show: _NurbsColor = asarray(NurbsColor).copy() if nrbInfo.NurbsColor is not None: _NurbsColor = asarray(nrbInfo.NurbsColor).copy() NurbsSteps = nrbInfo.steps evaluator = self.GetEvaluator(nrb \ , MeshColor=MeshColor \ , NurbsColor=_NurbsColor \ , alpha=alpha\ , steps=NurbsSteps) showMesh = self.showMesh or nrbInfo.showMesh evaluator.draw(mesh=showMesh, nurbs=True, blend=blend) if self.showPoints or nrbInfo.showPoints: # Draw control points self.DrawControlPoints(nrb \ , PointsColor=PointsColor \ ,alpha=alpha, blend=blend)
def make_widgets(self, bcolor, rcolor): self.pack() self.theme = Theme(self, bcolor=bcolor, rcolor=rcolor) self.theme.pack(side=TOP) self.game_type = BooleanVar( ) # what type of game: solo - with computer or with someone self.rb_solo = Radiobutton(self, text='SOLO', variable=self.game_type, value=True) self.rb_solo.pack(side=LEFT) self.rb_with_some = Radiobutton(self, text='WITH SOMEONE', variable=self.game_type, value=False) self.rb_with_some.pack(side=LEFT) self.start = Button(self, text='Start', command=self.start_action) self.start.pack(side=TOP)
# any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # This module *just* use for test module under dtk.ui from skin_config import skin_config from theme import Theme, ui_theme from deepin_utils.file import get_parent_dir import os # Init skin config. skin_config.init_skin( "01", os.path.join(get_parent_dir(__file__, 3), "skin"), os.path.expanduser("~/.config/deepin-demo/skin"), os.path.expanduser("~/.config/deepin-demo/skin_config.ini"), "deepin-media-player", "1.0") # Create application theme. app_theme = Theme(os.path.join(get_parent_dir(__file__, 3), "app_theme"), os.path.expanduser("~/.config/deepin-demo/theme")) # Set theme. skin_config.load_themes(ui_theme, app_theme)
def parse(self, config, source): """Parse presentation from source stream. Parameters ---------- config : MatisseConfig MaTiSSe configuration source: str """ complete_source = self.parser.includes(source=source) self.__get_metadata(source=complete_source) self.__get_theme(source=complete_source) new_theme = Theme() new_theme.set_from(other=self.theme) tokens = self.parser.tokenize(source=complete_source) self.__check_bad_sectioning(tokens=tokens) chapters_number = 0 sections_number = 0 subsections_number = 0 slides_number = 0 titlepage_inserted = False for chap in tokens['chapters']: chapters_number += 1 slide_local_numbers = [0, 0, 0] if chap['match'].group('expr'): chapter = Chapter(number=chapters_number, title=chap['match'].group('expr')) else: chapter = Chapter(number=chapters_number, title='') for sec in tokens['sections']: if sec['start'] >= chap['start'] and sec['start'] <= chap[ 'end_next']: sections_number += 1 slide_local_numbers[1] = 0 slide_local_numbers[2] = 0 section = Section(number=sections_number, title=sec['match'].group('expr')) for subsec in tokens['subsections']: if subsec['start'] >= sec['start'] and subsec[ 'start'] <= sec['end_next']: subsections_number += 1 slide_local_numbers[2] = 0 subsection = Subsection( number=subsections_number, title=subsec['match'].group('expr')) for sld in tokens['slides']: if '$titlepage' in sld['match'].group().lower( ) and not titlepage_inserted: slide = Slide( number=0, title='titlepage', contents=complete_source[ sld['end']:sld['end_next']]) slide.get_overtheme(parser=self.parser) if slide.overtheme.copy_from_theme is not None and slide.overtheme.copy_from_theme: slide.overtheme.copy_from( other=self.theme) self.position.update_position( presentation_theme=self.theme, overtheme=slide.overtheme) slide.set_position( position=self.position.position) subsection.add_slide(slide=slide) titlepage_inserted = True else: if sld['start'] >= subsec['start'] and sld[ 'start'] <= subsec['end_next']: slide_local_numbers[0] += 1 slide_local_numbers[1] += 1 slide_local_numbers[2] += 1 if slide_local_numbers[ 0] == 1 and config.toc_at_chap_beginning is not None: slides_number += 1 self.position.update_position( presentation_theme=self.theme) subsection.add_slide(slide=Slide( number=slides_number, position=self.position. position, title='Table of Contents', contents='$toc[depth:' + str(config. toc_at_chap_beginning) + ']')) if slide_local_numbers[ 1] == 1 and config.toc_at_sec_beginning is not None: slides_number += 1 self.position.update_position( presentation_theme=self.theme) subsection.add_slide(slide=Slide( number=slides_number, position=self.position. position, title='Table of Contents', contents='$toc[depth:' + str(config.toc_at_sec_beginning ) + ']')) if slide_local_numbers[ 2] == 1 and config.toc_at_subsec_beginning is not None: slides_number += 1 self.position.update_position( presentation_theme=self.theme) subsection.add_slide(slide=Slide( number=slides_number, position=self.position. position, title='Table of Contents', contents='$toc[depth:' + str(config. toc_at_subsec_beginning) + ']')) slides_number += 1 slide = Slide( number=slides_number, title=sld['match'].group('expr'), contents=complete_source[ sld['end']:sld['end_next']]) slide.get_overtheme(parser=self.parser) if slide.overtheme.copy_from_theme is not None and slide.overtheme.copy_from_theme: slide.overtheme.copy_from( other=self.theme) self.position.update_position( presentation_theme=self.theme, overtheme=slide.overtheme) slide.set_position( position=self.position.position) subsection.add_slide(slide=slide) section.add_subsection(subsection=subsection) chapter.add_section(section=section) self.__add_chapter(chapter=chapter) self.metadata['total_slides_number'].update_value( value=str(Subsection.slides_number))
# -*- coding: UTF-8 -*- import OpenGL from OpenGL import GLU from OpenGL import GL from OpenGL.GL import * from OpenGL.GLU import * from MenuCAIDViewer import MenuCAIDViewer import numpy as np from numpy import sin, pi, cos from theme import theme as Theme theme = Theme() ALPHA = theme.alpha BETA = theme.beta class GLEvaluator(): def __init__(self, nrb): self.nrb = nrb self.glID = gluNewNurbsRenderer() def __del__(self): gluDeleteNurbsRenderer(self.glID) def draw(self): pass
def _write_theme_file(self): # Write the theme xml file. theme = Theme() theme._set_xml_writer(self._filename('xl/theme/theme1.xml')) theme._assemble_xml_file()
Clock.schedule_once(lambda *__: Factory.UpdateRestartPopup().open(), 0) def _restart_for_update(self): # Dismiss popup and run update utility if hasattr(self, 'update_notif'): self.update_notif.dismiss() self.update_client.run_util() self.stop() def open_settings(self): self.root.goto_page(3) Logger.info('Reading theme..') theme = Theme(name=Config.get('theme', 'default')) if __name__ == '__main__': Logger.info(f'System = {platform.system()}') Logger.info(f'Release = {platform.release()}') Window.clearcolor = theme.dark app = XtremeUpdaterApp() # set attributes required by the .kv file app.Config = Config app.version = __version__ app.theme = theme app.as_admin = IS_ADMIN
def __init__(self): self.LV_HOR_RES = lv.scr_act().get_disp().driver.hor_res self.LV_VER_RES = lv.scr_act().get_disp().driver.ver_res # Bg positions self.LV_DEMO_PRINTER_BG_NONE = -self.LV_VER_RES self.LV_DEMO_PRINTER_BG_FULL = 0 self.LV_DEMO_PRINTER_BG_NORMAL = -2 * (self.LV_VER_RES // 3) self.LV_DEMO_PRINTER_BG_SMALL = -5 * (self.LV_VER_RES // 6) # Animations self.LV_DEMO_PRINTER_ANIM_Y = self.LV_VER_RES // 20 self.LV_DEMO_PRINTER_ANIM_DELAY = 40 self.LV_DEMO_PRINTER_ANIM_TIME = 150 self.LV_DEMO_PRINTER_ANIM_TIME_BG = 300 self.LV_DEMO_PRINTER_BG_NORMAL = (-2 * (self.LV_VER_RES // 3)) self.log = logging.getLogger("DemoPrinter") self.log.setLevel(logging.ERROR) self.icon_wifi_data = None self.icon_wifi_dsc = None self.icon_tel_data = None self.icon_tel_dsc = None self.icon_eco_data = None self.icon_eco_dsc = None self.icon_pc_data = None self.icon_pc_dsc = None self.img_btn_bg_1_data = None self.img_btn_bg_1_dsc = None self.img_btn_bg_2_data = None self.img_btn_bg_2_dsc = None self.img_btn_bg_3_data = None self.img_btn_bg_3_dsc = None self.img_btn_bg_4_data = None self.img_btn_bg_4_dsc = None self.img_copy_data = None self.img_copy_dsc = None self.img_print_data = None self.img_print_dsc = None self.img_scan_data = None self.img_scan_dsc = None self.img_setup_data = None self.img_setup_dsc = None self.scan_img = None self.bg_top = None self.bg_bottom = None self.bg_color_prev = LV_DEMO_PRINTER_BLUE self.bg_color_act = LV_DEMO_PRINTER_BLUE self.bg_top = lv.obj(lv.scr_act(), None) self.bg_top.set_size(self.LV_HOR_RES, self.LV_VER_RES) # read all the images fromm the raw image files (self.icon_wifi_data, self.icon_wifi_dsc) = self.get_icon("icon_wifi_48x34", 48, 34) (self.icon_tel_data, self.icon_tel_dsc) = self.get_icon("icon_tel_35x35", 35, 35) (self.icon_eco_data, self.icon_eco_dsc) = self.get_icon("icon_eco_38x34", 38, 34) (self.icon_pc_data, self.icon_pc_dsc) = self.get_icon("icon_pc_41x33", 41, 33) (self.icon_bright_data, self.icon_bright_dsc) = self.get_icon("icon_bright_29x29", 29, 29) (self.icon_hue_data, self.icon_hue_dsc) = self.get_icon("icon_hue_23x23", 23, 23) (self.img_btn_bg_1_data, self.img_btn_bg_1_dsc) = self.get_icon("img_btn_bg_1_174x215", 174, 215) (self.img_btn_bg_2_data, self.img_btn_bg_2_dsc) = self.get_icon("img_btn_bg_2_174x215", 174, 215) (self.img_btn_bg_3_data, self.img_btn_bg_3_dsc) = self.get_icon("img_btn_bg_3_174x215", 174, 215) (self.img_btn_bg_4_data, self.img_btn_bg_4_dsc) = self.get_icon("img_btn_bg_4_174x215", 174, 215) (self.img_copy_data, self.img_copy_dsc) = self.get_icon("img_copy_51x60", 51, 60) (self.img_print_data, self.img_print_dsc) = self.get_icon("img_print_65x64", 65, 64) (self.img_scan_data, self.img_scan_dsc) = self.get_icon("img_scan_51x61", 51, 61) (self.img_setup_data, self.img_setup_dsc) = self.get_icon("img_setup_63x64", 63, 64) (self.img_usb_data, self.img_usb_dsc) = self.get_icon("img_usb_62x61", 62, 61) (self.img_internet_data, self.img_internet_dsc) = self.get_icon("img_internet_65x64", 65, 64) (self.img_mobile_data, self.img_mobile_dsc) = self.get_icon("img_mobile_50x60", 50, 60) (self.img_wave_data, self.img_wave_dsc) = self.get_icon("img_wave_27x47", 27, 47) (self.img_phone_data, self.img_phone_dsc) = self.get_icon("img_phone_77x99", 77, 99) (self.img_ready, self.img_ready_dsc) = self.get_icon("img_ready_158x158", 158, 158) (self.img_printer2_data, self.img_printer2_dsc) = self.get_icon("img_printer2_107x104", 107, 104) (self.img_no_internet_data, self.img_no_internet_dsc) = self.get_icon("img_no_internet_42x42", 42, 42) (self.img_cloud_data, self.img_cloud_dsc) = self.get_icon("img_cloud_93x59", 93, 59) (self.scan_example_data, self.scan_example_dsc) = self.get_icon("scan_example_522x340", 522, 340) self.theme = Theme() self.home_open(0)
from PyQt5.QtWebEngineWidgets import QWebEngineView from ui.settings import Settings from ui.about import About from ui.notes_project import CreateNotesProject from config import Config from utils import basedir from theme import Theme from components.editor import CodeEditor from components.HTMLPreview import HTMLPreview from components.markdown_preview import MarkdownPreview from components.note_graph import NotesGraph from components.statusbar import Statusbar app = QApplication(sys.argv) config = Config(os.path.expanduser('~/.kettle/'), 'config.ini') themes = Theme(app, config) class Kettle(QMainWindow): def __init__(self): super().__init__() self.init_ui() self.filename = "untitled" def save_file(self): name = self.filename if not self.filename or self.filename == "untitled": name = QFileDialog.getSaveFileName(self, 'Save File')[0] file = open(name, 'wt') save_text = self.current_editor.toPlainText() file.write(save_text)