kopia lustrzana https://github.com/corrscope/corrscope
Reorganize channel selection range code
rodzic
5d54f0ef3a
commit
cf151f7172
|
@ -7,7 +7,6 @@ from typing import List, Any
|
|||
import PyQt5.QtCore as qc
|
||||
import PyQt5.QtWidgets as qw
|
||||
import attr
|
||||
import more_itertools
|
||||
from PyQt5 import uic
|
||||
from PyQt5.QtCore import QModelIndex, Qt
|
||||
from PyQt5.QtGui import QKeySequence
|
||||
|
@ -17,7 +16,7 @@ from ovgenpy import cli
|
|||
from ovgenpy.channel import ChannelConfig
|
||||
from ovgenpy.config import OvgenError, copy_config, yaml
|
||||
from ovgenpy.gui.data_bind import PresentationModel, map_gui, behead, rgetattr, rsetattr
|
||||
from ovgenpy.gui.util import color2hex, Locked, get_save_with_ext
|
||||
from ovgenpy.gui.util import color2hex, Locked, get_save_with_ext, find_ranges
|
||||
from ovgenpy.outputs import IOutputConfig, FFplayOutputConfig, FFmpegOutputConfig
|
||||
from ovgenpy.ovgenpy import Ovgen, Config, Arguments, default_config
|
||||
from ovgenpy.triggers import CorrelationTriggerConfig, ITriggerConfig
|
||||
|
@ -424,20 +423,6 @@ class ChannelTableView(qw.QTableView):
|
|||
return rows
|
||||
|
||||
|
||||
T = TypeVar('T')
|
||||
|
||||
|
||||
def find_ranges(iterable: Iterable[T]) -> Iterable[Tuple[T, int]]:
|
||||
"""Extracts consecutive runs from a list of items.
|
||||
|
||||
:param iterable: List of items.
|
||||
:return: Iterable of (first elem, length).
|
||||
"""
|
||||
for group in more_itertools.consecutive_groups(iterable):
|
||||
group = list(group)
|
||||
yield group[0], len(group)
|
||||
|
||||
|
||||
@attr.dataclass
|
||||
class Column:
|
||||
key: str
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
from pathlib import Path
|
||||
from typing import *
|
||||
from typing import Iterable, Tuple
|
||||
|
||||
import matplotlib.colors
|
||||
import more_itertools
|
||||
from PyQt5.QtCore import QMutex
|
||||
from PyQt5.QtWidgets import QWidget, QFileDialog
|
||||
|
||||
|
@ -18,7 +20,6 @@ def color2hex(color):
|
|||
f'doubly invalid color {color}, raises {e} (report bug!)')
|
||||
|
||||
|
||||
|
||||
T = TypeVar('T')
|
||||
|
||||
|
||||
|
@ -70,3 +71,13 @@ def get_save_with_ext(
|
|||
path = path.with_suffix(default_suffix)
|
||||
return path
|
||||
|
||||
|
||||
def find_ranges(iterable: Iterable[T]) -> Iterable[Tuple[T, int]]:
|
||||
"""Extracts consecutive runs from a list of items.
|
||||
|
||||
:param iterable: List of items.
|
||||
:return: Iterable of (first elem, length).
|
||||
"""
|
||||
for group in more_itertools.consecutive_groups(iterable):
|
||||
group = list(group)
|
||||
yield group[0], len(group)
|
||||
|
|
Ładowanie…
Reference in New Issue