當前位置: 首頁>>代碼示例>>Python>>正文


Python Config.set方法代碼示例

本文整理匯總了Python中kivy.config.Config.set方法的典型用法代碼示例。如果您正苦於以下問題:Python Config.set方法的具體用法?Python Config.set怎麽用?Python Config.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在kivy.config.Config的用法示例。


在下文中一共展示了Config.set方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: album_save

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def album_save(self, album):
        """Saves an album data file.
        Argument:
            album: Dictionary containing album information:
                file: String, filename of the album (with extension)
                name: String, name of the album.
                description: String, description of the album.
                photos: List of Strings, each is a database-relative filepath to a photo in the album.
        """

        configfile = ConfigParser(interpolation=None)
        filename = os.path.join(self.album_directory, album['file'])
        configfile.add_section('info')
        configfile.set('info', 'name', album['name'])
        configfile.set('info', 'description', album['description'])
        configfile.add_section('photos')
        for index, photo in enumerate(album['photos']):
            configfile.set('photos', str(index), agnostic_path(photo))
        with open(filename, 'w') as config:
            configfile.write(config) 
開發者ID:snuq,項目名稱:Snu-Photo-Manager,代碼行數:22,代碼來源:main.py

示例2: database_thumbnail_get

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def database_thumbnail_get(self, fullpath, temporary=False):
        """Gets a thumbnail image from the thumbnails database.
        Arguments:
            fullpath: String, the database-relative path of the photo to get the thumbnail of.
            temporary: Boolean, set to True to get a thumbnail from the temporary thumbnail database.
        Returns: List containing thumbnail information and data, or None if not found.
        """

        fullpath = agnostic_path(fullpath)
        if temporary:
            thumbnail = self.tempthumbnails.select('SELECT * FROM thumbnails WHERE FullPath = ?', (fullpath,))
        else:
            thumbnail = self.thumbnails.select('SELECT * FROM thumbnails WHERE FullPath = ?', (fullpath,))
        thumbnail = list(thumbnail)
        if thumbnail:
            thumbnail = local_thumbnail(list(thumbnail[0]))
        return thumbnail 
開發者ID:snuq,項目名稱:Snu-Photo-Manager,代碼行數:19,代碼來源:main.py

示例3: get_database_directories

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def get_database_directories(self, real=False):
        """Gets the current database directories.
        Returns: List of Strings of the paths to each database.
        """

        if not real and (self.standalone and not self.standalone_in_database):
            #if real is not passed in, and a standalone database is set, use that
            return [self.standalone_database]
        else:
            directories = self.config.get('Database Directories', 'paths')
            directories = local_path(directories)
            if directories:
                databases = directories.split(';')
            else:
                databases = []
            databases_cleaned = []
            for database in databases:
                if database:
                    databases_cleaned.append(database)
            return databases_cleaned 
開發者ID:snuq,項目名稱:Snu-Photo-Manager,代碼行數:22,代碼來源:main.py

示例4: apply_device

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def apply_device(device, scale, orientation):
    name, width, height, dpi, density = devices[device]
    if orientation == 'portrait':
        width, height = height, width
    Logger.info('Screen: Apply screen settings for {0}'.format(name))
    Logger.info('Screen: size={0}x{1} dpi={2} density={3} '
                'orientation={4}'.format(width, height, dpi, density,
                                         orientation))
    try:
        scale = float(scale)
    except:
        scale = 1
    environ['KIVY_METRICS_DENSITY'] = str(density * scale)
    environ['KIVY_DPI'] = str(dpi * scale)
    Config.set('graphics', 'width', str(int(width * scale)))
    # simulate with the android bar
    # FIXME should be configurable
    Config.set('graphics', 'height', str(int(height * scale - 25 * density)))
    Config.set('graphics', 'fullscreen', '0')
    Config.set('graphics', 'show_mousecursor', '1') 
開發者ID:BillBillBillBill,項目名稱:Tickeys-linux,代碼行數:22,代碼來源:screen.py

示例5: write_config

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def write_config(self):
        if not Config.has_section(default_section):
            Config.add_section(default_section)
        Config.set(default_section, 'user', self.user)
        Config.set(default_section, 'password', crypto.encode_password(self.password))
        Config.set(default_section, 'ip', self.ip)
        Config.write() 
開發者ID:littlejo,項目名稱:huawei-lte-examples,代碼行數:9,代碼來源:main.py

示例6: build

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def build(self):
        self.icon = 'data/icon/segreto_icon.png' # Don't know why icon isn't set :(
        self.title = 'Segreto 3'
        self.init()
        return self.screenmanager 
開發者ID:anselm94,項目名稱:segreto-3,代碼行數:7,代碼來源:app.py

示例7: __init__

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def __init__(self, **kwargs):
        super(AboutView, self).__init__(**kwargs)

# ==========================================
# Tie everything together and launch the app
# ==========================================


# everything works! set LED strip to initial state 
開發者ID:tlkh,項目名稱:SmartBin,代碼行數:11,代碼來源:SmartBinApp.py

示例8: message

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def message(self, text, timeout=20):
        """Sets the app.infotext variable to a specific message, and clears it after a set amount of time."""

        self.infotext = text
        if self.infotext_setter:
            self.infotext_setter.cancel()
        self.infotext_setter = Clock.schedule_once(self.clear_message, timeout) 
開發者ID:snuq,項目名稱:Snu-Photo-Manager,代碼行數:9,代碼來源:main.py

示例9: toggle_quicktransfer

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def toggle_quicktransfer(self, button):
        if self.config.get("Settings", "quicktransfer") == '0':
            self.config.set("Settings", "quicktransfer", '1')
            button.state = 'normal'
        else:
            self.config.set("Settings", "quicktransfer", '0')
            button.state = 'down' 
開發者ID:snuq,項目名稱:Snu-Photo-Manager,代碼行數:9,代碼來源:main.py

示例10: program_export

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def program_export(self):
        """Save current external program presets to the config file."""

        configfile = ConfigParser(interpolation=None)
        for index, preset in enumerate(self.programs):
            name, command, argument = preset
            section = str(index)
            configfile.add_section(section)
            configfile.set(section, 'name', name)
            configfile.set(section, 'command', command)
            configfile.set(section, 'argument', argument)
        with open(self.data_directory+os.path.sep+'programs.ini', 'w') as config:
            configfile.write(config) 
開發者ID:snuq,項目名稱:Snu-Photo-Manager,代碼行數:15,代碼來源:main.py

示例11: update_photoinfo

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def update_photoinfo(self, folders=list()):
        """Updates the photoinfo files in given folders.
        Arguments:
            folders: List containing Strings for database-relative paths to each folder.
        """

        if self.config.get("Settings", "photoinfo"):
            databases = self.get_database_directories()
            folders = list(set(folders))
            for folder in folders:
                for database in databases:
                    full_path = os.path.join(database, folder)
                    if os.path.isdir(full_path):
                        self.save_photoinfo(target=folder, save_location=full_path) 
開發者ID:snuq,項目名稱:Snu-Photo-Manager,代碼行數:16,代碼來源:main.py

示例12: export_preset_write

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def export_preset_write(self):
        """Saves all export presets to the config file."""

        configfile = ConfigParser(interpolation=None)
        for index, preset in enumerate(self.exports):
            section = str(index)
            configfile.add_section(section)
            configfile.set(section, 'name', preset['name'])
            configfile.set(section, 'export', preset['export'])
            configfile.set(section, 'ftp_address', preset['ftp_address'])
            configfile.set(section, 'ftp_user', preset['ftp_user'])
            configfile.set(section, 'ftp_password', preset['ftp_password'])
            configfile.set(section, 'ftp_passive', str(preset['ftp_passive']))
            configfile.set(section, 'ftp_port', str(preset['ftp_port']))
            configfile.set(section, 'export_folder', agnostic_path(preset['export_folder']))
            configfile.set(section, 'create_subfolder', str(preset['create_subfolder']))
            configfile.set(section, 'export_info', str(preset['export_info']))
            configfile.set(section, 'scale_image', str(preset['scale_image']))
            configfile.set(section, 'scale_size', str(preset['scale_size']))
            configfile.set(section, 'scale_size_to', preset['scale_size_to'])
            configfile.set(section, 'jpeg_quality', str(preset['jpeg_quality']))
            configfile.set(section, 'watermark', str(preset['watermark']))
            configfile.set(section, 'watermark_image', agnostic_path(preset['watermark_image']))
            configfile.set(section, 'watermark_opacity', str(preset['watermark_opacity']))
            configfile.set(section, 'watermark_horizontal', str(preset['watermark_horizontal']))
            configfile.set(section, 'watermark_vertical', str(preset['watermark_vertical']))
            configfile.set(section, 'watermark_size', str(preset['watermark_size']))
            configfile.set(section, 'ignore_tags', '|'.join(preset['ignore_tags']))
            configfile.set(section, 'export_videos', str(preset['export_videos']))

        with open(self.data_directory+os.path.sep+'exports.ini', 'w') as config:
            configfile.write(config) 
開發者ID:snuq,項目名稱:Snu-Photo-Manager,代碼行數:34,代碼來源:main.py

示例13: save_encoding_preset

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def save_encoding_preset(self):
        self.config.set("Presets", "selected_preset", self.selected_encoder_preset) 
開發者ID:snuq,項目名稱:Snu-Photo-Manager,代碼行數:4,代碼來源:main.py

示例14: edit_scale_image

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def edit_scale_image(self, imagedata, scale_size, scale_size_to):
        """Scales an image based on a side length while maintaining aspect ratio.

        imagedata - the image to apply the scaling to, a PIL image object
        scale_size - the target edge length in pixels
        scale_size_to - scaling mode, set to one of ('width', 'height', 'short', 'long')
            width - scales the image so the width matches scale_size
            height - scales the image so the height matches scale_size
            short - scales the image so the shorter side matches scale_size
            long - scales the image so the longer side matches scale_size

        Returns a PIL image object
        """

        original_size = imagedata.size
        ratio = original_size[0]/original_size[1]
        if scale_size_to == 'width':
            new_size = (scale_size, int(round(scale_size/ratio)))
        elif scale_size_to == 'height':
            new_size = (int(round(scale_size*ratio)), scale_size)
        elif scale_size_to == 'short':
            if original_size[0] > original_size[1]:
                new_size = (int(round(scale_size*ratio)), scale_size)
            else:
                new_size = (scale_size, int(round(scale_size/ratio)))
        else:
            if original_size[0] > original_size[1]:
                new_size = (scale_size, int(round(scale_size/ratio)))
            else:
                new_size = (int(round(scale_size*ratio)), scale_size)
        return imagedata.resize(new_size, 3) 
開發者ID:snuq,項目名稱:Snu-Photo-Manager,代碼行數:33,代碼來源:main.py

示例15: _update

# 需要導入模塊: from kivy.config import Config [as 別名]
# 或者: from kivy.config.Config import set [as 別名]
def _update(self, dispatch_fn, value):
        oscpath, args, types = value
        command = args[0]

        # verify commands
        if command not in ['alive', 'set']:
            return

        # move or create a new touch
        if command == 'set':
            id = args[1]
            if id not in self.touches[oscpath]:
                # new touch
                touch = TuioMotionEventProvider.__handlers__[oscpath](
                    self.device, id, args[2:])
                self.touches[oscpath][id] = touch
                dispatch_fn('begin', touch)
            else:
                # update a current touch
                touch = self.touches[oscpath][id]
                touch.move(args[2:])
                dispatch_fn('update', touch)

        # alive event, check for deleted touch
        if command == 'alive':
            alives = args[1:]
            to_delete = []
            for id in self.touches[oscpath]:
                if not id in alives:
                    # touch up
                    touch = self.touches[oscpath][id]
                    if not touch in to_delete:
                        to_delete.append(touch)

            for touch in to_delete:
                dispatch_fn('end', touch)
                del self.touches[oscpath][touch.id] 
開發者ID:BillBillBillBill,項目名稱:Tickeys-linux,代碼行數:39,代碼來源:tuio.py


注:本文中的kivy.config.Config.set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。