Example #1
0
class EditFunnelPlotForm(QDialog):
    def __init__(self, funnel_params, parent=None):
        super(EditFunnelPlotForm, self).__init__(parent)
        
        self.funnelpage = FunnelPage(old_funnel_params=funnel_params)
        self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
        
        
        self.buttonbox.accepted.connect(self.accept)
        self.buttonbox.rejected.connect(self.reject)
        
        self.ok_button= self.buttonbox.button(QDialogButtonBox.Ok)
        self.funnelpage.completeChanged.connect(self.setenable_OK)
        
        vlayout = QVBoxLayout()
        vlayout.addWidget(self.funnelpage)
        vlayout.addWidget(self.buttonbox)
        self.setLayout(vlayout)
        self.adjustSize()
        
    def setenable_OK(self):
        if self.funnelpage.isComplete():
            self.ok_button.setEnabled(True)
        else:
            self.ok_button.setEnabled(False)
            
    def get_params(self):
        return self.funnelpage.get_parameters()
Example #2
0
 def __init__(self, funnel_params, parent=None):
     super(EditFunnelPlotForm, self).__init__(parent)
     
     self.funnelpage = FunnelPage(old_funnel_params=funnel_params)
     self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
     
     
     self.buttonbox.accepted.connect(self.accept)
     self.buttonbox.rejected.connect(self.reject)
     
     self.ok_button= self.buttonbox.button(QDialogButtonBox.Ok)
     self.funnelpage.completeChanged.connect(self.setenable_OK)
     
     vlayout = QVBoxLayout()
     vlayout.addWidget(self.funnelpage)
     vlayout.addWidget(self.buttonbox)
     self.setLayout(vlayout)
     self.adjustSize()
    def __init__(self, model, meta_f_str=None, parent=None):
        AbstractPublicationBiasWizard.__init__(self, model=model, parent=parent)
    
        ##### Add custom pages ####
        # Effect Size Page
        self.choose_effect_size_page = ChooseEffectSizePage(
                                    add_generic_effect=True,
                                    data_type=self.last_analysis['data_type'],
                                    metric=self.last_analysis['metric'],
                                    var_groups = model.get_variable_groups())
        self.setPage(Page_ChooseEffectSize, self.choose_effect_size_page)

        # Methods and parameters apge
        self.methods_and_params_page_instance = MethodsAndParametersPage(
                    model=model, meta_f_str=meta_f_str,
                    disable_forest_plot_tab=True, funnel_mode=True)
        self.setPage(Page_MethodsAndParameters, self.methods_and_params_page_instance)
        
        # Funnel page
        self.funnel_params_page = FunnelPage(old_funnel_params=self.model.get_funnel_params())
        self.setPage(Page_FunnelParameters, self.funnel_params_page)
        
        
        self.setStartId(Page_ChooseEffectSize)
class FunnelWizard(AbstractPublicationBiasWizard):
    def __init__(self, model, meta_f_str=None, parent=None):
        AbstractPublicationBiasWizard.__init__(self, model=model, parent=parent)
    
        ##### Add custom pages ####
        # Effect Size Page
        self.choose_effect_size_page = ChooseEffectSizePage(
                                    add_generic_effect=True,
                                    data_type=self.last_analysis['data_type'],
                                    metric=self.last_analysis['metric'],
                                    var_groups = model.get_variable_groups())
        self.setPage(Page_ChooseEffectSize, self.choose_effect_size_page)

        # Methods and parameters apge
        self.methods_and_params_page_instance = MethodsAndParametersPage(
                    model=model, meta_f_str=meta_f_str,
                    disable_forest_plot_tab=True, funnel_mode=True)
        self.setPage(Page_MethodsAndParameters, self.methods_and_params_page_instance)
        
        # Funnel page
        self.funnel_params_page = FunnelPage(old_funnel_params=self.model.get_funnel_params())
        self.setPage(Page_FunnelParameters, self.funnel_params_page)
        
        
        self.setStartId(Page_ChooseEffectSize)

    def nextId(self):
        page_id = self.currentId()
        
        return self.next_id_helper(page_id)
        
    def next_id_helper(self, page_id):

        if page_id == Page_ChooseEffectSize:
            return Page_DataLocation
        elif page_id == Page_DataLocation:
            return Page_RefineStudies
        elif page_id == Page_RefineStudies:
            return Page_MethodsAndParameters
        elif page_id == Page_MethodsAndParameters:
            return Page_FunnelParameters
        elif page_id == Page_FunnelParameters:
            return Page_Summary
        elif page_id == Page_Summary:
            return -1
    
    ### Getters ####
    
    # Effect Size Page
    def get_data_type_and_metric(self):
        ''' returns tuple (data_type, metric) '''
        return self.choose_effect_size_page.get_data_type_and_metric()
    
    # Methods and parameters page
    def get_plot_params(self):
        return self.methods_and_params_page_instance.get_plot_params()
    def get_current_method(self):
        return self.methods_and_params_page_instance.get_current_method()
    def get_current_method_pretty_name(self):
        return self.methods_and_params_page_instance.get_current_method_pretty_name()
    def get_modified_meta_f_str(self):
        return self.methods_and_params_page_instance.get_modified_meta_f_str()
    
    # Funnel page
    def get_funnel_parameters(self):
        return self.funnel_params_page.get_parameters()
    
        # Summary Page
    def get_summary(self):
        ''' Make a summary string to show the user at the end of the wizard summarizing most of the user selections '''
        return wizard_summary(wizard=self, next_id_helper=self.next_id_helper,
                              summary_page_id=Page_Summary,
                              analysis_label="Funnelplot Analysis")