def add_heading_label(text, panel): # add heading label label = Label() label.Parent = panel label.Text = text label.AutoSize = True label.Font = HEADER_FONT label.Margin = Padding(0, 5, 0, 5)
def ShowDialog(self, controller, title, text, default_input, exp_index): # set controller self.controller = controller # set exp index self.exp_index = exp_index # initialize exp name variable self.exp_name = None # initialize invalid name label self.invalid_name_label = None # create the form self.dialog_window = Form() self.dialog_window.AutoSize = True self.dialog_window.Width = 400 self.dialog_window.MaximumSize = Size(400, 160) self.dialog_window.StartPosition = FormStartPosition.CenterScreen self.dialog_window.Text = title self.dialog_window.FormBorderStyle = FormBorderStyle.FixedSingle # create the main panel self.panel = FlowLayoutPanel() self.panel.Parent = self.dialog_window self.panel.BackColor = DIALOG_COLOR self.panel.Dock = DockStyle.Top self.panel.Padding = Padding(10, 10, 0, 10) self.panel.FlowDirection = FlowDirection.TopDown self.panel.WrapContents = False self.panel.AutoSize = True self.panel.Font = BODY_FONT # add the dialog text exp_name_label = Label() exp_name_label.Parent = self.panel exp_name_label.Text = text exp_name_label.Width = self.panel.Width exp_name_label.AutoSize = True exp_name_label.Margin = Padding(0, 5, 0, 0) # add the textbox self.exp_name_box = TextBox() self.exp_name_box.Text = default_input self.exp_name_box.Parent = self.panel self.exp_name_box.Width = self.panel.Width - 30 self.exp_name_box.AutoSize = True self.exp_name_box.BackColor = BUTTON_PANEL_COLOR self.exp_name_box.Font = Font(BODY_FONT.FontFamily, 9) # add save button panel self.add_save_button_panel() # show the dialog self.dialog_window.ShowDialog() # return the exp name return self.exp_name
def add_param_label(text, panel): # add param label label = Label() label.Parent = panel label.Text = text label.AutoSize = True label.Font = BODY_FONT label.Margin = Padding(0, 5, 0, 0) label.Width = panel.Width
def ShowDialog(self, controller, title, text): # set controller self.controller = controller # create confirmation boolean -- True means the user wants to save # the stimulus settings and stop the currently running stimulation. self.confirmation = False # create the form self.dialog_window = Form() self.dialog_window.AutoSize = True self.dialog_window.Width = 400 self.dialog_window.MaximumSize = Size(400, 225) self.dialog_window.StartPosition = FormStartPosition.CenterScreen self.dialog_window.Text = title self.dialog_window.FormBorderStyle = FormBorderStyle.FixedSingle # create the main panel self.panel = FlowLayoutPanel() self.panel.Parent = self.dialog_window self.panel.BackColor = DIALOG_COLOR self.panel.Dock = DockStyle.Top self.panel.Padding = Padding(10, 10, 0, 10) self.panel.FlowDirection = FlowDirection.TopDown self.panel.WrapContents = False self.panel.AutoSize = True self.panel.Font = BODY_FONT # add the dialog text dialog_label = Label() dialog_label.Parent = self.panel dialog_label.Text = text dialog_label.Width = self.panel.Width dialog_label.AutoSize = True dialog_label.Margin = Padding(0, 5, 0, 0) # add button panel self.add_button_panel() # show the dialog self.dialog_window.ShowDialog() # return the exp name return self.confirmation