#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 1.1.1 on Sun May 17 21:46:02 2026
#

import wx

# begin wxGlade: dependencies
import wx.adv
import wx.grid
import wx.propgrid
# end wxGlade

# begin wxGlade: extracode
import os
import wx.adv
from wx._adv import TBI_DOCK
from mvp.view.common.LogSearchBar import LogSearchBar
from mvp.view.common.PopupMenuButton import PopupMenuButton
from mvp.view.common.RunButton import RunButton
from mvp.view.common.McpDescEditor import McpDescEditor
from mvp.view.common.ToggleSwitch import ToggleSwitch
from mvp.view.common.HandyToolButton import HandyToolButton
# end wxGlade


class PETPView(wx.Frame):
				def __init__(self, *args, **kwds):
								# begin wxGlade: PETPView.__init__
								kwds["style"] = kwds.get("style", 0) | wx.BORDER_SIMPLE | wx.DEFAULT_FRAME_STYLE | wx.FULL_REPAINT_ON_RESIZE
								wx.Frame.__init__(self, *args, **kwds)
								self.SetSize((1700, 1000))
								self.SetTitle("PET-P")

								self.mainSplitterPanel = wx.SplitterWindow(self, wx.ID_ANY, style=wx.CLIP_CHILDREN | wx.SP_3D | wx.SP_BORDER)
								self.mainSplitterPanel.SetMinimumPaneSize(200)

								self.mainPanel = wx.Panel(self.mainSplitterPanel, wx.ID_ANY)

								mainSizer = wx.BoxSizer(wx.VERTICAL)

								self.notebook = wx.Notebook(self.mainPanel, wx.ID_ANY)
								mainSizer.Add(self.notebook, 1, wx.EXPAND, 0)

								self.nbFirstPage = wx.Panel(self.notebook, wx.ID_ANY, style=wx.BORDER_NONE | wx.TAB_TRAVERSAL)
								self.notebook.AddPage(self.nbFirstPage, "Executions")

								e_main_Sizer = wx.BoxSizer(wx.VERTICAL)

								self.splitterLR4E = wx.SplitterWindow(self.nbFirstPage, wx.ID_ANY, style=wx.SP_3D | wx.SP_BORDER)
								self.splitterLR4E.SetMinimumPaneSize(200)
								e_main_Sizer.Add(self.splitterLR4E, 1, wx.EXPAND, 0)

								self.e_left_panel = wx.SplitterWindow(self.splitterLR4E, wx.ID_ANY, style=wx.SP_3D | wx.SP_BORDER)
								self.e_left_panel.SetMinimumPaneSize(80)

								self.task_editor = wx.Panel(self.e_left_panel, wx.ID_ANY, style=wx.BORDER_THEME)

								task_editor_sizer = wx.BoxSizer(wx.VERTICAL)

								task_editor_action_sizer = wx.BoxSizer(wx.HORIZONTAL)
								task_editor_sizer.Add(task_editor_action_sizer, 0, wx.ALL | wx.EXPAND, 0)

								self.addRow4E = wx.Button(self.task_editor, wx.ID_ANY, "+")
								self.addRow4E.SetMinSize((30, 28))
								self.addRow4E.SetToolTip("Add new row")
								task_editor_action_sizer.Add(self.addRow4E, 0, 0, 0)

								task_editor_action_sizer.Add((5, 30), 0, 0, 0)

								self.delRow4E = wx.Button(self.task_editor, wx.ID_ANY, "-")
								self.delRow4E.SetMinSize((30, 28))
								self.delRow4E.SetToolTip("delete selected row(s)")
								task_editor_action_sizer.Add(self.delRow4E, 0, 0, 0)

								self.recordingLocation = wx.StaticText(self.task_editor, wx.ID_ANY, "")
								task_editor_action_sizer.Add(self.recordingLocation, 0, wx.ALL, 5)

								task_editor_action_sizer.Add((30, 30), 1, wx.ALL, 0)

								self.selectRecording = wx.Button(self.task_editor, wx.ID_ANY, "Select")
								self.selectRecording.SetMinSize((75, 28))
								self.selectRecording.SetToolTip("Select the recording file which generated by Selenium IDE.")
								task_editor_action_sizer.Add(self.selectRecording, 0, 0, 0)

								task_editor_action_sizer.Add((5, 30), 0, 0, 0)

								self.loadRecording = wx.Button(self.task_editor, wx.ID_ANY, "Convert")
								self.loadRecording.SetMinSize((75, 28))
								self.loadRecording.SetToolTip("Convert recording into PETP Task(s)")
								task_editor_action_sizer.Add(self.loadRecording, 0, 0, 0)

								self.taskGrid = wx.grid.Grid(self.task_editor, wx.ID_ANY)
								self.taskGrid.CreateGrid(3, 2)
								self.taskGrid.EnableDragGridSize(0)
								self.taskGrid.SetColLabelValue(0, "Task Chooser")
								self.taskGrid.SetColSize(0, 400)
								self.taskGrid.SetColLabelValue(1, "Description")
								self.taskGrid.SetColSize(1, 800)
								task_editor_sizer.Add(self.taskGrid, 1, wx.EXPAND, 0)

								self.loop_editor = wx.Panel(self.e_left_panel, wx.ID_ANY, style=wx.BORDER_THEME)

								loop_editor_sizer = wx.BoxSizer(wx.VERTICAL)

								loop_editor_action_sizer = wx.BoxSizer(wx.HORIZONTAL)
								loop_editor_sizer.Add(loop_editor_action_sizer, 0, wx.ALL | wx.EXPAND, 0)

								self.addLoop = wx.Button(self.loop_editor, wx.ID_ANY, "+")
								self.addLoop.SetMinSize((30, 28))
								self.addLoop.SetToolTip("Add property")
								loop_editor_action_sizer.Add(self.addLoop, 0, 0, 0)

								loop_editor_action_sizer.Add((5, 30), 0, 0, 0)

								self.delLoop = wx.Button(self.loop_editor, wx.ID_ANY, "-")
								self.delLoop.SetMinSize((30, 28))
								self.delLoop.SetToolTip("delete selected property")
								loop_editor_action_sizer.Add(self.delLoop, 0, 0, 0)

								loop_editor_action_sizer.Add((5, 30), 0, 0, 0)

								self.editLoop = wx.Button(self.loop_editor, wx.ID_ANY, "#")
								self.editLoop.SetMinSize((30, 28))
								self.editLoop.SetToolTip("Edit selected loop")
								loop_editor_action_sizer.Add(self.editLoop, 0, 0, 0)

								self.loopProperty = wx.propgrid.PropertyGridManager(self.loop_editor, wx.ID_ANY, style=wx.propgrid.PG_BOLD_MODIFIED | wx.propgrid.PG_HIDE_MARGIN | wx.propgrid.PG_NO_INTERNAL_BORDER)
								loop_editor_sizer.Add(self.loopProperty, 0, wx.EXPAND, 0)

								self.e_right_panel = wx.SplitterWindow(self.splitterLR4E, wx.ID_ANY)
								self.e_right_panel.SetMinimumPaneSize(80)

								self.input_editor_panel = wx.Panel(self.e_right_panel, wx.ID_ANY)

								input_editor_sizer = wx.BoxSizer(wx.VERTICAL)

								input_editor_action_sizer = wx.BoxSizer(wx.HORIZONTAL)
								input_editor_sizer.Add(input_editor_action_sizer, 0, wx.ALL | wx.EXPAND, 0)

								input_editor_action_sizer.Add((5, 30), 0, 0, 0)

								self.cb_skipped = wx.CheckBox(self.input_editor_panel, wx.ID_ANY, "")
								self.cb_skipped.SetToolTip("check to skip current task")
								input_editor_action_sizer.Add(self.cb_skipped, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 0)

								input_editor_action_sizer.Add((5, 30), 0, 0, 0)

								self.availableProperties = wx.ComboBox(self.input_editor_panel, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)
								self.availableProperties.SetMinSize((100, -1))
								self.availableProperties.SetToolTip("Available Properties")
								input_editor_action_sizer.Add(self.availableProperties, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 1)

								input_editor_action_sizer.Add((5, 30), 0, 0, 0)

								self.addProperty = wx.Button(self.input_editor_panel, wx.ID_ANY, "+")
								self.addProperty.SetMinSize((30, 28))
								self.addProperty.SetToolTip("Add propery")
								input_editor_action_sizer.Add(self.addProperty, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 0)

								input_editor_action_sizer.Add((5, 30), 0, 0, 0)

								self.delProperty = wx.Button(self.input_editor_panel, wx.ID_ANY, "-")
								self.delProperty.SetMinSize((30, 28))
								self.delProperty.SetToolTip("delete selected property")
								input_editor_action_sizer.Add(self.delProperty, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 0)

								input_editor_action_sizer.Add((5, 30), 0, 0, 0)

								self.handy_tools = HandyToolButton(self.input_editor_panel)
								self.handy_tools.SetMinSize((40, 28))
								input_editor_action_sizer.Add(self.handy_tools, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 0)

								input_editor_action_sizer.Add((10, 30), 1, wx.ALL, 0)

								self.datepicker = wx.adv.DatePickerCtrl(self.input_editor_panel, wx.ID_ANY, style=wx.adv.DP_DEFAULT | wx.adv.DP_DROPDOWN | wx.adv.DP_SHOWCENTURY)
								self.datepicker.SetToolTip("Fill date to selected property")
								input_editor_action_sizer.Add(self.datepicker, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 1)

								input_editor_action_sizer.Add((5, 30), 0, 0, 0)

								self.taskProperty = wx.propgrid.PropertyGridManager(self.input_editor_panel, wx.ID_ANY, style=wx.propgrid.PG_BOLD_MODIFIED | wx.propgrid.PG_HIDE_MARGIN | wx.propgrid.PG_NO_INTERNAL_BORDER)
								input_editor_sizer.Add(self.taskProperty, 1, wx.EXPAND, 0)

								self.execution_desc_panel = wx.Panel(self.e_right_panel, wx.ID_ANY, style=wx.BORDER_SIMPLE | wx.TAB_TRAVERSAL)

								execution_desc_sizer = wx.BoxSizer(wx.VERTICAL)

								self.cb_astool = ToggleSwitch(self.execution_desc_panel, wx.ID_ANY)
								self.cb_astool.SetMinSize((-1, 28))
								self.cb_astool.SetToolTip("Check to make current Execution as PETP MCP tool ")
								execution_desc_sizer.Add(self.cb_astool, 0, wx.EXPAND, 0)

								self.execution_desc = McpDescEditor(self.execution_desc_panel, wx.ID_ANY)
								execution_desc_sizer.Add(self.execution_desc, 1, wx.EXPAND, 0)

								actionPanelSizer_e = wx.WrapSizer(wx.HORIZONTAL)
								e_main_Sizer.Add(actionPanelSizer_e, 0, wx.EXPAND, 0)

								self.delExecution = wx.Button(self.nbFirstPage, wx.ID_ANY, "-")
								self.delExecution.SetMinSize((30, 28))
								self.delExecution.SetToolTip("Delete selected Execution")
								actionPanelSizer_e.Add(self.delExecution, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								actionPanelSizer_e.Add((5, 30), 0, 0, 0)

								self.copyExecution = wx.Button(self.nbFirstPage, wx.ID_ANY, "C")
								self.copyExecution.SetMinSize((30, 28))
								self.copyExecution.SetToolTip("Copy current Execution")
								actionPanelSizer_e.Add(self.copyExecution, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								actionPanelSizer_e.Add((5, 30), 0, 0, 0)

								self.addExecution = wx.Button(self.nbFirstPage, wx.ID_ANY, "+")
								self.addExecution.SetMinSize((30, 28))
								self.addExecution.SetToolTip("Create Execution")
								actionPanelSizer_e.Add(self.addExecution, 0, 0, 0)

								actionPanelSizer_e.Add((5, 30), 0, 0, 0)

								self.executionChooser = wx.TextCtrl(self.nbFirstPage, wx.ID_ANY, "", style=wx.TE_READONLY)
								self.executionChooser.SetMinSize((500, -1))
								actionPanelSizer_e.Add(self.executionChooser, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								actionPanelSizer_e.Add((5, 30), 0, 0, 0)

								self.only_tool = ToggleSwitch(self.nbFirstPage, wx.ID_ANY)
								self.only_tool.SetMinSize((70, 30))
								self.only_tool.SetToolTip("Check to show only tools in the Execution dropdown list ")
								actionPanelSizer_e.Add(self.only_tool, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								actionPanelSizer_e.Add((5, 30), 0, 0, 0)

								self.runExecution = RunButton(self.nbFirstPage)
								self.runExecution.SetMinSize((100, 28))
								actionPanelSizer_e.Add(self.runExecution, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								actionPanelSizer_e.Add((5, 30), 0, 0, 0)

								self.stopExection = wx.Button(self.nbFirstPage, wx.ID_ANY, "Stop")
								self.stopExection.SetMinSize((75, 28))
								actionPanelSizer_e.Add(self.stopExection, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								actionPanelSizer_e.Add((5, 30), 0, 0, 0)

								self.snapshots = wx.Button(self.nbFirstPage, wx.ID_ANY, "Snapshots")
								self.snapshots.SetMinSize((75, 28))
								self.snapshots.SetToolTip("look for  editing snapshots")
								actionPanelSizer_e.Add(self.snapshots, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								actionPanelSizer_e.Add((5, 30), 0, 0, 0)

								self.saveExection = wx.Button(self.nbFirstPage, wx.ID_ANY, "Save")
								self.saveExection.SetMinSize((75, 28))
								self.saveExection.SetToolTip("Save or Update selected Execution")
								actionPanelSizer_e.Add(self.saveExection, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								actionPanelSizer_e.Add((5, 30), 0, 0, 0)

								self.checkbox_executeonstartup = wx.CheckBox(self.nbFirstPage, wx.ID_ANY, "")
								self.checkbox_executeonstartup.SetToolTip("Execute on startup")
								actionPanelSizer_e.Add(self.checkbox_executeonstartup, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								actionPanelSizer_e.Add((5, 30), 1, wx.EXPAND, 0)

								self.themeChooser = PopupMenuButton(self.nbFirstPage, choices=["Forest", "Ocean", "Monokai", "Solarized", "Nord", "Dracula", "Sakura", "Cyberpunk"], default="Forest", min_width=90, variant="button")
								actionPanelSizer_e.Add(self.themeChooser, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								actionPanelSizer_e.Add((5, 30), 0, 0, 0)

								self.langChooser = PopupMenuButton(self.nbFirstPage, choices=["EN", "中文"], default="EN", min_width=50, variant='button')
								actionPanelSizer_e.Add(self.langChooser, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								self.nbSecondPage = wx.Panel(self.notebook, wx.ID_ANY)
								self.notebook.AddPage(self.nbSecondPage, "Pipelines")

								p_main_Sizer = wx.BoxSizer(wx.VERTICAL)

								piplineActionPanelTopSizer = wx.BoxSizer(wx.HORIZONTAL)
								p_main_Sizer.Add(piplineActionPanelTopSizer, 0, wx.ALL, 0)

								piplineActionPanelTopSizer.Add((3, 30), 0, 0, 0)

								self.addRow4P = wx.Button(self.nbSecondPage, wx.ID_ANY, "+")
								self.addRow4P.SetMinSize((30, 28))
								self.addRow4P.SetToolTip("Add row")
								piplineActionPanelTopSizer.Add(self.addRow4P, 0, 0, 0)

								piplineActionPanelTopSizer.Add((10, 30), 0, 0, 0)

								self.delRow4P = wx.Button(self.nbSecondPage, wx.ID_ANY, "-")
								self.delRow4P.SetMinSize((30, 28))
								self.delRow4P.SetToolTip("Delete selected row(s)")
								piplineActionPanelTopSizer.Add(self.delRow4P, 0, 0, 0)

								self.executionGrid = wx.grid.Grid(self.nbSecondPage, wx.ID_ANY)
								self.executionGrid.CreateGrid(8, 2)
								self.executionGrid.SetColLabelValue(0, "Execution Chooser")
								self.executionGrid.SetColSize(0, 400)
								self.executionGrid.SetColLabelValue(1, "Input")
								self.executionGrid.SetColSize(1, 800)
								p_main_Sizer.Add(self.executionGrid, 1, wx.EXPAND, 0)

								actionPanelSizer_p = wx.WrapSizer(wx.HORIZONTAL)
								p_main_Sizer.Add(actionPanelSizer_p, 0, wx.EXPAND, 0)

								self.delPipeline = wx.Button(self.nbSecondPage, wx.ID_ANY, "Delete")
								self.delPipeline.SetMinSize((80, 28))
								self.delPipeline.SetToolTip("Delete selected Pipeline")
								actionPanelSizer_p.Add(self.delPipeline, 0, 0, 0)

								actionPanelSizer_p.Add((5, 30), 0, 0, 0)

								self.pipelineChooser = wx.TextCtrl(self.nbSecondPage, wx.ID_ANY, "", style=wx.TE_READONLY)
								self.pipelineChooser.SetMinSize((500, -1))
								actionPanelSizer_p.Add(self.pipelineChooser, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								actionPanelSizer_p.Add((5, 30), 0, 0, 0)

								self.runPipeline = RunButton(self.nbSecondPage)
								self.runPipeline.SetMinSize((100, 28))
								actionPanelSizer_p.Add(self.runPipeline, 0, 0, 0)

								actionPanelSizer_p.Add((5, 30), 0, 0, 0)

								self.asCronChecbox = wx.CheckBox(self.nbSecondPage, wx.ID_ANY, "as cron", style=wx.ALIGN_RIGHT | wx.CHK_2STATE)
								actionPanelSizer_p.Add(self.asCronChecbox, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								actionPanelSizer_p.Add((5, 30), 0, 0, 0)

								self.cronInput = wx.TextCtrl(self.nbSecondPage, wx.ID_ANY, "0 * * * *", style=wx.TE_CENTRE)
								self.cronInput.SetMinSize((100, -1))
								self.cronInput.Enable(False)
								actionPanelSizer_p.Add(self.cronInput, 0, wx.ALIGN_CENTER_VERTICAL, 0)

								actionPanelSizer_p.Add((5, 30), 0, 0, 0)

								self.cronDashboardBtn = wx.Button(self.nbSecondPage, wx.ID_ANY, "History")
								self.cronDashboardBtn.SetMinSize((75, 28))
								self.cronDashboardBtn.SetToolTip("View cron execution history")
								actionPanelSizer_p.Add(self.cronDashboardBtn, 0, 0, 0)

								actionPanelSizer_p.Add((5, 30), 0, 0, 0)

								self.stopCurrentCron = wx.Button(self.nbSecondPage, wx.ID_ANY, "Stop")
								self.stopCurrentCron.SetMinSize((100, 28))
								self.stopCurrentCron.SetToolTip("Stop selected Pipeline which is running as cron")
								actionPanelSizer_p.Add(self.stopCurrentCron, 0, 0, 0)

								actionPanelSizer_p.Add((5, 30), 0, 0, 0)

								self.stopAll = wx.Button(self.nbSecondPage, wx.ID_ANY, "Stop All")
								self.stopAll.SetMinSize((100, 28))
								self.stopAll.SetToolTip("Stop all pipelines running as cron.")
								actionPanelSizer_p.Add(self.stopAll, 0, 0, 0)

								actionPanelSizer_p.Add((5, 30), 0, 0, 0)

								self.savePipeline = wx.Button(self.nbSecondPage, wx.ID_ANY, "Save")
								self.savePipeline.SetMinSize((75, 28))
								self.savePipeline.SetToolTip("Save or Update selected Pipeline")
								actionPanelSizer_p.Add(self.savePipeline, 0, 0, 0)

								self.logPanel = wx.Panel(self.mainSplitterPanel, wx.ID_ANY)
								self.logPanel.SetBackgroundColour(wx.Colour(78, 78, 78))

								logPanelSizer = wx.BoxSizer(wx.VERTICAL)

								logSearchSizer = wx.BoxSizer(wx.HORIZONTAL)
								logPanelSizer.Add(logSearchSizer, 0, wx.EXPAND, 0)

								logSearchSizer.Add((5, 20), 0, wx.ALIGN_CENTER_VERTICAL, 0)

								self.highlightInfo = wx.StaticText(self.logPanel, wx.ID_ANY, "")
								self.highlightInfo.SetForegroundColour(wx.Colour(245, 222, 179))
								logSearchSizer.Add(self.highlightInfo, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 6)

								logSearchSizer.Add((30, 30), 1, wx.ALL, 0)

								self.logSearchBar = LogSearchBar(self.logPanel)
								logSearchSizer.Add(self.logSearchBar, 0, wx.EXPAND, 0)

								self.logContents = wx.TextCtrl(self.logPanel, wx.ID_ANY, "", style=wx.BORDER_NONE | wx.TE_DONTWRAP | wx.TE_LEFT | wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH2)
								self.logContents.SetBackgroundColour(wx.Colour(78, 78, 78))
								self.logContents.SetForegroundColour(wx.Colour(0, 255, 0))
								logPanelSizer.Add(self.logContents, 1, wx.EXPAND, 0)

								self.logPanel.SetSizer(logPanelSizer)

								self.nbSecondPage.SetSizer(p_main_Sizer)

								self.execution_desc_panel.SetSizer(execution_desc_sizer)

								self.input_editor_panel.SetSizer(input_editor_sizer)

								self.e_right_panel.SplitHorizontally(self.input_editor_panel, self.execution_desc_panel, 0)

								self.loop_editor.SetSizer(loop_editor_sizer)

								self.task_editor.SetSizer(task_editor_sizer)

								self.e_left_panel.SplitHorizontally(self.task_editor, self.loop_editor, -100)

								self.splitterLR4E.SplitVertically(self.e_left_panel, self.e_right_panel, 800)

								self.nbFirstPage.SetSizer(e_main_Sizer)

								self.mainPanel.SetSizer(mainSizer)

								self.mainSplitterPanel.SplitHorizontally(self.mainPanel, self.logPanel, 480)

								self.Layout()
								self.Centre()
								_icon = wx.NullIcon
								_logo_path = os.path.realpath('image') + "/petp.png"
								_icon.CopyFromBitmap(wx.Bitmap(_logo_path , wx.BITMAP_TYPE_ANY))
								self.SetIcon(_icon)

								_tbiIcon = wx.adv.TaskBarIcon(iconType=TBI_DOCK)
								_tbiIcon.frame=self
								_tbiIcon.SetIcon(_icon, "PETP")

								self.tbicon = _tbiIcon

								# end wxGlade

# end of class PETPView

class PETP(wx.App):
				def OnInit(self):
								self.PETP = PETPView(None, wx.ID_ANY, "")
								self.SetTopWindow(self.PETP)
								self.PETP.Show()
								return True

# end of class PETP

if __name__ == "__main__":
				PETP = PETP(0)
				PETP.MainLoop()
