Exemplo n.º 1
0
	def __get_display_preference_params(self):
		HOMEDB.open_dict("display_preferences")
		db = HOMEDB.display_preferences
		p2d_auto_contrast = ParamDef(name="display_2d_auto_contrast",vartype="boolean",desc_short="2D image auto contrast",desc_long="Should the 2D image display module adjust contrast settings automatically?",property=None,defaultunits=db.get("display_2d_auto_contrast",dfl=True),choices=None)
		p2d_stack_auto_contrast = ParamDef(name="display_stack_auto_contrast",vartype="boolean",desc_short="Stack (2D) - auto contrast",desc_long="Should the stack display module adjust contrast settings automatically?",property=None,defaultunits=db.get("display_stack_auto_contrast",dfl=True),choices=None)
		p2d_stack_n = ParamDef(name="display_stack_np_for_auto",vartype="int",desc_short="Stack (2D) - # particles used for contrast settings",desc_long="When the stack viewer starts up it investigates the parameters of the first n particles to determine contrast settings. Specify -1 to force the stack viewer to investigate all particles.",property=None,defaultunits=db.get("display_stack_np_for_auto",dfl=5),choices=None)

		params = []
		params.append(p2d_auto_contrast)
		params.append(p2d_stack_auto_contrast)
		params.append(p2d_stack_n)
		
		self.__display_entries = ["display_2d_auto_contrast","display_stack_auto_contrast","display_stack_np_for_auto"]
		
		return params
Exemplo n.º 2
0
	def __get_tomoboxer_preference_params(self):
		HOMEDB.open_dict("e2tomoboxer_preferences")
		db = HOMEDB.e2tomoboxer_preferences
		plargest_dim = ParamDef(name="largest_allowable_dimension",vartype="int",desc_short="Shrink to this",desc_long="The largest permissible image dimension of a tomogram after shrinking",property=None,defaultunits=db.get("largest_allowable_dimension",dfl=1024),choices=None)

		params = []
		params.append(plargest_dim)
		
		self.__tomoboxer_entries = ["largest_allowable_dimension"]
		return params
Exemplo n.º 3
0
    def get_history_table(self):
        from eman2_gui.emdatastorage import ParamDef
        try:
            import EMAN2db
            db = EMAN2db.EMAN2DB.open_db()
            db.open_dict("history")
        except:
            db = None

        params = []

        try:
            n = int(db.history["count"])
        except:
            n = 0

        if db == None or n == 0:
            params.append(
                ParamDef(name="blurb",
                         vartype="text",
                         desc_short="",
                         desc_long="",
                         property=None,
                         defaultunits=
                         "There appears to be no history in this directory",
                         choices=None))
        else:
            from eman2_gui.emform import EMParamTable
            start = []
            duration = []
            prgargs = []
            cmd = []
            full_cmd = []

            params.append(
                ParamDef(
                    name="blurb",
                    vartype="text",
                    desc_short="",
                    desc_long="",
                    property=None,
                    defaultunits=
                    "Use this form to examine the EMAN2 commands that have occurred in this directory.",
                    choices=None))
            p = EMParamTable(name="commands",
                             desc_short="Historical table of EMAN2 commands",
                             desc_long="")

            for i in range(n):
                try:
                    h = db.history[i + 1]
                except:
                    continue

                if h != None and "path" in h and h["path"] == self.wd:
                    start.append(local_datetime(h["start"]))
                    if "end" in h:
                        duration.append(time_diff(h["end"] - h["start"]))
                    else:
                        if "progress" in h:
                            try:
                                duration.append(
                                    str(int(h["progress"] * 100)) + "%")
                            except:
                                duration.append("incomplete")
                        else:
                            duration.append("incomplete")

                    args = h["args"]
                    if len(args) > 0:
                        cmd.append(base_name(args[0]))
                        full_cmd.append(args[0])
                        if len(args) > 1:
                            prgargs.append(" ".join(args[1:]))
                        else:
                            prgargs.append("")
                    else:
                        cmd.append("")
                        full_cmd.append("")
                        prgargs.append("")

            pcmd = ParamDef(
                name="cmd",
                vartype="stringlist",
                desc_short="Program",
                desc_long=
                "A shortened version of the name of a Python program that was executed",
                property=None,
                defaultunits=None,
                choices=cmd)
            pstart = ParamDef(
                name="start",
                vartype="stringlist",
                desc_short="Start time",
                desc_long="The time when the command was first executed",
                property=None,
                defaultunits=None,
                choices=start)
            pduration = ParamDef(
                name="duration",
                vartype="stringlist",
                desc_short="Duration",
                desc_long="The time taken to execute this command",
                property=None,
                defaultunits=None,
                choices=duration)
            pfull_cmd = ParamDef(name="fullcmd",
                                 vartype="stringlist",
                                 desc_short="File path",
                                 desc_long="The location of program on disk",
                                 property=None,
                                 defaultunits=None,
                                 choices=full_cmd)
            pargs = ParamDef(
                name="args",
                vartype="stringlist",
                desc_short="Arguments",
                desc_long="The arguments that were given to the program",
                property=None,
                defaultunits=None,
                choices=prgargs)

            p.append(pcmd)
            p.append(pstart)
            p.append(pduration)
            p.append(pargs)
            p.append(pfull_cmd)
            params.append(p)

        return params