def __init__(self, name, object_widget, canvas_widget, count): QtWidgets.QMainWindow.__init__(self) self.name = name self.resize(720, 400) self.setWindowTitle(name) try: base_dir = os.path.dirname( os.path.dirname(os.path.realpath(__file__))) self.setWindowIcon( QtGui.QIcon(os.path.join(base_dir, 'icons/' + name + '.png'))) except: pass self.cfg = config.read_config("config.ini") self.props = object_widget(parent=self, count=count) self.canvas = canvas_widget(parent=self) self.canvas.props = self.props self.props.file_widget.on_load_file = self.canvas.load_audio splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal) splitter.addWidget(self.canvas.native) splitter.addWidget(self.props) self.setCentralWidget(splitter)
def __init__(self): widgets.MainWindow.__init__( self, "MaterialCollection Editor", ) self.resize(450, 500) self.matcol_data = MaterialcollectionFormat.Data() self.file_src = "" self.widgets = [] self.tooltips = config.read_config("util/tooltips/matcol.txt") self.games = ("Jurassic World Evolution", "Planet Zoo") self.default_fgms = config.read_list( "util/tooltips/matcol-fgm-names.txt") mainMenu = self.menuBar() fileMenu = mainMenu.addMenu('File') helpMenu = mainMenu.addMenu('Help') button_data = ( (fileMenu, "Open", self.open_materialcollection, "CTRL+O"), \ (fileMenu, "Save", self.save_materialcollection, "CTRL+S"), \ (fileMenu, "Exit", self.close, ""), \ (helpMenu, "Report Bug", self.report_bug, ""), \ (helpMenu, "Documentation", self.online_support, ""), \ ) self.add_to_menu(button_data) self.cleaner = QtCore.QObjectCleanupHandler() self.scrollarea = QtWidgets.QScrollArea(self) self.scrollarea.setWidgetResizable(True) self.setCentralWidget(self.scrollarea) # the actual scrollable stuff self.widget = QtWidgets.QWidget() self.scrollarea.setWidget(self.widget) self.game_container = widgets.LabelCombo("Game:", self.games) # self.game_container.entry.currentIndexChanged.connect(self.game_changed) self.game_container.entry.setEditable(False) self.materialcollection_container = widgets.LabelEdit("MATCOL:") self.tex_container = QtWidgets.QGroupBox("Slots") self.attrib_container = QtWidgets.QGroupBox("Attributes") self.vbox = QtWidgets.QVBoxLayout() self.vbox.addWidget(self.game_container) self.vbox.addWidget(self.materialcollection_container) self.vbox.addWidget(self.tex_container) self.vbox.addWidget(self.attrib_container) self.vbox.addStretch(1) self.widget.setLayout(self.vbox) self.tex_grid = self.create_grid() self.attrib_grid = self.create_grid() self.tex_container.setLayout(self.tex_grid) self.attrib_container.setLayout(self.attrib_grid)
def __init__(self): widgets.MainWindow.__init__(self, "FGM Editor", ) self.resize(450, 500) self.fgm_data = FgmFile() self.widgets = [] self.tooltips = config.read_config("util/tooltips/fgm.txt") self.shaders = {} for game in games: self.shaders[game] = config.read_list(f"util/tooltips/fgm-shaders-{game.lower().replace(' ', '-')}.txt") self.cleaner = QtCore.QObjectCleanupHandler() self.scrollarea = QtWidgets.QScrollArea(self) self.scrollarea.setWidgetResizable(True) self.setCentralWidget(self.scrollarea) # the actual scrollable stuff self.widget = QtWidgets.QWidget() self.scrollarea.setWidget(self.widget) self.game_container = widgets.LabelCombo("Game:", games) self.game_container.entry.currentIndexChanged.connect(self.game_changed) self.game_container.entry.setEditable(False) self.file_widget = widgets.FileWidget(self, self.cfg, dtype="FGM") self.shader_container = widgets.LabelCombo("Shader:", ()) self.shader_container.entry.activated.connect(self.shader_changed) self.tex_container = QtWidgets.QGroupBox("Textures") self.attrib_container = QtWidgets.QGroupBox("Attributes") vbox = QtWidgets.QVBoxLayout() vbox.addWidget(self.file_widget) vbox.addWidget(self.game_container) vbox.addWidget(self.shader_container) vbox.addWidget(self.tex_container) vbox.addWidget(self.attrib_container) vbox.addStretch(1) self.widget.setLayout(vbox) self.tex_grid = self.create_grid() self.attrib_grid = self.create_grid() self.tex_container.setLayout(self.tex_grid) self.attrib_container.setLayout(self.attrib_grid) mainMenu = self.menuBar() fileMenu = mainMenu.addMenu('File') helpMenu = mainMenu.addMenu('Help') button_data = ( (fileMenu, "Open", self.file_widget.ask_open, "CTRL+O", ""), \ (fileMenu, "Save", self.save_fgm, "CTRL+S", ""), \ (fileMenu, "Exit", self.close, "", ""), \ (helpMenu, "Report Bug", self.report_bug, "", ""), \ (helpMenu, "Documentation", self.online_support, "", ""), \ ) self.add_to_menu(button_data)
def __init__(self, name, ): QtWidgets.QMainWindow.__init__(self) self.central_widget = QtWidgets.QWidget(self) self.setCentralWidget(self.central_widget) self.name = name # self.resize(720, 400) self.setWindowTitle(name) self.setWindowIcon(get_icon("frontier")) self.cfg = config.read_config("config.ini")
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setAcceptDrops(True) self.cfg = config.read_config("config.ini") self.file_names = [] self.names_to_full_paths = {} self.central_widget = QtWidgets.QWidget(self) self.setCentralWidget(self.central_widget) self.setWindowTitle('Dropouts') self.dropout_widget = widgets.DropoutWidget() self.display_widget = widgets.DisplayWidget(with_canvas=False) self.display_widget.fft_c.setCurrentIndex(3) # 512 smp self.b_add = QtWidgets.QPushButton('Load Audio') self.b_add.setToolTip("Load audio files you want to process.") self.b_add.clicked.connect(self.open_audio) self.b_remove = QtWidgets.QPushButton('Remove Audio') self.b_remove.setToolTip("Remove audio files you do not want to process.") self.b_remove.clicked.connect(self.remove_files) self.b_process = QtWidgets.QPushButton('Process') self.b_process.setToolTip("Process these files according to the current settings.") self.b_process.clicked.connect(self.process) self.file_widget = QtWidgets.QListWidget() self.file_widget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) self.qgrid = QtWidgets.QGridLayout() self.qgrid.setHorizontalSpacing(0) self.qgrid.setVerticalSpacing(0) self.qgrid.addWidget(self.b_add, 0, 0) self.qgrid.addWidget(self.b_remove, 0, 1) self.qgrid.addWidget(self.b_process, 0, 2) self.qgrid.addWidget(self.file_widget, 1, 0, 1, 3) self.qgrid.addWidget(self.dropout_widget, 2, 0, 1, 3) self.qgrid.addWidget(self.display_widget, 3, 0, 1, 3) self.central_widget.setLayout(self.qgrid)
def __init__( self, name, ): QtWidgets.QMainWindow.__init__(self) self.central_widget = QtWidgets.QWidget(self) self.setCentralWidget(self.central_widget) self.name = name # self.resize(720, 400) self.setWindowTitle(name) try: base_dir = os.path.dirname( os.path.dirname(os.path.realpath(__file__))) self.setWindowIcon( QtGui.QIcon(os.path.join(base_dir, 'icons/frontier.png'))) except: pass self.cfg = config.read_config("config.ini")
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.central_widget = QtWidgets.QWidget(self) self.setCentralWidget(self.central_widget) self.setWindowTitle('Spectral Expander') self.file_src = "" # self.freqs = None self.spectra = [] self.fft_size = 512 self.fft_hop = self.fft_size // 8 self.marker_freqs = [] self.marker_dBs = [] self.ratios = [] self.vol_curves = [] self.cfg = config.read_config("config.ini") self.cb = QtWidgets.QApplication.clipboard() # a figure instance to plot on self.fig, self.ax = plt.subplots(nrows=1, ncols=1) self.ax.set_xlabel('Frequency (Hz)') self.ax.set_ylabel('Volume (dB)') # the range is not automatically fixed self.fig.patch.set_facecolor((53/255, 53/255, 53/255)) self.ax.set_facecolor((35/255, 35/255, 35/255)) # this is the Canvas Widget that displays the `figure` # it takes the `fig` instance as a parameter to __init__ self.canvas = FigureCanvas(self.fig) self.canvas.mpl_connect('button_press_event', self.onclick) # this is the Navigation widget # it takes the Canvas widget and a parent self.toolbar = NavigationToolbar(self.canvas, self) # Just some button connected to `plot` method self.file_widget = widgets.FilesWidget(self, 1, self.cfg) self.file_widget.on_load_file = self.open_file self.b_expand = QtWidgets.QPushButton('Expand') self.b_expand.setToolTip("Write expanded audio to a new file.") self.b_expand.clicked.connect(self.expand) self.s_band_lower = QtWidgets.QSpinBox() self.s_band_lower.valueChanged.connect(self.plot) self.s_band_lower.setRange(0, 22000) self.s_band_lower.setSingleStep(1000) self.s_band_lower.setValue(13000) self.s_band_lower.setToolTip("Lower frequency boundary of noise floor") self.s_band_upper = QtWidgets.QSpinBox() self.s_band_upper.valueChanged.connect(self.plot) self.s_band_upper.setRange(1000, 22000) self.s_band_upper.setSingleStep(1000) self.s_band_upper.setValue(17000) self.s_band_upper.setToolTip("Upper frequency boundary of noise floor") self.s_clip_lower = QtWidgets.QSpinBox() self.s_clip_lower.valueChanged.connect(self.plot) self.s_clip_lower.setRange(-200, 0) self.s_clip_lower.setSingleStep(1) self.s_clip_lower.setValue(-120) self.s_clip_lower.setToolTip("Lower gain boundary of noise floor") self.s_clip_upper = QtWidgets.QSpinBox() self.s_clip_upper.valueChanged.connect(self.plot) self.s_clip_upper.setRange(-200, 0) self.s_clip_upper.setSingleStep(1) self.s_clip_upper.setValue(-85) self.s_clip_upper.setToolTip("Upper gain boundary of noise floor") self.c_channels = QtWidgets.QComboBox(self) self.c_channels.addItems(list(("L,R","L","R","Mean"))) self.c_channels.setToolTip("Which channels should be analyzed?") tolerance_l = QtWidgets.QLabel("Tolerance") self.s_smoothing = QtWidgets.QDoubleSpinBox() self.s_smoothing.setRange(.001, 5) self.s_smoothing.setSingleStep(.01) self.s_smoothing.setValue(.11) self.s_smoothing.setToolTip("Smoothing in s.") self.l_result = QtWidgets.QLabel("Result: ") self.qgrid = QtWidgets.QGridLayout() # self.qgrid.setHorizontalSpacing(0) self.qgrid.setVerticalSpacing(0) self.qgrid.addWidget(self.toolbar, 0, 0, 1, 8) self.qgrid.addWidget(self.canvas, 1, 0, 1, 8) self.qgrid.addWidget(self.file_widget, 2, 0) self.qgrid.addWidget(self.b_expand, 2, 1) self.qgrid.addWidget(self.c_channels, 2, 2) self.qgrid.addWidget(self.s_band_lower, 2, 3) self.qgrid.addWidget(self.s_band_upper, 2, 4) self.qgrid.addWidget(self.s_clip_lower, 2, 5) self.qgrid.addWidget(self.s_clip_upper, 2, 6) self.qgrid.addWidget(self.s_smoothing, 2, 7) self.central_widget.setLayout(self.qgrid) self.s_band_lower.valueChanged.connect(self.on_param_changed) self.s_band_upper.valueChanged.connect(self.on_param_changed) self.s_clip_lower.valueChanged.connect(self.on_param_changed) self.s_clip_upper.valueChanged.connect(self.on_param_changed) self.s_smoothing.valueChanged.connect(self.on_param_changed) self.c_channels.currentIndexChanged.connect(self.update_spectrum)
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.central_widget = QtWidgets.QWidget(self) self.setCentralWidget(self.central_widget) self.setWindowTitle('Hum Speed Analysis') self.file_src = "" self.freqs = None self.spectrum = None self.fft_size = 131072 self.marker_freqs = [] self.marker_dBs = [] self.ratios = [] self.hum_freqs = [] self.cfg = config.read_config("config.ini") self.cb = QtWidgets.QApplication.clipboard() # a figure instance to plot on self.fig, self.ax = plt.subplots(nrows=1, ncols=1) self.ax.set_xlabel('Frequency (Hz)') self.ax.set_ylabel('Volume (dB)') # the range is not automatically fixed self.fig.patch.set_facecolor((53 / 255, 53 / 255, 53 / 255)) self.ax.set_facecolor((35 / 255, 35 / 255, 35 / 255)) # this is the Canvas Widget that displays the `figure` # it takes the `fig` instance as a parameter to __init__ self.canvas = FigureCanvas(self.fig) self.canvas.mpl_connect('button_press_event', self.onclick) # this is the Navigation widget # it takes the Canvas widget and a parent self.toolbar = NavigationToolbar(self.canvas, self) # Just some button connected to `plot` method self.file_widget = widgets.FilesWidget(self, 1, self.cfg) self.file_widget.on_load_file = self.open_file self.b_resample = QtWidgets.QPushButton('Resample') self.b_resample.setToolTip( "Write speed-corrected audio to a new file.") self.b_resample.clicked.connect(self.resample) self.c_channels = QtWidgets.QComboBox(self) self.c_channels.addItems(list(("L+R", "L", "R"))) self.c_channels.setToolTip("Which channels should be analyzed?") self.s_base_hum = QtWidgets.QSpinBox() self.s_base_hum.setRange(10, 500) self.s_base_hum.setSingleStep(10) self.s_base_hum.setValue(50) self.s_base_hum.setSuffix(" Hz") self.s_base_hum.setToolTip("Base frequency of the hum.") self.s_num_harmonies = QtWidgets.QSpinBox() self.s_num_harmonies.setRange(0, 5) self.s_num_harmonies.setSingleStep(1) self.s_num_harmonies.setValue(2) self.s_num_harmonies.setToolTip("Number of hum harmonies to consider.") self.s_tolerance = QtWidgets.QSpinBox() self.s_tolerance.setRange(1, 20) self.s_tolerance.setSingleStep(1) self.s_tolerance.setValue(8) self.s_tolerance.setSuffix(" %") self.s_tolerance.setToolTip( "Maximum derivation from target hum frequency to look for peaks in spectrum." ) self.l_result = QtWidgets.QLabel("Result: ") self.qgrid = QtWidgets.QGridLayout() # self.qgrid.setHorizontalSpacing(0) self.qgrid.setVerticalSpacing(0) self.qgrid.addWidget(self.toolbar, 0, 0, 1, 7) self.qgrid.addWidget(self.canvas, 1, 0, 1, 7) self.qgrid.addWidget(self.file_widget, 2, 0) self.qgrid.addWidget(self.b_resample, 2, 1) self.qgrid.addWidget(self.c_channels, 2, 2) self.qgrid.addWidget(self.s_base_hum, 2, 3) self.qgrid.addWidget(self.s_num_harmonies, 2, 4) self.qgrid.addWidget(self.s_tolerance, 2, 5) self.qgrid.addWidget(self.l_result, 2, 6) self.central_widget.setLayout(self.qgrid) self.s_base_hum.valueChanged.connect(self.on_hum_param_changed) self.s_num_harmonies.valueChanged.connect(self.on_hum_param_changed) self.s_tolerance.valueChanged.connect(self.on_hum_param_changed) self.c_channels.currentIndexChanged.connect(self.update_spectrum)
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.central_widget = QtWidgets.QWidget(self) self.setCentralWidget(self.central_widget) self.setWindowTitle('Differential EQ') self.names = [] self.src_noise = None self.ref_noise = None self.eq_noise = None self.freqs = None self.eqs = [] self.av = [] self.freqs_av = [] self.cfg = config.read_config("config.ini") # a figure instance to plot on self.fig, self.ax = plt.subplots(nrows=1, ncols=1) # the range is not automatically fixed # self.fig.patch.set_facecolor(SECONDARY.getRgb()) # self.ax.set_facecolor(SECONDARY.getRgb()) self.fig.patch.set_facecolor((53/255, 53/255, 53/255)) self.ax.set_facecolor((35/255, 35/255, 35/255)) # this is the Canvas Widget that displays the `figure` # it takes the `fig` instance as a parameter to __init__ self.canvas = FigureCanvas(self.fig) # this is the Navigation widget # it takes the Canvas widget and a parent self.toolbar = NavigationToolbar(self.canvas, self) # Just some button connected to `plot` method self.file_widget = widgets.FilesWidget(self, 2, self.cfg, ask_user=False) self.file_widget.on_load_file = self.foo self.b_add = QtWidgets.QPushButton('+') self.b_add.setToolTip("Add a source - reference pair to the list.") self.b_add.clicked.connect(self.open) self.b_delete = QtWidgets.QPushButton('-') self.b_delete.setToolTip("Delete the selected source - reference pair from the list.") self.b_delete.clicked.connect(self.delete) self.b_save = QtWidgets.QPushButton('=') self.b_save.setToolTip("Write the average EQ curve to an XML file.") self.b_save.clicked.connect(self.write) self.s_rolloff_start = QtWidgets.QSpinBox() self.s_rolloff_start.valueChanged.connect(self.plot) self.s_rolloff_start.setRange(0, 22000) self.s_rolloff_start.setSingleStep(1000) self.s_rolloff_start.setValue(21000) self.s_rolloff_start.setToolTip("At this frequency, the EQ still has full influence.") self.s_rolloff_end = QtWidgets.QSpinBox() self.s_rolloff_end.valueChanged.connect(self.plot) self.s_rolloff_end.setRange(1000, 22000) self.s_rolloff_end.setSingleStep(1000) self.s_rolloff_end.setValue(22000) self.s_rolloff_end.setToolTip("At this frequency, the effect of the EQ becomes zero.") self.c_channels = QtWidgets.QComboBox(self) self.c_channels.addItems(list(("L+R","L","R"))) self.c_channels.setToolTip("Which channels should be analyzed?") self.s_output_res = QtWidgets.QSpinBox() self.s_output_res.valueChanged.connect(self.plot) self.s_output_res.setRange(20, 2000) self.s_output_res.setSingleStep(100) self.s_output_res.setValue(200) self.s_output_res.setToolTip("Resolution of the output curve.") self.s_smoothing = QtWidgets.QSpinBox() self.s_smoothing.valueChanged.connect(self.plot) self.s_smoothing.setRange(1, 200) self.s_smoothing.setSingleStep(10) self.s_smoothing.setValue(50) self.s_smoothing.setToolTip("Smoothing factor. Hint: Increase this if your sample size is small.") self.s_strength = QtWidgets.QSpinBox() self.s_strength.valueChanged.connect(self.plot) self.s_strength.setRange(10, 150) self.s_strength.setSingleStep(10) self.s_strength.setValue(100) self.s_strength.setToolTip("EQ Gain [%]. Adjust the strength of the output EQ curve.") self.b_noise = QtWidgets.QPushButton('Noise Floor') self.b_noise.setToolTip("Load a source - reference pair of noise floor samples.") self.b_noise.clicked.connect(self.add_noise) self.listWidget = QtWidgets.QListWidget() self.qgrid = QtWidgets.QGridLayout() self.qgrid.setHorizontalSpacing(0) self.qgrid.setVerticalSpacing(0) self.qgrid.addWidget(self.toolbar, 0, 0, 1, 2) self.qgrid.addWidget(self.canvas, 1, 0, 1, 2) self.qgrid.addWidget(self.listWidget, 2, 0, 9, 1) self.qgrid.addWidget(self.file_widget, 2, 1) self.qgrid.addWidget(self.b_add, 3, 1) self.qgrid.addWidget(self.b_delete, 4, 1) self.qgrid.addWidget(self.b_save, 5, 1) self.qgrid.addWidget(self.s_rolloff_start, 6, 1) self.qgrid.addWidget(self.s_rolloff_end, 7, 1) self.qgrid.addWidget(self.c_channels, 8, 1) self.qgrid.addWidget(self.s_output_res, 9, 1) self.qgrid.addWidget(self.s_smoothing, 10, 1) self.qgrid.addWidget(self.s_strength, 11, 1) # self.qgrid.addWidget(self.b_noise, 11, 1) self.colors = plt.rcParams['axes.prop_cycle'].by_key()['color'] self.central_widget.setLayout(self.qgrid)
from discord.ext import commands from cogs.admin import Admin from cogs.karma.profile import KarmaProfile from cogs.karma.producer import KarmaProducer from cogs.karma.reduce import KarmaReducer, KarmaBlocker from cogs.settings import SettingsManager from util.config import config, read_config if __name__ == '__main__': read_config() client = commands.Bot(command_prefix=config['prefix']) client.add_cog(Admin(client)) client.add_cog(KarmaProducer(client)) client.add_cog(KarmaBlocker(client)) client.add_cog(KarmaReducer(client)) client.add_cog(KarmaProfile(client)) client.add_cog(SettingsManager(client)) client.run(config['token'])