Пример #1
0
    def __init__(self, parent=None):

        super().__init__()
        self.setupUi(self)


        # insert duration widget for time offset
        self.start_time = duration_widget.Duration_widget(0)
        self.horizontalLayout.insertWidget(1, self.start_time)
        self.end_time = duration_widget.Duration_widget(0)
        self.horizontalLayout_6.insertWidget(1, self.end_time)


        self.pbSelectAllSubjects.clicked.connect(lambda: self.subjects_button_clicked("select all"))
        self.pbUnselectAllSubjects.clicked.connect(lambda: self.subjects_button_clicked("unselect all"))
        self.pbReverseSubjectsSelection.clicked.connect(lambda: self.subjects_button_clicked("reverse selection"))

        self.pbSelectAllBehaviors.clicked.connect(lambda: self.behaviors_button_clicked("select all"))
        self.pbUnselectAllBehaviors.clicked.connect(lambda: self.behaviors_button_clicked("unselect all"))
        self.pbReverseBehaviorsSelection.clicked.connect(lambda: self.behaviors_button_clicked("reverse selection"))

        self.pbOK.clicked.connect(self.ok)
        self.pbCancel.clicked.connect(self.reject)

        self.lwBehaviors.itemClicked.connect(self.behavior_item_clicked)

        self.rb_full.clicked.connect(lambda: self.rb_time(TIME_FULL_OBS))
        self.rb_limit.clicked.connect(lambda: self.rb_time(TIME_EVENTS))
        self.rb_interval.clicked.connect(lambda: self.rb_time(TIME_ARBITRARY_INTERVAL))
Пример #2
0
    def __init__(self, time_format):
        super().__init__()
        hbox = QVBoxLayout(self)
        self.label = QLabel()
        self.label.setText("Go to time")
        hbox.addWidget(self.label)

        self.time_widget = duration_widget.Duration_widget()
        if time_format == HHMMSS:
            self.time_widget.set_format_hhmmss()
        if time_format == S:
            self.time_widget.set_format_s()

        hbox.addWidget(self.time_widget)

        self.pbOK = QPushButton("OK")
        self.pbOK.clicked.connect(self.accept)
        self.pbOK.setDefault(True)

        self.pbCancel = QPushButton("Cancel")
        self.pbCancel.clicked.connect(self.reject)

        self.hbox2 = QHBoxLayout(self)
        self.hbox2.addItem(QSpacerItem(241, 20, QSizePolicy.Expanding, QSizePolicy.Minimum))
        self.hbox2.addWidget(self.pbCancel)
        self.hbox2.addWidget(self.pbOK)
        hbox.addLayout(self.hbox2)
        self.setLayout(hbox)
        self.setWindowTitle("Time")
Пример #3
0
    def __init__(self,
                 log_level,
                 time_value=0,
                 current_time=0,
                 time_format=S,
                 show_set_current_time=False,
                 parent=None):

        super().__init__(parent)
        self.setupUi(self)
        self.time_value = time_value

        self.pb_set_to_current_time.setVisible(show_set_current_time)
        self.current_time = current_time

        self.dsbTime.setVisible(False)
        self.teTime.setVisible(False)

        self.time_widget = duration_widget.Duration_widget(self.time_value)
        if time_format == S:
            self.time_widget.set_format_s()
        if time_format == HHMMSS:
            self.time_widget.set_format_hhmmss()

        self.horizontalLayout_2.insertWidget(0, self.time_widget)

        self.pb_set_to_current_time.clicked.connect(self.set_to_current_time)
        self.pbOK.clicked.connect(self.accept)
        self.pbCancel.clicked.connect(self.reject)
Пример #4
0
    def __init__(self, tmp_dir, project_path="", converters={}, time_format=S, parent=None):
        """
        Args:
            tmp_dir (str): path of temporary directory
            project_path (str): path of project
            converters (dict): converters dictionary
        """

        super().__init__()

        self.tmp_dir = tmp_dir
        self.project_path = project_path
        self.converters = converters
        self.time_format = time_format
        self.observation_time_interval = [0, 0]

        self.setupUi(self)

        # insert duration widget for time offset
        self.obs_time_offset = duration_widget.Duration_widget(0)
        self.horizontalLayout_6.insertWidget(1, self.obs_time_offset)

        self.pbAddVideo.clicked.connect(lambda: self.add_media(flag_path=True))
        self.pb_add_media_without_path.clicked.connect(lambda: self.add_media(flag_path=False))
        self.pbRemoveVideo.clicked.connect(self.remove_media)
        self.pbAddMediaFromDir.clicked.connect(lambda: self.add_media_from_dir(flag_path=True))
        self.pb_add_all_media_from_dir_without_path.clicked.connect(lambda: self.add_media_from_dir(flag_path=False))

        self.pb_add_data_file.clicked.connect(lambda: self.add_data_file(flag_path=True))
        self.pb_add_data_file_wo_path.clicked.connect(lambda: self.add_data_file(flag_path=False))
        self.pb_remove_data_file.clicked.connect(self.remove_data_file)
        self.pb_view_data_head.clicked.connect(self.view_data_file_head)
        self.pb_plot_data.clicked.connect(self.plot_data_file)

        self.cbVisualizeSpectrogram.clicked.connect(self.extract_wav)
        self.cb_visualize_waveform.clicked.connect(self.extract_wav)
        self.cb_observation_time_interval.clicked.connect(self.limit_time_interval)

        self.pbSave.clicked.connect(self.pbSave_clicked)
        self.pbLaunch.clicked.connect(self.pbLaunch_clicked)
        self.pbCancel.clicked.connect(self.pbCancel_clicked)

        self.tw_data_files.cellDoubleClicked[int, int].connect(self.tw_data_files_cellDoubleClicked)

        self.mediaDurations, self.mediaFPS, self.mediaHasVideo, self.mediaHasAudio = {}, {}, {}, {}

        self.cbVisualizeSpectrogram.setEnabled(False)
        self.cb_visualize_waveform.setEnabled(False)
        self.cb_observation_time_interval.setEnabled(True)

        # disabled due to problem when video goes back
        self.cbCloseCurrentBehaviorsBetweenVideo.setChecked(False)
        self.cbCloseCurrentBehaviorsBetweenVideo.setEnabled(False)

        self.cb_start_from_current_time.stateChanged.connect(self.cb_start_from_current_time_changed)

        self.tabWidget.setCurrentIndex(0)