paleo_view_v1_2.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:PaleoView 作者: GlobalEcologyLab 项目源码 文件源码
def restrictTimeUnit(self) :

        # Initialise allowed time units
        allowed_time_units = self.time_unit_selection[:]

        # Resolve any restrictions based on data type
        data_type = self.data_type_text.get()
        if self.time_unit_restricted_via_data_type.has_key(data_type) :
            allowed_time_units = self.time_unit_restricted_via_data_type[data_type][:]

        # Resolve any restrictions based on parameter
        group_code = self.parameter_group_selection_map[self.parameter_group_text.get()]
        if self.time_unit_restricted_via_parameter.has_key(group_code) :
            parameter_code = self.parameter_via_group_selection_map[group_code][self.parameter_via_group_text[group_code].get()]
            if self.time_unit_restricted_via_parameter[group_code].has_key(parameter_code) :
                for time_unit in allowed_time_units[:] :
                    if time_unit not in self.time_unit_restricted_via_parameter[group_code][parameter_code] :
                        allowed_time_units.remove(time_unit)

        # Enable/disable time unit selections appropriately
        for i, selection in enumerate(self.time_unit_selection) :
            if selection in allowed_time_units :
                self.time_unit_menu['menu'].entryconfigure(i, state=tk.NORMAL)
            else :
                self.time_unit_menu['menu'].entryconfigure(i, state=tk.DISABLED)

        # Select another time unit if the current selection is not allowed
        if self.time_unit_text.get() not in allowed_time_units :
            self.selectTimeUnit(allowed_time_units[0])

    # Step 2 Method: Select Time Unit: the user selects an option
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号