コード例 #1
0
 def __init__(self):
     # Set up all the logging
     self.logger = logging.getLogger('TweGeT')
     logging.basicConfig(
         level=logging.DEBUG,
         format=u'%(asctime)s - %(levelname)s - %(message)s',
         datefmt='%Y-%m-%d %H:%M:%S')
     handler = logging.StreamHandler(sys.stderr)
     handler.setLevel(logging.CRITICAL)
     formatter = logging.Formatter(
         u'%(asctime)s - %(levelname)s - %(message)s',
         datefmt='%Y-%m-%d %H:%M:%S')
     fhandler = logging.FileHandler("twet.log", 'w', 'utf-8')
     fhandler.setFormatter(formatter)
     handler.setFormatter(formatter)
     self.logger.addHandler(handler)
     self.logger.addHandler(fhandler)
     self.log_queue = Queue()
     self.queue_handler = QueueHandler(self.log_queue)
     self.logger.addHandler(self.queue_handler)
     self.settings_manager = SettingsManager()
     if self.system_type == WINDOWS:
         self.which_command = "where"
         self.shell = True
         self.cmd_extension = self.WINDOWS_CMD_EXT
     if self.system_type == DARWIN:
         self.icon_type = ("Iconset", "*.icns")
コード例 #2
0
 def save_ui_info(self):
     settings = SettingsManager(CONFIG_FILE)
     settings.save(self.ui.root_dir_edit)
     settings.save(self.ui.title_edit)
     settings.save(self.ui.description_edit)
     settings.save(self.ui.command_option_edit)
     settings.save(self.ui.can_device_edit)
     settings.save(self.ui.candump_checkbox)
コード例 #3
0
    def __init__(self):
        QtCore.QObject.__init__(self)
        self.comic = None
        self.settings_manager = SettingsManager()
        self.rotate_angle = 0
        self.scroll_area_size = None
        self.fit_type = self.load_view_adjust(MainWindowModel._ORIGINAL_FIT)
        self.current_directory = self.load_current_directory()

        ext_list = ["*.cbr", "*.cbz", "*.rar", "*.zip", "*.tar", "*.cbt"]
        self.path_file_filter = PathFileFilter(ext_list)
コード例 #4
0
    def test_get_config(self):
        with tempfile.TemporaryDirectory() as dname:
            print(dname)  # /tmp/tmpl2cvqpq5
            test_yaml = os.path.join(dname, "test.yaml")
            with open(test_yaml, "w") as f:
                yaml.dump(self.sample_config(), f)

                conf = SettingsManager()
                conf.load(test_yaml)
                assert conf.input_file_path == 'input'
                assert conf.template_file_path == 'template'
                assert conf.save_directory == 'save'
                assert conf.save_file_name == 'file'
コード例 #5
0
    def load_ui_info(self):
        settings = SettingsManager(CONFIG_FILE)
        settings.load(self.ui.root_dir_edit)
        settings.load(self.ui.title_edit)
        settings.load(self.ui.description_edit)
        settings.load(self.ui.command_option_edit)
        settings.load(self.ui.can_device_edit)
        settings.load(self.ui.candump_checkbox)

        # Set default value
        if self.ui.can_device_edit.text() == '':
            self.ui.can_device_edit.setText('can0')

        self.ui.candump_checkbox.setEnabled(self.found_candump)
コード例 #6
0
ファイル: tv_main_window.py プロジェクト: NPS-DEEP/tv_sim
    def __init__(self, signal_want_tv_window=None):
        super(TVMainWindow, self).__init__()

        # use this when embedded in tv_browser
        if signal_want_tv_window:
            signal_want_tv_window.connect(self.show_window)

        # user's preferred TV file path
        self.preferred_tv_dir = os.path.expanduser("~")

        # user's preferred JPG graph path
        self.preferred_graph_dir = os.path.expanduser("~")

        # settings manager
        self.settings_manager = SettingsManager()

        # data manager
        self.tv_data_manager = TVDataManager(
            settings, self.settings_manager.signal_settings_changed)

        # scale manager
        self.tv_scale_manager = TVScaleManager()

        # main window
        self.w = QMainWindow()

        # main window decoration
        self.w.setGeometry(0, 0, 950, 900)
        self.w.setWindowTitle("Texture Vector Similarity Version %s" % VERSION)
        self.w.setWindowIcon(QIcon(window_icon))

        # the graph main widget
        self.tv_graph_widget = TVGraphWidget(
            self.tv_data_manager.signal_data_loaded,
            self.tv_scale_manager.signal_tv_scale_changed)

        # the graph
        self.w.setCentralWidget(self.tv_graph_widget.view)

        # actions
        self.define_actions()

        # sketch checkbox
        self.tv_sketch_cb = TVSketchCB(self.tv_data_manager)

        # toolbar
        self.add_toolbar()
コード例 #7
0
ファイル: settings_init.py プロジェクト: wwdesmidt/TABLE
def initialize_settings():
    #create instance of settings manager
    settings = SettingsManager("settings.json")

    #initialize settings

    #debug
    settings.add_setting("debug", "Display extra debuging output on screen?",
                         "False", ("True", "False"))

    #orientation
    orientation_setting_description = "This flips the map and the tokens so they are facing players\n"
    orientation_setting_description += "that are sitting across from the dm.\n"
    orientation_setting_description += "It also displays messages on all 4 sides of the screen facing outward,\n"
    orientation_setting_description += "instead of just one at the bottom."
    settings.add_setting("table_top_orientation",
                         orientation_setting_description, "False",
                         ("True", "False"))

    #return the settings manager
    return settings
コード例 #8
0
ファイル: main.py プロジェクト: it-walker/pdf_rotate
def main():
    config_file_path = os.path.join(os.path.dirname(sys.argv[0]), "config.yaml")
    conf = SettingsManager()
    conf.load(config_file_path)

    target = open(conf.target_file_path, "rb")
    reader = PyPDF2.PdfFileReader(target)
    writer = PyPDF2.PdfFileWriter()

    print("対象PDF:{0}".format(conf.target_file_path))
    print("出力ファイルパス:{0}".format(conf.out_file_path))
    print("回転角度:{0}度".format(conf.rotate))
    for page in range(reader.numPages):
        obj = reader.getPage(page)
        obj.rotateClockwise(conf.rotate)  # 回転させる
        writer.addPage(obj)

    outfile = open(conf.out_file_path, "wb")
    writer.write(outfile)
    outfile.close()
    target.close()
コード例 #9
0
ファイル: bookmark.py プロジェクト: mwergles/pynocchio
def get_settings_path():
    path = Utility.get_dir_name(SettingsManager().settings.fileName())
    return path + u'/bookmark.db'
コード例 #10
0
from settings_manager import SettingsManager, SettingsManagerFrame
import tkinter as tk
from tkinter import ttk

s = SettingsManager("settings.json")

s.add_setting("debug",
              "should the application produce extra debugging output?",
              "False", ("True", "False"))
s.add_setting("width", "width? i dont know how to do ranges", "640",
              ("range", "100", "1000"))
s.add_setting("height", "description for height", "480",
              ("range", "100", "1000"))
s.add_setting("test", "a test setting.\nthis description has a new line in it",
              "abc", ("abc", "123", "456", "789"))
s.add_setting(
    "test2",
    "just adding another setting\nto see if adding a new one works after\neverythuing is in place",
    "abc", ("abc", "123", "456", "789"))

#s.print_test()

root = tk.Tk()

frame = SettingsManagerFrame(root, s)

frame.pack()

root.mainloop()
コード例 #11
0
def main():
    config_file_path = os.path.join(os.path.dirname(__file__), 'config.yaml')
    conf = SettingsManager()
    conf.load(config_file_path)
    report_instance = ReportInsured(conf)
    report_instance.generate()
コード例 #12
0
ファイル: the_bot.py プロジェクト: ayushashi11/balak
import asyncio
from os import name
import discord
from discord.activity import Activity
from discord.embeds import Embed
from discord.enums import ActivityType
from discord.permissions import Permissions
from typing import Deque, Union, Tuple
from dotenv import load_dotenv
from collections import deque
from settings_manager import SettingsManager
load_dotenv()
TOKEN=os.getenv("TOKEN")
client = discord.Client()
o = True
sm = SettingsManager()
str_or_None = Union[str, None]
lis: Deque[Tuple[str_or_None, str_or_None]] = deque([(None,None)]*100, maxlen=100)


def get_role(guild, name) -> discord.Role:
    tc = discord.utils.find(lambda g: g.name==name, guild.roles)
    return tc

def get_channel(guild, id):
    tc = discord.utils.find(lambda g: g.id==id, guild.channels)
    return tc

@client.event
async def on_ready():
    print("-\n".join(x.name for x in client.guilds))
コード例 #13
0
 def save_ui_info(self):
     settings = SettingsManager(CONFIG_FILE)
     settings.save(self.ui.save_path_edit)
コード例 #14
0
 def save_ui_info(self):
     settings = SettingsManager(CONFIG_FILE)
     settings.save(self.ui.load_path_edit)
     settings.save(self.ui.override_velocity_edit)