Ejemplo n.º 1
0
    def btnRUN_clicked(self, event):
        self.parent.temp_variables = {}
        if self.process_layout.count() == 1:
            warning_popup = popups.WarningPopup("No action to process.")
            warning_popup.exec_()
            return
        dir_path = self.path_entry.text()
        if dir_path == "":
            return
        # ファイルごとに回す
        spc_path_list = glob.glob("%s/**/*.spc"%dir_path, recursive=True)
        for spc_path in spc_path_list:

            # if spc_path.endswith("_FL_2.spc") or spc_path.endswith("_FL.spc"):
            #     pass
            # else:
            #     continue

            # 開いたファイルは、次のプロセスで受け取ることができる
            opened_window = None
            for idx in range(self.process_layout.count() - 1):
                QCoreApplication.processEvents()
                try:
                    opened_window, continue_process = self.process_layout.itemAt(idx).widget().procedure(spc_path, opened_window)
                except:
                    continue_process = traceback.format_exc()
                    break
                if continue_process == "continue":
                    pass    # 次のプロセスへ
                else:
                    break   # 現在のプロセスを中断
            else:
                continue    # ループ正常終了時 -> 次のファイルへ
            # ループ異常終了時
            if continue_process == "skip":
                continue    # 次のファイルへ
            else:
                break       # バッチそのものを終了
        # ループ正常終了時
        else:
            warning_popup = popups.WarningPopup("Successfully completed d(^^)b", icon=0)
            warning_popup.exec_()
            self.parent.temp_variables = {}
            return
        # ループ異常終了時
        warning_popup = popups.WarningPopup(continue_process + "\nProcess was canceled.")
        warning_popup.exec_()
        self.parent.temp_variables = {}
        return
Ejemplo n.º 2
0
 def jump_to_map_loc(self):
     cur_x = self.current_focused_window.spectrum_widget.cur_x
     cur_y = self.current_focused_window.spectrum_widget.cur_y
     size_setting_popup = popups.RangeSettingsPopupWithCkbx(
         initial_values=[cur_x, cur_y],
         labels=("x", "y"),
         title="set position",
         double=False,
         ckbx_messages=[" MAX INTENSITY", " propagate to all"])
     done = size_setting_popup.exec_()
     if not done:
         return
     if size_setting_popup.ckbxes[1].isChecked():
         window_list = self.get_windows(window_types=["ms"])
     else:
         window_list = [self.current_focused_window]
     for window in window_list:
         cur_image2d = window.map_widget.get_cur_image2d()
         if size_setting_popup.ckbxes[0].isChecked() == False:
             x = size_setting_popup.spbx_RS1.value()
             y = size_setting_popup.spbx_RS2.value()
             if (cur_image2d.shape[0] <= y) or (cur_image2d.shape[1] <= x):
                 warning_popup = popups.WarningPopup(
                     "The value exceeds the image size.")
                 warning_popup.exec_()
                 self.jump_to_map_loc(compatible_window_types=["ms"])
                 return
         # オート
         else:
             y, x = np.unravel_index(np.argmax(cur_image2d),
                                     cur_image2d.shape)
         window.spectrum_widget.replace_spectrum(x, y)
         window.map_widget.set_crosshair(x, y)
Ejemplo n.º 3
0
 def _wrapper(self, compatible_window_types, *args, **kwargs):
     if self.current_focused_window.window_type in compatible_window_types:
         func(self)
     else:
         warning_popup = popups.WarningPopup(
             "No window is opened or the window type is invalid!")
         warning_popup.exec_()
Ejemplo n.º 4
0
 def closeEvent1(self, event=None):
     bool_popup = popups.WarningPopup("Closing the window will stop the batch.\nDo you really want to close?", title="warning", p_type="Bool")
     done = bool_popup.exec_()
     if done == 0x00004000:      # Yes
         continue_process[0] = "Cell free position was not set."
         self.toolbar_layout.cfp_setting_popup.close()
         event.accept()
         loop.exit()
     elif done == 0x00010000:    # No
         event.ignore()
Ejemplo n.º 5
0
 def plugin_func(self, idx):
     newdict = dict(globals())
     newdict.update(locals())
     try:
         exec(self.plugin_func_list[idx], newdict, newdict)
     except:
         self.temp_variables = {}
         error_log = traceback.format_exc()
         warning_popup = popups.WarningPopup(error_log)
         warning_popup.exec_()