def main(): app = QtGui.QApplication(sys.argv) signal.signal(signal.SIGINT, signal.SIG_DFL) operation_queue = GuiOperationQueue() library = Library() settings = UserSettings(operation_queue, library) player = Player() if len(sys.argv) > 1: argsongs = argParser.get_queue(sys.argv) player.setQueue(SongQueue(argsongs)) player.play() if sys.platform == 'win32': import ctypes myappid = 'Lune.Atlas' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) view = MainWindow(library, player, settings, operation_queue) view.show() app.exec_()
def main(): app = QtGui.QApplication(sys.argv) signal.signal(signal.SIGINT, signal.SIG_DFL) result_queue = multiprocessing.Queue() library = Library() settings = UserSettings(result_queue) song_queue = SongQueue() #this should not be here tho argsongs = None if len(sys.argv) > 1: argsongs = argParser.get_queue(sys.argv) if argsongs: song_queue.add_last(argsongs) player = Player() player.set_queue(song_queue) if song_queue: player.play() if sys.platform == 'win32': import ctypes myappid = 'Lune.Atlas' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) library.load() view = MainWindow(library, player, settings, result_queue) view.show() app.exec_()
LOG_LEVEL_WORK = logging.ERROR elif str(LOG_LEVEL).upper() == 'CRITICAL': LOG_LEVEL_WORK = logging.CRITICAL logger = logging.getLogger('main') if WRITE_LOG_TO_FILE: file_log = logging.FileHandler( f'log_{datetime.now().strftime("%m%d%Y%H%M%S")}.txt', mode='a') console_out = logging.StreamHandler() logging.basicConfig(handlers=(file_log, console_out), format=LOG_FORMAT, level=LOG_LEVEL_WORK, datefmt=date_format) else: logging.basicConfig(format=LOG_FORMAT, level=LOG_LEVEL, datefmt='%d/%m/%y %H:%M:%S') if platform == "linux" or platform == "linux2" or platform == "darwin": _path = os.path.abspath(__file__) os.system(f'find {_path}' + ' -type f -name "log_*" -mtime +168 -exec rm -rf {} \;') logger.info('Удалим логи старше недели') else: logger.info('Не могу удалить логи, если мы не в unix') app = QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec())
# -*- coding: utf-8 -*- from PyQt4 import QtGui from views.main_window import MainWindow import sys if __name__ == '__main__': app = QtGui.QApplication(sys.argv) main_win = MainWindow() main_win.show() sys.exit(app.exec_())