Replace **self.context_args by context=self.context.

Equivalent, because context_args only contained one 'context' entry anyway.
And the old form confused mypy a bit.
looper
Ben Niemann 5 years ago
parent d4b21f1817
commit b7748dfa2a

@ -109,8 +109,8 @@ class BaseEditorApp(object):
self.__clipboard = None
@property
def context_args(self):
return {'context': self.__context}
def context(self) -> ui_base.CommonContext:
return self.__context
async def setup(self):
await self.createNodeDB()
@ -277,16 +277,16 @@ class EditorApp(BaseEditorApp, QtWidgets.QApplication):
self.setStyle(style)
logger.info("Creating PipelinePerfMonitor.")
self.pipeline_perf_monitor = pipeline_perf_monitor.PipelinePerfMonitor(**self.context_args)
self.pipeline_perf_monitor = pipeline_perf_monitor.PipelinePerfMonitor(context=self.context)
# logger.info("Creating PipelineGraphMonitor.")
# self.pipeline_graph_monitor = pipeline_graph_monitor.PipelineGraphMonitor(**self.context_args)
# self.pipeline_graph_monitor = pipeline_graph_monitor.PipelineGraphMonitor(context=self.context)
logger.info("Creating StatMonitor.")
self.stat_monitor = stat_monitor.StatMonitor(**self.context_args)
self.stat_monitor = stat_monitor.StatMonitor(context=self.context)
logger.info("Creating EditorWindow.")
self.win = EditorWindow(**self.context_args)
self.win = EditorWindow(context=self.context)
await self.win.setup()
self.win.show()

@ -61,10 +61,10 @@ class EditorWindow(ui_base.CommonMixin, QtWidgets.QMainWindow):
super().__init__(**kwargs)
self._docks = []
self._settings_dialog = SettingsDialog(parent=self, **self.context_args)
self._settings_dialog = SettingsDialog(parent=self, context=self.context)
self._instrument_library_dialog = instrument_library.InstrumentLibraryDialog(
**self.context_args, parent=self)
context=self.context, parent=self)
self._current_project_view = None

@ -427,7 +427,7 @@ class InstrumentLibraryDialog(ui_base.CommonMixin, QtWidgets.QDialog):
self.instruments_search.addAction(action, QtWidgets.QLineEdit.TrailingPosition)
self.instruments_search.textChanged.connect(self.onInstrumentSearchChanged)
self.__model = LibraryModel(**self.context_args)
self.__model = LibraryModel(context=self.context)
self.__model_filter = FilterModel(self.__model)
self.__view = LibraryView(self)
self.__view.setModel(self.__model_filter)

@ -39,7 +39,7 @@ class TracksModelTest(uitest_utils.UITest):
properties={})
async def test_addInstrument(self):
model = instrument_library.LibraryModel(**self.context_args)
model = instrument_library.LibraryModel(context=self.context)
try:
root_index = QtCore.QModelIndex()
self.assertEqual(model.rowCount(root_index), 0)
@ -62,7 +62,7 @@ class TracksModelTest(uitest_utils.UITest):
model.close()
async def test_addInstrument_long_path(self):
model = instrument_library.LibraryModel(**self.context_args)
model = instrument_library.LibraryModel(context=self.context)
try:
model.addInstrument(self.__mkinstr('/some/path/test1.wav'))
self.assertEqual(

@ -561,7 +561,7 @@ class NodePropertyDialog(
port=port,
connector=self.__control_values,
parent=props,
**self.context_args)
context=self.context)
self.__control_value_widgets.append(widget)
prop_layout.addRow(widget.label(), widget.widget())
@ -604,7 +604,7 @@ class NodePropertyDialog(
node_description = node.description
if node_description.has_ui:
return PluginUI(parent=parent, node=node, **self.context_args)
return PluginUI(parent=parent, node=node, context=self.context)
else:
tab = QtWidgets.QWidget(parent)
@ -781,7 +781,7 @@ class NodeItem(ui_base.ProjectMixin, QtWidgets.QGraphicsRectItem):
self._properties_dialog = NodePropertyDialog(
node_item=self,
parent=self.window,
**self.context_args)
context=self.context)
@property
def node(self):
@ -1017,7 +1017,7 @@ class PipelineGraphGraphicsView(ui_base.ProjectMixin, QtWidgets.QGraphicsView):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self._scene = PipelineGraphScene(view=self, **self.context_args)
self._scene = PipelineGraphScene(view=self, context=self.context)
self.setScene(self._scene)
self._drag_connection = None
@ -1029,7 +1029,7 @@ class PipelineGraphGraphicsView(ui_base.ProjectMixin, QtWidgets.QGraphicsView):
self._nodes = []
self._node_map = {}
for node in self.project.pipeline_graph_nodes:
item = NodeItem(node=node, view=self, **self.context_args)
item = NodeItem(node=node, view=self, context=self.context)
self._scene.addItem(item)
self._nodes.append(item)
self._node_map[node.id] = item
@ -1040,7 +1040,7 @@ class PipelineGraphGraphicsView(ui_base.ProjectMixin, QtWidgets.QGraphicsView):
self._connections = []
for connection in self.project.pipeline_graph_connections:
item = ConnectionItem(
connection=connection, view=self, **self.context_args)
connection=connection, view=self, context=self.context)
self._scene.addItem(item)
self._connections.append(item)
self._node_map[connection.source_node.id].connections.add(item)
@ -1058,7 +1058,7 @@ class PipelineGraphGraphicsView(ui_base.ProjectMixin, QtWidgets.QGraphicsView):
def onPipelineGraphNodesChange(self, action, *args):
if action == 'insert':
idx, node = args
item = NodeItem(node=node, view=self, **self.context_args)
item = NodeItem(node=node, view=self, context=self.context)
self._scene.addItem(item)
self._nodes.insert(idx, item)
self._node_map[node.id] = item
@ -1081,7 +1081,7 @@ class PipelineGraphGraphicsView(ui_base.ProjectMixin, QtWidgets.QGraphicsView):
if action == 'insert':
idx, connection = args
item = ConnectionItem(
connection=connection, view=self, **self.context_args)
connection=connection, view=self, context=self.context)
self._scene.addItem(item)
self._connections.insert(idx, item)
self._node_map[connection.source_node_id].connections.add(item)
@ -1281,7 +1281,7 @@ class NodeListDock(dock_widget.DockWidget):
initial_visible=True,
**kwargs)
self._node_list = NodesList(parent=self, **self.context_args)
self._node_list = NodesList(parent=self, context=self.context)
self._node_filter = QtWidgets.QLineEdit(self)
self._node_filter.addAction(
@ -1318,9 +1318,9 @@ class PipelineGraphView(ui_base.ProjectMixin, QtWidgets.QWidget):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self._graph_view = PipelineGraphGraphicsView(**self.context_args)
self._graph_view = PipelineGraphGraphicsView(context=self.context)
self._node_list_dock = NodeListDock(parent=self.window, **self.context_args)
self._node_list_dock = NodeListDock(parent=self.window, context=self.context)
self._node_list_dock.hide()
layout = QtWidgets.QHBoxLayout()

@ -30,7 +30,7 @@ class PluginUITest(unittest.UITestCase):
async def test_init(self):
node = None
plugin_ui = pipeline_graph_view.PluginUI(node=node, **self.context_args)
plugin_ui = pipeline_graph_view.PluginUI(node=node, context=self.context)
try:
pass

@ -78,4 +78,4 @@ class ProjectPropertiesDockWidget(ui_base.ProjectMixin, dock_widget.DockWidget):
initial_visible=True,
**kwargs)
self.setWidget(ProjectProperties(**self.context_args))
self.setWidget(ProjectProperties(context=self.context))

@ -404,7 +404,7 @@ class Editor(TrackViewMixin, TimeViewMixin, ui_base.ProjectMixin, AsyncSetupBase
track=track,
player_state=self.__player_state,
editor=self,
**self.context_args)
context=self.context)
track_item.rectChanged.connect(
lambda rect: self.update(rect.translated(-self.offset())))
track_item.sizeChanged.connect(
@ -453,7 +453,7 @@ class Editor(TrackViewMixin, TimeViewMixin, ui_base.ProjectMixin, AsyncSetupBase
self.__current_tool_box = None
if cls is not None:
self.__current_tool_box = cls(**self.context_args)
self.__current_tool_box = cls(context=self.context)
self.__onCurrentToolChanged(self.__current_tool_box.currentTool())
self.__current_tool_box.currentToolChanged.connect(self.__onCurrentToolChanged)
@ -1037,7 +1037,7 @@ class TrackList(TrackViewMixin, ui_base.ProjectMixin, AsyncSetupBase, QtWidgets.
self.__content_height = 400
def createTrack(self, track):
track_item = TrackListItem(track=track, **self.context_args)
track_item = TrackListItem(track=track, context=self.context)
track_item.rectChanged.connect(lambda _: self.update())
return track_item
@ -1134,7 +1134,7 @@ class ProjectView(ui_base.ProjectMixin, QtWidgets.QMainWindow):
self.__player_status_listener = None
self.__playback_pos_mode = 'follow'
self.__player_state = PlayerState(**self.context_args)
self.__player_state = PlayerState(context=self.context)
self.__player_state.playingChanged.connect(self.playingChanged)
self.__player_state.loopEnabledChanged.connect(self.loopEnabledChanged)
@ -1143,7 +1143,7 @@ class ProjectView(ui_base.ProjectMixin, QtWidgets.QMainWindow):
editor_frame = Frame(parent=editor_tab)
self.__editor = Editor(
player_state=self.__player_state,
parent=editor_frame, **self.context_args)
parent=editor_frame, context=self.context)
editor_frame.setWidget(self.__editor)
self.__editor.setScaleX(self.__get_session_value('scale_x', self.__editor.scaleX()))
@ -1156,11 +1156,11 @@ class ProjectView(ui_base.ProjectMixin, QtWidgets.QMainWindow):
time_line_frame = Frame(parent=editor_tab)
self.__time_line = TimeLine(
project_view=self, player_state=self.__player_state,
parent=time_line_frame, **self.context_args)
parent=time_line_frame, context=self.context)
time_line_frame.setWidget(self.__time_line)
track_list_frame = Frame(parent=editor_tab)
track_list = TrackList(parent=track_list_frame, **self.context_args)
track_list = TrackList(parent=track_list_frame, context=self.context)
track_list_frame.setWidget(track_list)
self.__time_line.setScaleX(self.__editor.scaleX())
@ -1207,7 +1207,7 @@ class ProjectView(ui_base.ProjectMixin, QtWidgets.QMainWindow):
mixer_tab = QtWidgets.QWidget()
graph_tab = pipeline_graph_view.PipelineGraphView(**self.context_args)
graph_tab = pipeline_graph_view.PipelineGraphView(context=self.context)
project_tab = QtWidgets.QTabWidget(self)
project_tab.setTabPosition(QtWidgets.QTabWidget.West)
@ -1224,20 +1224,20 @@ class ProjectView(ui_base.ProjectMixin, QtWidgets.QMainWindow):
self._docks = []
self._tools_dock = tool_dock.ToolsDockWidget(parent=self, **self.context_args)
self._tools_dock = tool_dock.ToolsDockWidget(parent=self, context=self.context)
self._docks.append(self._tools_dock)
self.currentToolBoxChanged.connect(self._tools_dock.setCurrentToolBox)
self._tools_dock.setCurrentToolBox(self.currentToolBox())
self._project_properties_dock = project_properties_dock.ProjectPropertiesDockWidget(
parent=self, **self.context_args)
parent=self, context=self.context)
self._docks.append(self._project_properties_dock)
self._tracks_dock = tracks_dock.TracksDockWidget(parent=self, **self.context_args)
self._tracks_dock = tracks_dock.TracksDockWidget(parent=self, context=self.context)
self._docks.append(self._tracks_dock)
self._track_properties_dock = track_properties_dock.TrackPropertiesDockWidget(
parent=self, **self.context_args)
parent=self, context=self.context)
self._docks.append(self._track_properties_dock)
self._tracks_dock.currentTrackChanged.connect(self._track_properties_dock.setTrack)
@ -1456,7 +1456,7 @@ class ProjectView(ui_base.ProjectMixin, QtWidgets.QMainWindow):
self.__editor.onPaste(mode=mode)
def onRender(self):
dialog = render_dialog.RenderDialog(parent=self, **self.context_args)
dialog = render_dialog.RenderDialog(parent=self, context=self.context)
dialog.setModal(True)
dialog.show()

@ -36,7 +36,7 @@
# class InitTest(uitest_utils.UITest):
# async def test_init(self):
# view = ProjectView(**self.context_args)
# view = ProjectView(context=self.context)
# await view.setup()
# self.assertIsNone(view.currentSheetView())
#
@ -47,7 +47,7 @@
# self.project.sheets.append(model.Sheet('sheet2'))
# self.project.sheets[1].property_track = model.SheetPropertyTrack('prop2')
# self.project.sheets[1].master_group = model.TrackGroup('master')
# view = ProjectView(**self.context_args)
# view = ProjectView(context=self.context)
# await view.setup()
# self.assertIsInstance(view.currentSheetView(), SheetView)
# self.assertEqual(view.currentSheetView().sheet.id, 'sheet1')
@ -62,7 +62,7 @@
# pass
# # async def test_add_sheet(self):
# # view = ProjectView(**self.context_args)
# # view = ProjectView(context=self.context)
# # await view.setup()
# # self.assertEqual(len(list(view.sheetViews)), 0)
@ -76,7 +76,7 @@
# # sheet.property_track = model.SheetPropertyTrack('prop1')
# # self.project.sheets.append(sheet)
# # view = ProjectView(**self.context_args)
# # view = ProjectView(context=self.context)
# # await view.setup()
# # self.assertEqual(len(list(view.sheetViews)), 1)
@ -88,7 +88,7 @@
# # sheet.property_track = model.SheetPropertyTrack('prop1')
# # self.project.sheets.append(sheet)
# # view = ProjectView(**self.context_args)
# # view = ProjectView(context=self.context)
# # await view.setup()
# # self.assertEqual(len(list(view.sheetViews)), 1)
@ -104,7 +104,7 @@
# sheet.master_group = model.TrackGroup('master')
# self.project.sheets.append(sheet)
# view = ProjectView(**self.context_args)
# view = ProjectView(context=self.context)
# await view.setup()
# view.onAddSheet()
# self.assertEqual(
@ -123,7 +123,7 @@
# sheet.master_group = model.TrackGroup('master')
# self.project.sheets.append(sheet)
# view = ProjectView(**self.context_args)
# view = ProjectView(context=self.context)
# await view.setup()
# view.onDeleteSheet()
# self.assertEqual(
@ -174,7 +174,7 @@
# async def test_init(self):
# track = model.ScoreTrack('track1')
# self.sheet.master_group.tracks.append(track)
# view = SheetView(**self.context_args, sheet=self.sheet)
# view = SheetView(context=self.context, sheet=self.sheet)
# await view.setup()
# self.assertEqual(
# [ti.track.id for ti in view.trackItems],
@ -183,7 +183,7 @@
# class SheetViewModelChangesTest(SheetViewTest):
# async def test_tracks(self):
# view = SheetView(**self.context_args, sheet=self.sheet)
# view = SheetView(context=self.context, sheet=self.sheet)
# await view.setup()
# track = model.ScoreTrack('track1')
@ -208,7 +208,7 @@
# async def test_track_visibility(self):
# track = model.ScoreTrack('track1')
# self.sheet.master_group.tracks.append(track)
# view = SheetView(**self.context_args, sheet=self.sheet)
# view = SheetView(context=self.context, sheet=self.sheet)
# await view.setup()
# view.updateSheet = mock.MagicMock()
# self.assertEqual(view.updateSheet.call_count, 0)
@ -218,7 +218,7 @@
# class SheetViewCommandsTest(SheetViewTest):
# async def test_onAddTrack(self):
# view = SheetView(**self.context_args, sheet=self.sheet)
# view = SheetView(context=self.context, sheet=self.sheet)
# await view.setup()
# view.onAddTrack('score')
# self.assertEqual(
@ -228,7 +228,7 @@
# class SheetViewEventsTest(SheetViewTest):
# async def test_keyEvent(self):
# view = SheetView(**self.context_args, sheet=self.sheet)
# view = SheetView(context=self.context, sheet=self.sheet)
# await view.setup()
# # Number keys select notes, if the current tool is a note.
@ -307,7 +307,7 @@
# class SheetViewToolTest(SheetViewTest):
# # This one just aims for coverage. TODO: also verify effects.
# async def test_setCurrentTool(self):
# view = SheetView(**self.context_args, sheet=self.sheet)
# view = SheetView(context=self.context, sheet=self.sheet)
# await view.setup()
# for tool in tool_dock.Tool:

@ -45,7 +45,7 @@ class SettingsDialog(ui_base.CommonMixin, QtWidgets.QDialog):
self.tabs = QtWidgets.QTabWidget(self)
for cls in (AppearancePage, AudioPage):
page = cls(**self.context_args)
page = cls(context=self.context)
self.tabs.addTab(page, page.getIcon(), page.title)
close = QtWidgets.QPushButton("Close")

@ -762,7 +762,7 @@ class MeasuredTrackEditorItem(BaseTrackEditorItem):
for idx, mref in enumerate(self.track.measure_list):
self.addMeasure(idx, mref)
appendix_item = Appendix(track_item=self, **self.context_args)
appendix_item = Appendix(track_item=self, context=self.context)
appendix_item.rectChanged.connect(self.rectChanged)
self.__measure_items.append(appendix_item)
@ -800,7 +800,7 @@ class MeasuredTrackEditorItem(BaseTrackEditorItem):
def addMeasure(self, idx, mref):
measure_item = self.measure_item_cls( # pylint: disable=not-callable
track_item=self, measure_reference=mref, **self.context_args)
track_item=self, measure_reference=mref, context=self.context)
measure_item.rectChanged.connect(self.rectChanged)
self.__measure_items.insert(idx, measure_item)
self.updateMeasures()

@ -44,7 +44,7 @@ class TestToolBox(tools.ToolBox):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.addTool(TestTool(**self.context_args))
self.addTool(TestTool(context=self.context))
class TestTrackEditorItem(base_track_item.BaseTrackEditorItem):
@ -54,14 +54,14 @@ class TestTrackEditorItem(base_track_item.BaseTrackEditorItem):
class BaseTrackEditorItemTest(track_item_tests.TrackEditorItemTestMixin, uitest_utils.UITest):
async def setup_testcase(self):
self.project.master_group.tracks.append(model.ScoreTrack(obj_id='track-1'))
self.tool_box = TestToolBox(**self.context_args)
self.tool_box = TestToolBox(context=self.context)
def _createTrackItem(self, **kwargs):
return TestTrackEditorItem(
track=self.project.master_group.tracks[0],
player_state=self.player_state,
editor=self.editor,
**self.context_args,
context=self.context,
**kwargs)
@ -72,12 +72,12 @@ class TestMeasuredTrackEditorItem(base_track_item.MeasuredTrackEditorItem):
class MeasuredTrackEditorItemTest(track_item_tests.TrackEditorItemTestMixin, uitest_utils.UITest):
async def setup_testcase(self):
self.project.master_group.tracks.append(model.ScoreTrack(obj_id='track-1'))
self.tool_box = TestToolBox(**self.context_args)
self.tool_box = TestToolBox(context=self.context)
def _createTrackItem(self, **kwargs):
return TestMeasuredTrackEditorItem(
track=self.project.master_group.tracks[0],
player_state=self.player_state,
editor=self.editor,
**self.context_args,
context=self.context,
**kwargs)

@ -96,8 +96,8 @@ class BeatToolBox(tools.ToolBox):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.addTool(base_track_item.ArrangeMeasuresTool(**self.context_args))
self.addTool(EditBeatsTool(**self.context_args))
self.addTool(base_track_item.ArrangeMeasuresTool(context=self.context))
self.addTool(EditBeatsTool(context=self.context))
class BeatMeasureEditorItem(base_track_item.MeasureEditorItem):

@ -49,14 +49,14 @@ class BeatTrackEditorItemTest(track_item_tests.TrackEditorItemTestMixin, uitest_
mref.measure_id = m.id
self.project.master_group.tracks[0].measure_list.append(mref)
self.tool_box = beat_track_item.BeatToolBox(**self.context_args)
self.tool_box = beat_track_item.BeatToolBox(context=self.context)
def _createTrackItem(self, **kwargs):
return beat_track_item.BeatTrackEditorItem(
track=self.project.master_group.tracks[0],
player_state=self.player_state,
editor=self.editor,
**self.context_args,
context=self.context,
**kwargs)
@unittest.skip("Segfaults")

@ -208,7 +208,7 @@ class ControlTrackToolBox(tools.ToolBox):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.addTool(EditControlPointsTool(**self.context_args))
self.addTool(EditControlPointsTool(context=self.context))
class ControlPoint(object):

@ -30,12 +30,12 @@ class ControlTrackEditorItemTest(track_item_tests.TrackEditorItemTestMixin, uite
async def setup_testcase(self):
self.project.master_group.tracks.append(model.ControlTrack(obj_id='track-1'))
self.tool_box = control_track_item.ControlTrackToolBox(**self.context_args)
self.tool_box = control_track_item.ControlTrackToolBox(context=self.context)
def _createTrackItem(self, **kwargs):
return control_track_item.ControlTrackEditorItem(
track=self.project.master_group.tracks[0],
player_state=self.player_state,
editor=self.editor,
**self.context_args,
context=self.context,
**kwargs)

@ -125,7 +125,7 @@ class SampleTrackToolBox(tools.ToolBox):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.addTool(EditSamplesTool(**self.context_args))
self.addTool(EditSamplesTool(context=self.context))
class SampleItem(object):

@ -30,12 +30,12 @@ class SampleTrackEditorItemTest(track_item_tests.TrackEditorItemTestMixin, uites
async def setup_testcase(self):
self.project.master_group.tracks.append(model.SampleTrack(obj_id='track-1'))
self.tool_box = sample_track_item.SampleTrackToolBox(**self.context_args)
self.tool_box = sample_track_item.SampleTrackToolBox(context=self.context)
def _createTrackItem(self, **kwargs):
return sample_track_item.SampleTrackEditorItem(
track=self.project.master_group.tracks[0],
player_state=self.player_state,
editor=self.editor,
**self.context_args,
context=self.context,
**kwargs)

@ -305,27 +305,27 @@ class ScoreToolBox(tools.ToolBox):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.addTool(base_track_item.ArrangeMeasuresTool(**self.context_args))
self.addTool(InsertNoteTool(type=tools.ToolType.NOTE_WHOLE, **self.context_args))
self.addTool(InsertNoteTool(type=tools.ToolType.NOTE_HALF, **self.context_args))
self.addTool(InsertNoteTool(type=tools.ToolType.NOTE_QUARTER, **self.context_args))
self.addTool(InsertNoteTool(type=tools.ToolType.NOTE_8TH, **self.context_args))
self.addTool(InsertNoteTool(type=tools.ToolType.NOTE_16TH, **self.context_args))
self.addTool(InsertNoteTool(type=tools.ToolType.NOTE_32TH, **self.context_args))
self.addTool(InsertNoteTool(type=tools.ToolType.REST_WHOLE, **self.context_args))
self.addTool(InsertNoteTool(type=tools.ToolType.REST_HALF, **self.context_args))
self.addTool(InsertNoteTool(type=tools.ToolType.REST_QUARTER, **self.context_args))
self.addTool(InsertNoteTool(type=tools.ToolType.REST_8TH, **self.context_args))
self.addTool(InsertNoteTool(type=tools.ToolType.REST_16TH, **self.context_args))
self.addTool(InsertNoteTool(type=tools.ToolType.REST_32TH, **self.context_args))
self.addTool(ModifyNoteTool(type=tools.ToolType.ACCIDENTAL_NATURAL, **self.context_args))
self.addTool(ModifyNoteTool(type=tools.ToolType.ACCIDENTAL_SHARP, **self.context_args))
self.addTool(ModifyNoteTool(type=tools.ToolType.ACCIDENTAL_FLAT, **self.context_args))
#self.addTool(ModifyNoteTool(type=tools.ToolType.ACCIDENTAL_DOUBLE_SHARP, **self.context_args))
#self.addTool(ModifyNoteTool(type=tools.ToolType.ACCIDENTAL_DOUBLE_FLAT, **self.context_args))
self.addTool(ModifyNoteTool(type=tools.ToolType.DURATION_DOT, **self.context_args))
self.addTool(ModifyNoteTool(type=tools.ToolType.DURATION_TRIPLET, **self.context_args))
self.addTool(ModifyNoteTool(type=tools.ToolType.DURATION_QUINTUPLET, **self.context_args))
self.addTool(base_track_item.ArrangeMeasuresTool(context=self.context))
self.addTool(InsertNoteTool(type=tools.ToolType.NOTE_WHOLE, context=self.context))
self.addTool(InsertNoteTool(type=tools.ToolType.NOTE_HALF, context=self.context))
self.addTool(InsertNoteTool(type=tools.ToolType.NOTE_QUARTER, context=self.context))
self.addTool(InsertNoteTool(type=tools.ToolType.NOTE_8TH, context=self.context))
self.addTool(InsertNoteTool(type=tools.ToolType.NOTE_16TH, context=self.context))
self.addTool(InsertNoteTool(type=tools.ToolType.NOTE_32TH, context=self.context))
self.addTool(InsertNoteTool(type=tools.ToolType.REST_WHOLE, context=self.context))
self.addTool(InsertNoteTool(type=tools.ToolType.REST_HALF, context=self.context))
self.addTool(InsertNoteTool(type=tools.ToolType.REST_QUARTER, context=self.context))
self.addTool(InsertNoteTool(type=tools.ToolType.REST_8TH, context=self.context))
self.addTool(InsertNoteTool(type=tools.ToolType.REST_16TH, context=self.context))
self.addTool(InsertNoteTool(type=tools.ToolType.REST_32TH, context=self.context))
self.addTool(ModifyNoteTool(type=tools.ToolType.ACCIDENTAL_NATURAL, context=self.context))
self.addTool(ModifyNoteTool(type=tools.ToolType.ACCIDENTAL_SHARP, context=self.context))
self.addTool(ModifyNoteTool(type=tools.ToolType.ACCIDENTAL_FLAT, context=self.context))
#self.addTool(ModifyNoteTool(type=tools.ToolType.ACCIDENTAL_DOUBLE_SHARP, context=self.context))
#self.addTool(ModifyNoteTool(type=tools.ToolType.ACCIDENTAL_DOUBLE_FLAT, context=self.context))
self.addTool(ModifyNoteTool(type=tools.ToolType.DURATION_DOT, context=self.context))
self.addTool(ModifyNoteTool(type=tools.ToolType.DURATION_TRIPLET, context=self.context))
self.addTool(ModifyNoteTool(type=tools.ToolType.DURATION_QUINTUPLET, context=self.context))
def keyPressEvent(self, target, evt):
if (not evt.isAutoRepeat()

@ -50,14 +50,14 @@ class ScoreTrackEditorItemTest(track_item_tests.TrackEditorItemTestMixin, uitest
mref.measure_id = m.id
self.project.master_group.tracks[0].measure_list.append(mref)
self.tool_box = score_track_item.ScoreToolBox(**self.context_args)
self.tool_box = score_track_item.ScoreToolBox(context=self.context)
def _createTrackItem(self, **kwargs):
return score_track_item.ScoreTrackEditorItem(
track=self.project.master_group.tracks[0],
player_state=self.player_state,
editor=self.editor,
**self.context_args,
context=self.context,
**kwargs)
@unittest.skip("Segfaults")

@ -240,7 +240,7 @@ class TrackEditorItemTestMixin(object):
async def setup_testcase(self):
self.project.master_group = model.MasterTrackGroup(obj_id='master')
self.player_state = project_view.PlayerState(**self.context_args)
self.player_state = project_view.PlayerState(context=self.context)
self.tool_box = None
self.editor = mock.Mock()
self.editor.currentToolBox.side_effect = lambda: self.tool_box

@ -202,7 +202,7 @@ class ScoreTrackProperties(TrackProperties):
async def onSelectInstrumentAsync(self):
dialog = instrument_library.InstrumentLibraryDialog(
**self.context_args, selectButton=True, parent=self)
context=self.context, selectButton=True, parent=self)
dialog.setWindowTitle(
"Select instrument for track '%s'" % self._track.name)
dialog.setModal(True)
@ -283,7 +283,7 @@ class BeatTrackProperties(TrackProperties):
async def onSelectInstrumentAsync(self):
dialog = instrument_library.InstrumentLibraryDialog(
**self.context_args, selectButton=True, parent=self)
context=self.context, selectButton=True, parent=self)
dialog.setWindowTitle(
"Select instrument for track '%s'" % self._track.name)
dialog.setModal(True)
@ -345,23 +345,23 @@ class TrackPropertiesDockWidget(ui_base.ProjectMixin, DockWidget):
elif isinstance(self._track, model.TrackGroup):
self.setWidget(TrackGroupProperties(
track=self._track, **self.context_args))
track=self._track, context=self.context))
elif isinstance(self._track, model.ScoreTrack):
self.setWidget(ScoreTrackProperties(
track=self._track, **self.context_args))
track=self._track, context=self.context))
elif isinstance(self._track, model.BeatTrack):
self.setWidget(BeatTrackProperties(
track=self._track, **self.context_args))
track=self._track, context=self.context))
elif isinstance(self._track, model.ControlTrack):
self.setWidget(ControlTrackProperties(
track=self._track, **self.context_args))
track=self._track, context=self.context))
elif isinstance(self._track, model.SampleTrack):
self.setWidget(SampleTrackProperties(
track=self._track, **self.context_args))
track=self._track, context=self.context))
else:
raise ValueError(type(self._track))

@ -475,7 +475,7 @@ class TracksDockWidget(ui_base.ProjectMixin, DockWidget):
self._tracks_list = TrackList(self)
self._tracks_list.currentIndexChanged.connect(self.onCurrentChanged)
self._model = TracksModel(**self.context_args)
self._model = TracksModel(context=self.context)
self._tracks_list.setModel(self._model)
buttons_layout = QtWidgets.QHBoxLayout(spacing=1)

@ -38,7 +38,7 @@ class TracksModelTest(uitest_utils.UITest):
self.project.master_group.name = 'master'
async def test_start_empty(self):
tracks_model = tracks_dock.TracksModel(**self.context_args)
tracks_model = tracks_dock.TracksModel(context=self.context)
try:
root_index = QtCore.QModelIndex()
self.assertEqual(tracks_model.rowCount(root_index), 1)
@ -119,7 +119,7 @@ class TracksModelTest(uitest_utils.UITest):
track3.name = 'track3'
grp1.tracks.append(track3)
tracks_model = tracks_dock.TracksModel(**self.context_args)
tracks_model = tracks_dock.TracksModel(context=self.context)
try:
root_index = QtCore.QModelIndex()
self.assertEqual(tracks_model.rowCount(root_index), 1)
@ -177,7 +177,7 @@ class TracksModelTest(uitest_utils.UITest):
track3.name = 'track3'
grp1.tracks.append(track3)
tracks_model = tracks_dock.TracksModel(**self.context_args)
tracks_model = tracks_dock.TracksModel(context=self.context)
try:
master_index = tracks_model.index(0)
grp1_index = tracks_model.index(1, parent=master_index)
@ -207,7 +207,7 @@ class TracksModelTest(uitest_utils.UITest):
track3.name = 'track3'
grp1.tracks.append(track3)
tracks_model = tracks_dock.TracksModel(**self.context_args)
tracks_model = tracks_dock.TracksModel(context=self.context)
try:
master_index = tracks_model.index(0)
grp1_index = tracks_model.index(1, parent=master_index)

@ -71,8 +71,8 @@ class CommonMixin(object):
super().__init__(**kwargs)
@property
def context_args(self):
return {'context': self._context}
def context(self) -> CommonContext:
return self._context
@property
def app(self):

@ -262,7 +262,6 @@ class UITest(unittest.AsyncTestCase):
self.session_data = {}
self.context = TestContext(testcase=self)
self.context_args = {'context': self.context}
self.commands = []
async def cleanup_testcase(self):

Loading…
Cancel
Save