def __init__(self, collectionfile, songdb):
        super(Loading, self).__init__()
        self.log = logging.getLogger(__name__)

        self.ui = gui.loading.Ui_LoadingDialog()
        self.ui.setupUi(self)

        self.setModal(True)
        self.setFixedSize(self.width(), self.height())
        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint | QtCore.Qt.CustomizeWindowHint)

        self.collections = None
        self.songs = None
        self.collection_file = collectionfile
        self.song_db = songdb
        self.db_is_directory = os.path.isdir(self.song_db)

        self.log.debug("Loading songdb {}{} and collectiondb {}".format(self.song_db, " (dir)" if self.db_is_directory else "", self.collection_file))

        self.progress.connect(self.update_precentage)
        self.current.connect(self.update_current)
        self.text.connect(self.update_text)
        self.done.connect(self.dismiss)

        self.ui.progressbar.setRange(0, 100)

        self.thread = QtCore.QThread()
Example #2
0
    def __init__(self, collectionfile, songdb):
        super(Loading, self).__init__()
        self.log = logging.getLogger(__name__)

        self.ui = gui.loading.Ui_LoadingDialog()
        self.ui.setupUi(self)

        self.setModal(True)
        self.setFixedSize(self.width(), self.height())
        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.CustomizeWindowHint)

        self.collections = None
        self.songs = None
        self.collection_file = collectionfile
        self.song_db = songdb
        self.db_is_directory = os.path.isdir(self.song_db)

        self.log.debug("Loading songdb {}{} and collectiondb {}".format(
            self.song_db, " (dir)" if self.db_is_directory else "",
            self.collection_file))

        self.progress.connect(self.update_precentage)
        self.current.connect(self.update_current)
        self.text.connect(self.update_text)
        self.done.connect(self.dismiss)

        self.ui.progressbar.setRange(0, 100)

        self.thread = QtCore.QThread()
Example #3
0
 def __init__(self, addr, port, password, cluster_name):
     self.addr = addr
     self.port = port
     self.password = password
     self.tags = "ssdb=" + str(port) + "_" + cluster_name
     self.cluster_name = cluster_name
     logging.config.fileConfig("../conf/logging.ini")
     self.logger = logging.getLogger(__name__)
 def __init__(self, cols, umaps, dialog):
     super(LoadApiTask, self).__init__()
     self.collections = cols
     self.unmatched_maps = umaps
     self.api_matched_maps = []
     self.dialog = dialog
     self.settings = settings.Settings.get_instance()
     self.log = logging.getLogger(__name__)
 def __init__(self, cf, sd, sd_isdir, dialog):
     super(LoadTask, self).__init__()
     self.collection_file = cf
     self.song_db = sd
     self.db_is_directory = sd_isdir
     self.dialog = dialog
     self.settings = settings.Settings.get_instance()
     self.log = logging.getLogger(__name__)
Example #6
0
 def __init__(self, cf, sd, sd_isdir, dialog):
     super(LoadTask, self).__init__()
     self.collection_file = cf
     self.song_db = sd
     self.db_is_directory = sd_isdir
     self.dialog = dialog
     self.settings = settings.Settings.get_instance()
     self.log = logging.getLogger(__name__)
 def __init__(self, cols, umaps, dialog):
     super(LoadApiTask, self).__init__()
     self.collections = cols
     self.unmatched_maps = umaps
     self.api_matched_maps = []
     self.dialog = dialog
     self.settings = settings.Settings.get_instance()
     self.log = logging.getLogger(__name__)
    def __init__(self):
        super(LoadingAddSong, self).__init__()
        self.log = logging.getLogger(__name__)

        self.ui = gui.loading.Ui_LoadingDialog()
        self.ui.setupUi(self)

        self.setModal(True)
        self.setFixedSize(self.width(), self.height())
        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.CustomizeWindowHint)

        self.progress.connect(self.update_precentage)
        self.current.connect(self.update_current)
        self.text.connect(self.update_text)
        self.done.connect(self.dismiss)

        self.ui.progressbar.setRange(0, 100)
Example #9
0
    def __init__(self, api, unmatched):
        super(MissingMaps, self).__init__()
        self.log = logging.getLogger(__name__)

        self.ui = gui.missing_maps.Ui_MissingMapsDialog()
        self.ui.setupUi(self)

        self.setModal(True)
        # self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint | QtCore.Qt.CustomizeWindowHint)

        # Fix the column sizes so the last two colums (links) are small and fixed, and the mapper colum resizes
        header = QtWidgets.QHeaderView(QtCore.Qt.Horizontal, self.ui.api_table)
        self.ui.api_table.setHorizontalHeader(header)
        header.setSectionResizeMode(0, QtWidgets.QHeaderView.Interactive)
        header.setSectionResizeMode(1, QtWidgets.QHeaderView.Interactive)
        header.setSectionResizeMode(2, QtWidgets.QHeaderView.Interactive)
        header.setSectionResizeMode(3, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(4, QtWidgets.QHeaderView.Fixed)
        header.setSectionResizeMode(5, QtWidgets.QHeaderView.Fixed)

        # Set initial sizes for interactive columns
        for i in range(0, 3):
            header.resizeSection(i, 160)

        # Set fixed sizes of icon columns
        for i in range(4, 6):
            header.resizeSection(i, 40)

        self.api_maps = api if api is not None else []
        self.unmatched_maps = unmatched if unmatched is not None else []
        self.link_lookup = {}

        # Connect open_link function to table clicked signal
        self.ui.api_table.cellClicked.connect(self.open_link)

        # Load icons
        self.osu_icon = QtGui.QIcon()
        self.osu_icon.addPixmap(QtGui.QPixmap("icons/osu.png"),
                                QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.bloodcat_icon = QtGui.QIcon()
        self.bloodcat_icon.addPixmap(QtGui.QPixmap("icons/bloodcat.png"),
                                     QtGui.QIcon.Normal, QtGui.QIcon.Off)
    def __init__(self, api, unmatched):
        super(MissingMaps, self).__init__()
        self.log = logging.getLogger(__name__)

        self.ui = gui.missing_maps.Ui_MissingMapsDialog()
        self.ui.setupUi(self)

        self.setModal(True)
        # self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint | QtCore.Qt.CustomizeWindowHint)

        # Fix the column sizes so the last two colums (links) are small and fixed, and the mapper colum resizes
        header = QtWidgets.QHeaderView(QtCore.Qt.Horizontal, self.ui.api_table)
        self.ui.api_table.setHorizontalHeader(header)
        header.setSectionResizeMode(0, QtWidgets.QHeaderView.Interactive)
        header.setSectionResizeMode(1, QtWidgets.QHeaderView.Interactive)
        header.setSectionResizeMode(2, QtWidgets.QHeaderView.Interactive)
        header.setSectionResizeMode(3, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(4, QtWidgets.QHeaderView.Fixed)
        header.setSectionResizeMode(5, QtWidgets.QHeaderView.Fixed)

        # Set initial sizes for interactive columns
        for i in range(0, 3):
            header.resizeSection(i, 160)

        # Set fixed sizes of icon columns
        for i in range(4, 6):
            header.resizeSection(i, 40)

        self.api_maps = api if api is not None else []
        self.unmatched_maps = unmatched if unmatched is not None else []
        self.link_lookup = {}

        # Connect open_link function to table clicked signal
        self.ui.api_table.cellClicked.connect(self.open_link)

        # Load icons
        self.osu_icon = QtGui.QIcon()
        self.osu_icon.addPixmap(QtGui.QPixmap("icons/osu.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.bloodcat_icon = QtGui.QIcon()
        self.bloodcat_icon.addPixmap(QtGui.QPixmap("icons/bloodcat.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
    def __init__(self, collections, unmatched_maps):
        super(LoadingApi, self).__init__()
        self.log = logging.getLogger(__name__)

        self.ui = gui.loading.Ui_LoadingDialog()
        self.ui.setupUi(self)

        self.setModal(True)
        self.setFixedSize(self.width(), self.height())
        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint | QtCore.Qt.CustomizeWindowHint)

        self.collections = collections
        self.unmatched_maps = unmatched_maps
        self.api_matched_maps = []

        self.progress.connect(self.update_precentage)
        self.current.connect(self.update_current)
        self.text.connect(self.update_text)
        self.done.connect(self.dismiss)

        self.ui.progressbar.setRange(0, 100)

        self.thread = QtCore.QThread()
    def __init__(self, collections, unmatched_maps):
        super(LoadingApi, self).__init__()
        self.log = logging.getLogger(__name__)

        self.ui = gui.loading.Ui_LoadingDialog()
        self.ui.setupUi(self)

        self.setModal(True)
        self.setFixedSize(self.width(), self.height())
        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint
                            | QtCore.Qt.CustomizeWindowHint)

        self.collections = collections
        self.unmatched_maps = unmatched_maps
        self.api_matched_maps = []

        self.progress.connect(self.update_precentage)
        self.current.connect(self.update_current)
        self.text.connect(self.update_text)
        self.done.connect(self.dismiss)

        self.ui.progressbar.setRange(0, 100)

        self.thread = QtCore.QThread()
Example #13
0
import util.osudb_parser
from logging.config import fileConfig, logging

if __name__ == "__main__":
    fileConfig('../../logging.conf')
    log = logging.getLogger(__name__)
    log.debug("Debugging mode enabled...")
    log.info("osu!DB test starting...")

    default_path = "/data/OwnCloud/Osu Program/osu!.db"

    print("------------------------------------------------------------------")
    print(" Osu! DB Parser Test")
    print("------------------------------------------------------------------")
    print("Input the path to your osu!.db, or enter to use the default.")
    print("The default is \"{}\"".format(default_path))
    path = input("Path: ")

    if not path:
        path = default_path

    print("")
    print("You have typed {} as the path.".format(path))
    print("------------------------------------------------------------------")

    songs = util.osudb_parser.load_osudb(path)
    scount = len(songs.songs)
    print("There are {} song{} in this database:".format(
        scount, "" if scount == 1 else "s"))

    for s in songs.songs:
Example #14
0
from logging.config import logging
import os

__author__ = 'Veracode'
__appname__ = 'seek-and-deploy'
__email__ = '*****@*****.**'
__version__ = '0.0.dev0'

try:  # Python 2.7+
    from logging import NullHandler
except ImportError:

    class NullHandler(logging.Handler):
        def emit(self, record):
            pass


logging.getLogger(__name__).addHandler(NullHandler())
path = os.path.join(os.path.dirname(__file__), 'conf', 'logging.conf')
logging.config.fileConfig(path)
Example #15
0
from logging.config import fileConfig, logging
from urllib.request import urlopen

from PIL import Image
from six import BytesIO

fileConfig('logging.conf')
logger = logging.getLogger('nn')

def download():
    image_set_path = './fall11_urls.txt'
    image_number = 0
    with open(image_set_path, "r") as ins:

        for line in ins:
            try:
                image = line.split()[1]
                print("Loading {} image from {}".format(image_number, image))
                image_response = urlopen(image, timeout=1)
                if image_response.url.endswith('photo_unavailable.png'):
                    continue
                img = Image.open(BytesIO(image_response.read()))

                img.save('imgnet/image-{}.png'.format(image_number), 'PNG')
                image_number += 1
            except:
                logger.exception("Error")
            if image_number > 5000:
                break

if __name__ == "__main__":
Example #16
0
from logging.config import dictConfig, logging
from urlparse import urljoin

import requests

from settings import LOGGING_CONFIG, ERROR_CODES_TO_MEANING_MAPPING
from errors import UnexpectedHTTPStatusCodeReturnedError, HTTPErrorCodeReceivedError

dictConfig(LOGGING_CONFIG)
logger = logging.getLogger()


class Connection(object):

    def __init__(self, b2c2_base_url, api_token):
        self.b2c2_base_url = b2c2_base_url
        self.api_token = api_token

    def _get_headers(self):
        return {
            'Content-Type': 'application/json',
            'Authorization': 'Token {api_token}'.format(api_token=self.api_token),
        }

    def _check_response_for_known_error_codes(self, response, known_error_codes):
        status_code = response.status_code
        if known_error_codes is not None and status_code in known_error_codes:
            message = ERROR_CODES_TO_MEANING_MAPPING[status_code]
            logger.info('Detected error status code {status_code}: {message}'.format(status_code=status_code,
                                                                                     message=message))
            raise HTTPErrorCodeReceivedError(message)
            if outp:
                print "Found Launchpad Output at {}:{}".format(interf, loop)
                launch_out = loop

        if launch_in != -1 and launch_out != -1:
            return launch_in, launch_out

def open_launchpad(dev_in, dev_out):
    launch_in = pypm.Input(dev_in)
    launch_out = pypm.Output(dev_out, 0)

    return launch_in, launch_out

if __name__ == '__main__':
    fileConfig('logging_config.conf')
    log = logging.getLogger(__name__)
    log.debug("Debugging mode enabled...")

    log.info("KuroLaunchpad starting...")

    # Handler initialisation
    h = MultiPageHandler()

    # Initialize Interface
    if use_debug_gui:
        log.info("Using the Debug GUI to emulate a Launchpad")
        from interfaces.gui_interface import GuiInterface
        i = GuiInterface(h)
        i.start()

    else: