def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_POTENSI_EKONOMI, name=u'potensi_ekonomi', parent=prnt, pos=wx.Point(457, 184), size=wx.Size(784, 445), style=wx.DEFAULT_FRAME_STYLE, title=u'Potensi Ekonomi Sosial Budaya') self.SetClientSize(wx.Size(784, 445)) self.Center(wx.BOTH) self.tambak = wx.ListCtrl(id=wxID_POTENSI_EKONOMITAMBAK, name=u'tambak', parent=self, pos=wx.Point(8, 8), size=wx.Size(768, 208), style=wx.LC_REPORT) self._init_coll_tambak_Columns(self.tambak) self.tambak.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnTambakListItemSelected, id=wxID_POTENSI_EKONOMITAMBAK) self.staticText1 = wx.StaticText(id=wxID_POTENSI_EKONOMISTATICTEXT1, label=u'Nama Potensi', name='staticText1', parent=self, pos=wx.Point(16, 240), size=wx.Size(151, 15), style=0) self.input_tambak = wx.ComboBox(choices=[ 'Warung', 'Suparmarket', 'Pasar', 'Taman Hiburan', 'Tambang' ], id=wxID_POTENSI_EKONOMIINPUT_TAMBAK, name=u'input_tambak', parent=self, pos=wx.Point(168, 240), size=wx.Size(240, 25), style=0, value='') self.staticText2 = wx.StaticText(id=wxID_POTENSI_EKONOMISTATICTEXT2, label=u'Jumlah / Luas', name='staticText2', parent=self, pos=wx.Point(16, 272), size=wx.Size(86, 15), style=0) self.staticText3 = wx.StaticText(id=wxID_POTENSI_EKONOMISTATICTEXT3, label=u'Pemilik', name='staticText3', parent=self, pos=wx.Point(424, 240), size=wx.Size(63, 15), style=0) self.staticText4 = wx.StaticText(id=wxID_POTENSI_EKONOMISTATICTEXT4, label=u'Keterangan', name='staticText4', parent=self, pos=wx.Point(424, 272), size=wx.Size(74, 15), style=0) self.input_jumlah = wx.TextCtrl(id=wxID_POTENSI_EKONOMIINPUT_JUMLAH, name=u'input_jumlah', parent=self, pos=wx.Point(168, 272), size=wx.Size(80, 25), style=0, value='') self.no = wx.TextCtrl(id=wxID_POTENSI_EKONOMINO, name=u'no', parent=self, pos=wx.Point(-100, -100), size=wx.Size(80, 25), style=0, value='') self.input_pemilik = wx.TextCtrl(id=wxID_POTENSI_EKONOMIINPUT_PEMILIK, name=u'input_pemilik', parent=self, pos=wx.Point(528, 240), size=wx.Size(248, 25), style=0, value='') self.richTextCtrl1 = wx.richtext.RichTextCtrl( id=wxID_POTENSI_EKONOMIRICHTEXTCTRL1, parent=self, pos=wx.Point(528, 272), size=wx.Size(248, 112), style=wx.richtext.RE_MULTILINE, value='') self.tambah = wx.Button(id=wxID_POTENSI_EKONOMITAMBAH, label=u'Tambah', name=u'tambah', parent=self, pos=wx.Point(160, 400), size=wx.Size(128, 30), style=0) self.tambah.Bind(wx.EVT_BUTTON, self.OnTambahButton, id=wxID_POTENSI_EKONOMITAMBAH) self.edit = wx.Button(id=wxID_POTENSI_EKONOMIEDIT, label=u'Edit', name=u'edit', parent=self, pos=wx.Point(296, 400), size=wx.Size(112, 30), style=0) self.edit.Bind(wx.EVT_BUTTON, self.OnEditButton, id=wxID_POTENSI_EKONOMIEDIT) self.hapus = wx.Button(id=wxID_POTENSI_EKONOMIHAPUS, label=u'Hapus', name=u'hapus', parent=self, pos=wx.Point(416, 400), size=wx.Size(112, 30), style=0) self.hapus.Bind(wx.EVT_BUTTON, self.OnHapusButton, id=wxID_POTENSI_EKONOMIHAPUS) self.kembali = wx.Button(id=wxID_POTENSI_EKONOMIKEMBALI, label=u'Kembali Ke Menu', name=u'kembali', parent=self, pos=wx.Point(536, 400), size=wx.Size(136, 30), style=0) self.kembali.Bind(wx.EVT_BUTTON, self.OnKembaliButton, id=wxID_POTENSI_EKONOMIKEMBALI)
def __init__(self, parent: Frame): wx.Frame.__init__(self, parent) print("initiating main panel") if parent.isCtrl is True: print("trying to recieve json bytes") json_dict = to_str(parent.info_sock.receive()) print("trying to turn msg to dict") dict = json.loads(json_dict) self.l_buttons = [] print(dict) if not dict: text = wx.StaticText(self, -1, "No users connected for you to control", pos=(GUI_X / 10, GUI_Y / 5)) text2 = wx.StaticText(self, -1, "Please close and try again later", pos=(GUI_X / 10, GUI_Y / 4)) font = wx.Font(13, wx.DECORATIVE, wx.ITALIC, wx.BOLD) text.SetFont(font) text2.SetFont(font) parent.info_sock.send("-1") else: print("trying to create button", dict) button_x = GUI_X / 6 button_y = 20 self.listBox = wx.ListBox(choices=[], name='listbox', parent=self, pos=wx.Point(GUI_X / 6, 20), size=(200, 200), style=0) for key in dict: self.listBox.Append("Room number: " + key + "user: "******"Room number: " + key + " user: "******"trying to screen") text = wx.StaticText(self, -1, "Sharing Screen... waiting for control", pos=(GUI_X / 10, GUI_Y / 5)) font = wx.Font(13, wx.DECORATIVE, wx.ITALIC, wx.BOLD) text.SetFont(font) parent.info_sock.close() main_server.main(parent.data_sock, parent.input_sock)
def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_IMPORTMITRADESA, name=u'importmitradesa', parent=prnt, pos=wx.Point(698, 300), size=wx.Size(303, 214), style=wx.DEFAULT_FRAME_STYLE, title=u'Import Database') self.SetClientSize(wx.Size(303, 214)) self.Center(wx.BOTH) self.satu = wx.TextCtrl(id=wxID_IMPORTMITRADESASATU, name=u'satu', parent=self, pos=wx.Point(24, 48), size=wx.Size(256, 27), style=0, value=u'') self.button1 = wx.Button(id=wxID_IMPORTMITRADESABUTTON1, label=u'Ambil File', name='button1', parent=self, pos=wx.Point(24, 104), size=wx.Size(128, 32), style=0) self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button, id=wxID_IMPORTMITRADESABUTTON1) self.staticBox1 = wx.StaticBox(id=wxID_IMPORTMITRADESASTATICBOX1, label=u'Ambil File Yang Di Import', name='staticBox1', parent=self, pos=wx.Point(16, 0), size=wx.Size(272, 152), style=0) self.button2 = wx.Button(id=wxID_IMPORTMITRADESABUTTON2, label=u'Kembali Ke Menu Utama', name='button2', parent=self, pos=wx.Point(64, 160), size=wx.Size(176, 30), style=0) self.button2.Bind(wx.EVT_BUTTON, self.OnButton2Button, id=wxID_IMPORTMITRADESABUTTON2) self.button3 = wx.Button(id=wxID_IMPORTMITRADESABUTTON3, label=u'Import', name='button3', parent=self, pos=wx.Point(160, 104), size=wx.Size(120, 32), style=0) self.button3.Bind(wx.EVT_BUTTON, self.OnButton3Button, id=wxID_IMPORTMITRADESABUTTON3) self.propinsi = wx.TextCtrl(id=wxID_IMPORTMITRADESAPROPINSI, name=u'propinsi', parent=self, pos=wx.Point(-100, -100), size=wx.Size(152, 24), style=0, value=u'') self.kabupaten = wx.TextCtrl(id=wxID_IMPORTMITRADESAKABUPATEN, name=u'kabupaten', parent=self, pos=wx.Point(-100, -100), size=wx.Size(152, 24), style=0, value=u'') self.staticText1 = wx.StaticText(id=wxID_IMPORTMITRADESASTATICTEXT1, label=u'Sumber Data', name='staticText1', parent=self, pos=wx.Point(32, 24), size=wx.Size(79, 17), style=0)
def _init_ctrls(self, prnt): wx.Dialog.__init__(self, id=wxID_WXDIALOG1, name='', parent=prnt, pos=wx.Point(398, 267), size=wx.Size(379, 209), style=wx.DEFAULT_DIALOG_STYLE, title='Acquire Data from TWAIN Source') self._init_utils() self.SetClientSize(wx.Size(371, 182)) self.button1 = wx.Button(id=wxID_WXDIALOG1BUTTON1, label='Acquire', name='button1', parent=self, pos=wx.Point(40, 120), size=wx.Size(75, 23), style=0) self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button, id=wxID_WXDIALOG1BUTTON1) self.button2 = wx.Button(id=wxID_WXDIALOG1BUTTON2, label='Cancel', name='button2', parent=self, pos=wx.Point(144, 120), size=wx.Size(75, 23), style=0) self.button2.Bind(wx.EVT_BUTTON, self.OnButton2Button, id=wxID_WXDIALOG1BUTTON2) self.cbShowUI = wx.CheckBox(id=wxID_WXDIALOG1CBSHOWUI, label='Show Source User Interface', name='cbShowUI', parent=self, pos=wx.Point(112, 40), size=wx.Size(160, 13), style=0) self.cbShowUI.SetValue(False) self.cbModal = wx.CheckBox(id=wxID_WXDIALOG1CBMODAL, label='Source User Interface is Modal', name='cbModal', parent=self, pos=wx.Point(112, 80), size=wx.Size(176, 13), style=0) self.cbModal.SetValue(False) self.button3 = wx.Button(id=wxID_WXDIALOG1BUTTON3, label='Layout', name='button3', parent=self, pos=wx.Point(248, 120), size=wx.Size(75, 23), style=0) self.button3.Bind(wx.EVT_BUTTON, self.OnButton3Button, id=wxID_WXDIALOG1BUTTON3)
def lineIntersection (line1, line2): """ Returns a wx.Point corresponding to where two line segments intersect. If they do not intersect, then None is returned. """ # this is translated from # http://workshop.evolutionzone.com/2007/09/10/code-2d-line-intersection/ # distances of the two lines distX1 = line1[1].x - line1[0].x distX2 = line2[1].x - line2[0].x distY1 = line1[1].y - line1[0].y distY2 = line2[1].y - line2[0].y distX3 = line1[0].x - line2[0].x distY3 = line1[0].y - line2[0].y # length of the lines line1Length = math.sqrt(distX1 ** 2 + distY1 ** 2) line2Length = math.sqrt(distX2 ** 2 + distY2 ** 2) if line1Length == 0 or line2Length == 0: return None # angle between lines dotProduct = distX1 * distX2 + distY1 * distY2 angle = dotProduct / (line1Length * line2Length) # check to see if lines are parallel if abs(angle) == 1: return None # find the intersection point # we cast the divisor as a float # to force uA and uB to be floats too divisor = float(distY2 * distX1 - distX2 * distY1) uA = (distX2 * distY3 - distY2 * distX3) / divisor uB = (distX1 * distY3 - distY1 * distX3) / divisor intersection = wx.Point(line1[0].x + uA * distX1, \ line1[0].y + uA * distY1) # find the combined length of the two segments # between intersection and line1's endpoints distX1 = intersection.x - line1[0].x distX2 = intersection.x - line1[1].x distY1 = intersection.y - line1[0].y distY2 = intersection.y - line1[1].y distLine1 = math.sqrt(distX1 ** 2 + distY1 ** 2) + \ math.sqrt(distX2 ** 2 + distY2 ** 2) # ... and then for line2 distX1 = intersection.x - line2[0].x distX2 = intersection.x - line2[1].x distY1 = intersection.y - line2[0].y distY2 = intersection.y - line2[1].y distLine2 = math.sqrt(distX1 ** 2 + distY1 ** 2) + \ math.sqrt(distX2 ** 2 + distY2 ** 2) # if these two are the same, then we know # the intersection is actually on the line segments, and not in space # # I had to goose the accuracy down a lot :( if (abs(distLine1 - line1Length) < 0.2) and \ (abs(distLine2 - line2Length) < 0.2): return intersection else: return None
def DrawWeek(self, DC): """ Draw the week days. :param `DC`: the :class:`DC` to use. """ # increase by 1 to include all gridlines width = self.gridx[1] - self.gridx[0] + 1 height = self.gridy[1] - self.gridy[0] + 1 rect_w = self.gridx[-1] - self.gridx[0] f = wx.Font(10, self.fontfamily, self.fontstyle, self.fontweight) # initial font setting if self.week_auto is True: test_size = self.max_week_size # max size test_day = ' Sun ' while test_size > 2: f.SetPointSize(test_size) DC.SetFont(f) tw, th = DC.GetTextExtent(test_day) if tw < width and th < height: break test_size = test_size - 1 else: f.SetPointSize(self.week_size) # set fixed size DC.SetFont(f) DC.SetTextForeground(MakeColor(self.colors[COLOR_HEADER_FONT])) cnt_x = 0 cnt_y = 0 brush = wx.Brush(MakeColor(self.colors[COLOR_HEADER_BACKGROUND]), wx.BRUSHSTYLE_SOLID) DC.SetBrush(brush) if self.cal_type == "NORMAL": cal_days = CalDays else: cal_days = BusCalDays for val in cal_days: if val == cal_days[-1]: width = width + self.restW day = AbrWeekday[val] if self.sizew < 200: day = day[0] dw, dh = DC.GetTextExtent(day) diffx = (width - dw) / 2 diffy = (height - dh) / 2 x = self.gridx[cnt_x] y = self.gridy[cnt_y] pointXY = (x, y) pointWH = (width, height) if self.hide_grid is False: pen = wx.Pen(MakeColor(self.GetColor(COLOR_GRID_LINES)), 1, wx.PENSTYLE_SOLID) else: pen = wx.Pen(MakeColor(self.GetColor(COLOR_BACKGROUND)), 1, wx.PENSTYLE_SOLID) DC.SetPen(pen) DC.DrawRectangle(pointXY, pointWH) old_pen = DC.GetPen() pen = wx.Pen(MakeColor(self.colors[COLOR_3D_LIGHT]), 1, wx.PENSTYLE_SOLID) DC.SetPen(pen) # draw the horizontal hilight startPoint = wx.Point(x + 1, y + 1) endPoint = wx.Point(x + width - 1, y + 1) DC.DrawLine(startPoint, endPoint) # draw the vertical hilight startPoint = wx.Point(x + 1, y + 1) endPoint = wx.Point(x + 1, y + height - 2) DC.DrawLine(startPoint, endPoint) pen = wx.Pen(MakeColor(self.colors[COLOR_3D_DARK]), 1, wx.PENSTYLE_SOLID) DC.SetPen(pen) # draw the horizontal lowlight startPoint = wx.Point(x + 1, y + height - 2) endPoint = wx.Point(x + width - 1, y + height - 2) DC.DrawLine(startPoint, endPoint) # draw the vertical lowlight startPoint = wx.Point(x + width - 2, y + 2) endPoint = wx.Point(x + width - 2, y + height - 2) DC.DrawLine(startPoint, endPoint) pen = wx.Pen(MakeColor(self.colors[COLOR_FONT]), 1, wx.PENSTYLE_SOLID) DC.SetPen(pen) point = (x + diffx, y + diffy) DC.DrawText(day, point) cnt_x = cnt_x + 1
def __init__(self, parent, title): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=title, pos=wx.DefaultPosition, size=wx.Size(873, 535), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) self.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_MENU)) bSizer1 = wx.BoxSizer(wx.VERTICAL) bSizer2 = wx.BoxSizer(wx.HORIZONTAL) bSizer3 = wx.BoxSizer(wx.VERTICAL) self.m_animCtrl1 = wx.adv.AnimationCtrl(self, wx.ID_ANY, wx.adv.NullAnimation, wx.DefaultPosition, wx.DefaultSize, wx.adv.AC_DEFAULT_STYLE) bSizer3.Add(self.m_animCtrl1, 1, wx.ALL | wx.EXPAND, 5) bSizer2.Add(bSizer3, 9, wx.EXPAND, 5) bSizer4 = wx.BoxSizer(wx.VERTICAL) sbSizer1 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"参数设置"), wx.VERTICAL) sbSizer2 = wx.StaticBoxSizer( wx.StaticBox(sbSizer1.GetStaticBox(), wx.ID_ANY, u"视频源"), wx.VERTICAL) gSizer1 = wx.GridSizer(0, 2, 0, 8) m_choice1Choices = [u"摄像头ID_0", u"摄像头ID_1", u"摄像头ID_2"] self.m_choice1 = wx.Choice(sbSizer2.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.Size(90, 25), m_choice1Choices, 0) self.m_choice1.SetSelection(0) gSizer1.Add(self.m_choice1, 0, wx.ALL, 5) self.camera_button1 = wx.Button(sbSizer2.GetStaticBox(), wx.ID_ANY, u"开始检测", wx.DefaultPosition, wx.Size(90, 25), 0) gSizer1.Add(self.camera_button1, 0, wx.ALL, 5) self.vedio_button2 = wx.Button(sbSizer2.GetStaticBox(), wx.ID_ANY, u"打开视频文件", wx.DefaultPosition, wx.Size(90, 25), 0) gSizer1.Add(self.vedio_button2, 0, wx.ALL, 5) self.off_button3 = wx.Button(sbSizer2.GetStaticBox(), wx.ID_ANY, u"暂停", wx.DefaultPosition, wx.Size(90, 25), 0) gSizer1.Add(self.off_button3, 0, wx.ALL, 5) sbSizer2.Add(gSizer1, 1, wx.EXPAND, 5) sbSizer1.Add(sbSizer2, 2, wx.EXPAND, 5) sbSizer3 = wx.StaticBoxSizer( wx.StaticBox(sbSizer1.GetStaticBox(), wx.ID_ANY, u"疲劳检测"), wx.VERTICAL) bSizer5 = wx.BoxSizer(wx.HORIZONTAL) self.yawn_checkBox1 = wx.CheckBox(sbSizer3.GetStaticBox(), wx.ID_ANY, u"打哈欠检测", wx.Point(-1, -1), wx.Size(-1, 15), 0) self.yawn_checkBox1.SetValue(True) bSizer5.Add(self.yawn_checkBox1, 0, wx.ALL, 5) self.blink_checkBox2 = wx.CheckBox(sbSizer3.GetStaticBox(), wx.ID_ANY, u"闭眼检测", wx.Point(-1, -1), wx.Size(-1, 15), 0) self.blink_checkBox2.SetValue(True) bSizer5.Add(self.blink_checkBox2, 0, wx.ALL, 5) sbSizer3.Add(bSizer5, 1, wx.EXPAND, 5) bSizer6 = wx.BoxSizer(wx.HORIZONTAL) self.nod_checkBox7 = wx.CheckBox(sbSizer3.GetStaticBox(), wx.ID_ANY, u"点头检测", wx.Point(-1, -1), wx.Size(-1, 15), 0) self.nod_checkBox7.SetValue(True) bSizer6.Add(self.nod_checkBox7, 0, wx.ALL, 5) self.m_staticText1 = wx.StaticText(sbSizer3.GetStaticBox(), wx.ID_ANY, u"疲劳时间(秒):", wx.DefaultPosition, wx.Size(-1, 15), 0) self.m_staticText1.Wrap(-1) bSizer6.Add(self.m_staticText1, 0, wx.ALL, 5) m_listBox2Choices = [u"3", u"4", u"5", u"6", u"7", u"8"] self.m_listBox2 = wx.ListBox(sbSizer3.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.Size(50, 24), m_listBox2Choices, 0) bSizer6.Add(self.m_listBox2, 0, 0, 5) sbSizer3.Add(bSizer6, 1, wx.EXPAND, 5) sbSizer1.Add(sbSizer3, 2, 0, 5) sbSizer4 = wx.StaticBoxSizer( wx.StaticBox(sbSizer1.GetStaticBox(), wx.ID_ANY, u"脱岗检测"), wx.VERTICAL) bSizer8 = wx.BoxSizer(wx.HORIZONTAL) self.m_checkBox4 = wx.CheckBox(sbSizer4.GetStaticBox(), wx.ID_ANY, u"脱岗检测", wx.DefaultPosition, wx.Size(-1, 15), 0) self.m_checkBox4.SetValue(True) bSizer8.Add(self.m_checkBox4, 0, wx.ALL, 5) self.m_staticText2 = wx.StaticText(sbSizer4.GetStaticBox(), wx.ID_ANY, u"脱岗时间(秒):", wx.DefaultPosition, wx.Size(-1, 15), 0) self.m_staticText2.Wrap(-1) bSizer8.Add(self.m_staticText2, 0, wx.ALL, 5) m_listBox21Choices = [u"5", u"10", u"15", u"20", u"25", u"30"] self.m_listBox21 = wx.ListBox(sbSizer4.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.Size(50, 24), m_listBox21Choices, 0) bSizer8.Add(self.m_listBox21, 0, 0, 5) sbSizer4.Add(bSizer8, 1, 0, 5) sbSizer1.Add(sbSizer4, 1, 0, 5) sbSizer5 = wx.StaticBoxSizer( wx.StaticBox(sbSizer1.GetStaticBox(), wx.ID_ANY, u"分析区域"), wx.VERTICAL) bSizer9 = wx.BoxSizer(wx.HORIZONTAL) self.m_staticText3 = wx.StaticText(sbSizer5.GetStaticBox(), wx.ID_ANY, u"检测区域: ", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText3.Wrap(-1) bSizer9.Add(self.m_staticText3, 0, wx.ALL, 5) m_choice2Choices = [u"全视频检测", u"部分区域选取"] self.m_choice2 = wx.Choice(sbSizer5.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice2Choices, 0) self.m_choice2.SetSelection(0) bSizer9.Add(self.m_choice2, 0, wx.ALL, 5) sbSizer5.Add(bSizer9, 1, wx.EXPAND, 5) sbSizer1.Add(sbSizer5, 1, 0, 5) sbSizer6 = wx.StaticBoxSizer( wx.StaticBox(sbSizer1.GetStaticBox(), wx.ID_ANY, u"状态输出"), wx.VERTICAL) self.m_textCtrl3 = wx.TextCtrl(sbSizer6.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE | wx.TE_READONLY) sbSizer6.Add(self.m_textCtrl3, 1, wx.ALL | wx.EXPAND, 5) sbSizer1.Add(sbSizer6, 5, wx.EXPAND, 5) bSizer4.Add(sbSizer1, 1, wx.EXPAND, 5) bSizer2.Add(bSizer4, 3, wx.EXPAND, 5) bSizer1.Add(bSizer2, 1, wx.EXPAND, 5) self.SetSizer(bSizer1) self.Layout() self.Centre(wx.BOTH) # Connect Events self.m_choice1.Bind(wx.EVT_CHOICE, self.cameraid_choice) #绑定事件 self.camera_button1.Bind(wx.EVT_BUTTON, self.camera_on) #开 self.vedio_button2.Bind(wx.EVT_BUTTON, self.vedio_on) self.off_button3.Bind(wx.EVT_BUTTON, self.off) #关 self.m_listBox2.Bind(wx.EVT_LISTBOX, self.AR_CONSEC_FRAMES) # 闪烁阈值设置 self.m_listBox21.Bind(wx.EVT_LISTBOX, self.OUT_AR_CONSEC_FRAMES) # 脱岗时间设置 # 封面图片 self.image_cover = wx.Image(COVER, wx.BITMAP_TYPE_ANY) # 显示图片在m_animCtrl1上 self.bmp = wx.StaticBitmap(self.m_animCtrl1, -1, wx.Bitmap(self.image_cover)) # 设置窗口标题的图标 self.icon = wx.Icon('./images/123.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) # 系统事件 self.Bind(wx.EVT_CLOSE, self.OnClose) print("wxpython界面初始化加载完成!") """参数""" # 默认为摄像头0 self.VIDEO_STREAM = 0 self.CAMERA_STYLE = False # False未打开摄像头,True摄像头已打开 # 闪烁阈值(秒) self.AR_CONSEC_FRAMES_check = 3 self.OUT_AR_CONSEC_FRAMES_check = 5 # 眼睛长宽比 self.EYE_AR_THRESH = 0.2 self.EYE_AR_CONSEC_FRAMES = self.AR_CONSEC_FRAMES_check # 打哈欠长宽比 self.MAR_THRESH = 0.5 self.MOUTH_AR_CONSEC_FRAMES = self.AR_CONSEC_FRAMES_check # 瞌睡点头 self.HAR_THRESH = 0.3 self.NOD_AR_CONSEC_FRAMES = self.AR_CONSEC_FRAMES_check """计数""" # 初始化帧计数器和眨眼总数 self.COUNTER = 0 self.TOTAL = 0 # 初始化帧计数器和打哈欠总数 self.mCOUNTER = 0 self.mTOTAL = 0 # 初始化帧计数器和点头总数 self.hCOUNTER = 0 self.hTOTAL = 0 # 离职时间长度 self.oCOUNTER = 0 """姿态""" # 世界坐标系(UVW):填写3D参考点,该模型参考http://aifi.isr.uc.pt/Downloads/OpenGL/glAnthropometric3DModel.cpp self.object_pts = np.float32([ [6.825897, 6.760612, 4.402142], #33左眉左上角 [1.330353, 7.122144, 6.903745], #29左眉右角 [-1.330353, 7.122144, 6.903745], #34右眉左角 [-6.825897, 6.760612, 4.402142], #38右眉右上角 [5.311432, 5.485328, 3.987654], #13左眼左上角 [1.789930, 5.393625, 4.413414], #17左眼右上角 [-1.789930, 5.393625, 4.413414], #25右眼左上角 [-5.311432, 5.485328, 3.987654], #21右眼右上角 [2.005628, 1.409845, 6.165652], #55鼻子左上角 [-2.005628, 1.409845, 6.165652], #49鼻子右上角 [2.774015, -2.080775, 5.048531], #43嘴左上角 [-2.774015, -2.080775, 5.048531], #39嘴右上角 [0.000000, -3.116408, 6.097667], #45嘴中央下角 [0.000000, -7.415691, 4.070434] ]) #6下巴角 # 相机坐标系(XYZ):添加相机内参 self.K = [ 6.5308391993466671e+002, 0.0, 3.1950000000000000e+002, 0.0, 6.5308391993466671e+002, 2.3950000000000000e+002, 0.0, 0.0, 1.0 ] # 等价于矩阵[fx, 0, cx; 0, fy, cy; 0, 0, 1] # 图像中心坐标系(uv):相机畸变参数[k1, k2, p1, p2, k3] self.D = [ 7.0834633684407095e-002, 6.9140193737175351e-002, 0.0, 0.0, -1.3073460323689292e+000 ] # 像素坐标系(xy):填写凸轮的本征和畸变系数 self.cam_matrix = np.array(self.K).reshape(3, 3).astype(np.float32) self.dist_coeffs = np.array(self.D).reshape(5, 1).astype(np.float32) # 重新投影3D点的世界坐标轴以验证结果姿势 self.reprojectsrc = np.float32([[10.0, 10.0, 10.0], [10.0, 10.0, -10.0], [10.0, -10.0, -10.0], [10.0, -10.0, 10.0], [-10.0, 10.0, 10.0], [-10.0, 10.0, -10.0], [-10.0, -10.0, -10.0], [-10.0, -10.0, 10.0]]) # 绘制正方体12轴 self.line_pairs = [[0, 1], [1, 2], [2, 3], [3, 0], [4, 5], [5, 6], [6, 7], [7, 4], [0, 4], [1, 5], [2, 6], [3, 7]]
def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_EDIT_DATA_KEMISKINAN, name=u'edit_data_kemiskinan', parent=prnt, pos=wx.Point(427, 180), size=wx.Size(843, 453), style=wx.FRAME_NO_TASKBAR, title=u'Edit Data Kemiskinan') self.SetClientSize(wx.Size(843, 453)) self.Center(wx.BOTH) self.penduduk = wx.ListCtrl(id=wxID_EDIT_DATA_KEMISKINANPENDUDUK, name=u'penduduk', parent=self, pos=wx.Point(16, 8), size=wx.Size(808, 184), style=wx.LC_REPORT) self._init_coll_penduduk_Columns(self.penduduk) self.penduduk.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnIsipendudukListItemSelected, id=wxID_EDIT_DATA_KEMISKINANPENDUDUK) self.staticText1 = wx.StaticText( id=wxID_EDIT_DATA_KEMISKINANSTATICTEXT1, label=u'Nomor Kartu Keluarga', name='staticText1', parent=self, pos=wx.Point(408, 200), size=wx.Size(145, 15), style=0) self.cari_kk = wx.TextCtrl(id=wxID_EDIT_DATA_KEMISKINANCARI_KK, name=u'cari_kk', parent=self, pos=wx.Point(560, 200), size=wx.Size(168, 25), style=0, value='') self.button1 = wx.Button(id=wxID_EDIT_DATA_KEMISKINANBUTTON1, label=u'Cari', name='button1', parent=self, pos=wx.Point(744, 200), size=wx.Size(80, 24), style=0) self.staticText2 = wx.StaticText( id=wxID_EDIT_DATA_KEMISKINANSTATICTEXT2, label=u'Nomor KK', name='staticText2', parent=self, pos=wx.Point(16, 240), size=wx.Size(65, 15), style=0) self.nomor_kk = wx.TextCtrl(id=wxID_EDIT_DATA_KEMISKINANNOMOR_KK, name=u'nomor_kk', parent=self, pos=wx.Point(96, 232), size=wx.Size(312, 25), style=0, value='') self.staticText3 = wx.StaticText( id=wxID_EDIT_DATA_KEMISKINANSTATICTEXT3, label=u'Alamat', name='staticText3', parent=self, pos=wx.Point(416, 232), size=wx.Size(47, 15), style=0) self.input_alamat = wx.TextCtrl( id=wxID_EDIT_DATA_KEMISKINANINPUT_ALAMAT, name=u'input_alamat', parent=self, pos=wx.Point(472, 232), size=wx.Size(352, 25), style=0, value='') self.staticText4 = wx.StaticText( id=wxID_EDIT_DATA_KEMISKINANSTATICTEXT4, label=u'Nama KK', name='staticText4', parent=self, pos=wx.Point(16, 264), size=wx.Size(60, 15), style=0) self.nama_kk = wx.TextCtrl(id=wxID_EDIT_DATA_KEMISKINANNAMA_KK, name=u'nama_kk', parent=self, pos=wx.Point(96, 264), size=wx.Size(312, 25), style=0, value='') self.staticText5 = wx.StaticText( id=wxID_EDIT_DATA_KEMISKINANSTATICTEXT5, label=u'Status Kemiskinan', name='staticText5', parent=self, pos=wx.Point(416, 264), size=wx.Size(119, 15), style=0) self.status_miskin = wx.ComboBox( choices=['Miskin', 'Tidak Miskin'], id=wxID_EDIT_DATA_KEMISKINANSTATUS_MISKIN, name=u'status_miskin', parent=self, pos=wx.Point(552, 264), size=wx.Size(272, 25), style=0, value='') self.staticText6 = wx.StaticText( id=wxID_EDIT_DATA_KEMISKINANSTATICTEXT6, label=u'Program Perlindungan Sosial', name='staticText6', parent=self, pos=wx.Point(16, 296), size=wx.Size(185, 15), style=0) self.cek_raskin = wx.CheckBox(id=wxID_EDIT_DATA_KEMISKINANCEK_RASKIN, label=u'Raskin', name=u'cek_raskin', parent=self, pos=wx.Point(16, 320), size=wx.Size(89, 18), style=0) self.cek_raskin.SetValue(False) self.cek_jkn = wx.CheckBox(id=wxID_EDIT_DATA_KEMISKINANCEK_JKN, label=u'JKN', name=u'cek_jkn', parent=self, pos=wx.Point(16, 344), size=wx.Size(89, 18), style=0) self.cek_jkn.SetValue(False) self.cek_blsm = wx.CheckBox(id=wxID_EDIT_DATA_KEMISKINANCEK_BLSM, label=u'BLSM', name=u'cek_blsm', parent=self, pos=wx.Point(16, 368), size=wx.Size(89, 18), style=0) self.cek_blsm.SetValue(False) self.cek_bsm = wx.CheckBox(id=wxID_EDIT_DATA_KEMISKINANCEK_BSM, label=u'BSM', name=u'cek_bsm', parent=self, pos=wx.Point(192, 320), size=wx.Size(89, 18), style=0) self.cek_bsm.SetValue(False) self.cek_pkh = wx.CheckBox(id=wxID_EDIT_DATA_KEMISKINANCEK_PKH, label=u'PKH', name=u'cek_pkh', parent=self, pos=wx.Point(192, 344), size=wx.Size(89, 18), style=0) self.cek_pkh.SetValue(False) self.cek_pkd = wx.CheckBox(id=wxID_EDIT_DATA_KEMISKINANCEK_PKD, label=u'Program Kesehatan Daerah', name=u'cek_pkd', parent=self, pos=wx.Point(192, 368), size=wx.Size(208, 18), style=0) self.cek_pkd.SetValue(False) self.cek_ppd = wx.CheckBox(id=wxID_EDIT_DATA_KEMISKINANCEK_PPD, label=u'Program Pendidikan Daerah', name=u'cek_ppd', parent=self, pos=wx.Point(416, 320), size=wx.Size(208, 18), style=0) self.cek_ppd.SetValue(False) self.cek_prolain = wx.CheckBox(id=wxID_EDIT_DATA_KEMISKINANCEK_PROLAIN, label=u'Program Lain', name=u'cek_prolain', parent=self, pos=wx.Point(416, 344), size=wx.Size(200, 18), style=0) self.cek_prolain.SetValue(False) self.button2 = wx.Button(id=wxID_EDIT_DATA_KEMISKINANBUTTON2, label=u'Simpan Data', name='button2', parent=self, pos=wx.Point(232, 400), size=wx.Size(192, 30), style=0) self.button2.Bind(wx.EVT_BUTTON, self.OnButton2Button, id=wxID_EDIT_DATA_KEMISKINANBUTTON2) self.button3 = wx.Button(id=wxID_EDIT_DATA_KEMISKINANBUTTON3, label=u'Kembali Ke Menu', name='button3', parent=self, pos=wx.Point(440, 400), size=wx.Size(184, 30), style=0) self.button3.Bind(wx.EVT_BUTTON, self.OnButton3Button, id=wxID_EDIT_DATA_KEMISKINANBUTTON3)
def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt, pos=wx.Point(308, 124), size=wx.Size(911, 552), style=wx.FRAME_NO_TASKBAR, title=u'Penambahan Anggota Keluarga Pada KK Sementara') self.SetClientSize(wx.Size(911, 552)) self.staticBitmap1 = wx.StaticBitmap(bitmap=wx.Bitmap('png/sideka.png', wx.BITMAP_TYPE_PNG), id=wxID_FRAME1STATICBITMAP1, name='staticBitmap1', parent=self, pos=wx.Point(12, 4), size=wx.Size(276, 65), style=0) self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1, label=u'Nomor KK', name='staticText1', parent=self, pos=wx.Point(24, 88), size=wx.Size(65, 17), style=0) self.textCtrl1 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL1, name='textCtrl1', parent=self, pos=wx.Point(24, 104), size=wx.Size(140, 25), style=0, value=u'') self.staticBox2 = wx.StaticBox(id=wxID_FRAME1STATICBOX2, label=u'Data Penduduk', name='staticBox2', parent=self, pos=wx.Point(8, 64), size=wx.Size(888, 328), style=0) self.staticBitmap2 = wx.StaticBitmap(bitmap=wx.Bitmap('png/photo.png', wx.BITMAP_TYPE_PNG), id=wxID_FRAME1STATICBITMAP2, name='staticBitmap2', parent=self, pos=wx.Point(24, 144), size=wx.Size(110, 140), style=0) self.textCtrl4 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL4, name='textCtrl4', parent=self, pos=wx.Point(176, 104), size=wx.Size(200, 25), style=0, value=u'') self.staticText4 = wx.StaticText(id=wxID_FRAME1STATICTEXT4, label=u'N I K *', name='staticText4', parent=self, pos=wx.Point(176, 88), size=wx.Size(40, 17), style=0) self.staticText5 = wx.StaticText(id=wxID_FRAME1STATICTEXT5, label=u'Nama Lengkap', name='staticText5', parent=self, pos=wx.Point(176, 136), size=wx.Size(98, 17), style=0) self.textCtrl5 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL5, name='textCtrl5', parent=self, pos=wx.Point(176, 152), size=wx.Size(200, 25), style=0, value=u'') self.staticText6 = wx.StaticText(id=wxID_FRAME1STATICTEXT6, label=u'Jenis Kelamin', name='staticText6', parent=self, pos=wx.Point(176, 184), size=wx.Size(84, 17), style=0) self.textCtrl6 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL6, name='textCtrl6', parent=self, pos=wx.Point(176, 248), size=wx.Size(200, 25), style=0, value=u'') self.choice1 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE1, name='choice1', parent=self, pos=wx.Point(176, 200), size=wx.Size(200, 27), style=0) self.staticText7 = wx.StaticText(id=wxID_FRAME1STATICTEXT7, label=u'Tempat Lahir', name='staticText7', parent=self, pos=wx.Point(176, 232), size=wx.Size(83, 17), style=0) self.staticBox3 = wx.StaticBox(id=wxID_FRAME1STATICBOX3, label=u'Catatan', name='staticBox3', parent=self, pos=wx.Point(296, 0), size=wx.Size(600, 65), style=0) self.genBitmapTextButton1 = wx.lib.buttons.GenBitmapTextButton(bitmap=wx.NullBitmap, id=wxID_FRAME1GENBITMAPTEXTBUTTON1, label=u'Kembali Ke Menu Utama', name='genBitmapTextButton1', parent=self, pos=wx.Point(640, 24), size=wx.Size(240, 31), style=0) self.genBitmapTextButton1.Bind(wx.EVT_BUTTON, self.OnGenBitmapTextButton1Button, id=wxID_FRAME1GENBITMAPTEXTBUTTON1) self.staticText9 = wx.StaticText(id=wxID_FRAME1STATICTEXT9, label=u'Tanggal Lahir', name='staticText9', parent=self, pos=wx.Point(176, 280), size=wx.Size(79, 17), style=0) self.textCtrl7 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL7, name='textCtrl7', parent=self, pos=wx.Point(176, 296), size=wx.Size(200, 25), style=0, value=u'') self.staticText10 = wx.StaticText(id=wxID_FRAME1STATICTEXT10, label=u'Golongan Darah', name='staticText10', parent=self, pos=wx.Point(176, 328), size=wx.Size(98, 17), style=0) self.choice2 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE2, name='choice2', parent=self, pos=wx.Point(176, 344), size=wx.Size(80, 25), style=0) self.staticText11 = wx.StaticText(id=wxID_FRAME1STATICTEXT11, label=u'Agama', name='staticText11', parent=self, pos=wx.Point(400, 88), size=wx.Size(42, 17), style=0) self.choice3 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE3, name='choice3', parent=self, pos=wx.Point(400, 104), size=wx.Size(216, 25), style=0) self.staticText12 = wx.StaticText(id=wxID_FRAME1STATICTEXT12, label=u'Kewarganegaraan', name='staticText12', parent=self, pos=wx.Point(400, 136), size=wx.Size(108, 17), style=0) self.choice4 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE4, name='choice4', parent=self, pos=wx.Point(400, 152), size=wx.Size(216, 25), style=0) self.staticText13 = wx.StaticText(id=wxID_FRAME1STATICTEXT13, label=u'Pendidikan Terakhir', name='staticText13', parent=self, pos=wx.Point(400, 184), size=wx.Size(119, 17), style=0) self.choice5 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE5, name='choice5', parent=self, pos=wx.Point(400, 200), size=wx.Size(216, 25), style=0) self.staticText14 = wx.StaticText(id=wxID_FRAME1STATICTEXT14, label=u'Pendidikan Yang Saat Ini Ditempuh', name='staticText14', parent=self, pos=wx.Point(400, 232), size=wx.Size(210, 17), style=0) self.choice6 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE6, name='choice6', parent=self, pos=wx.Point(400, 248), size=wx.Size(216, 25), style=0) self.staticText15 = wx.StaticText(id=wxID_FRAME1STATICTEXT15, label=u'Pekerjaan Utama', name='staticText15', parent=self, pos=wx.Point(400, 280), size=wx.Size(103, 17), style=0) self.choice7 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE7, name='choice7', parent=self, pos=wx.Point(400, 296), size=wx.Size(216, 25), style=0) self.staticText16 = wx.StaticText(id=wxID_FRAME1STATICTEXT16, label=u'Pekerjaan Lainnya', name='staticText16', parent=self, pos=wx.Point(400, 328), size=wx.Size(110, 17), style=0) self.textCtrl8 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL8, name='textCtrl8', parent=self, pos=wx.Point(400, 344), size=wx.Size(216, 25), style=0, value=u'') self.staticText17 = wx.StaticText(id=wxID_FRAME1STATICTEXT17, label=u'Status Perkawinan', name='staticText17', parent=self, pos=wx.Point(632, 88), size=wx.Size(112, 17), style=0) self.choice8 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE8, name='choice8', parent=self, pos=wx.Point(632, 104), size=wx.Size(248, 25), style=0) self.staticText18 = wx.StaticText(id=wxID_FRAME1STATICTEXT18, label=u'Status Kependudukan', name='staticText18', parent=self, pos=wx.Point(632, 136), size=wx.Size(134, 17), style=0) self.choice9 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE9, name='choice9', parent=self, pos=wx.Point(632, 152), size=wx.Size(248, 25), style=0) self.staticBox4 = wx.StaticBox(id=wxID_FRAME1STATICBOX4, label=u'Hubungan Dengan Keluarga', name='staticBox4', parent=self, pos=wx.Point(8, 392), size=wx.Size(888, 100), style=0) self.genBitmapTextButton2 = wx.lib.buttons.GenBitmapTextButton(bitmap=wx.NullBitmap, id=wxID_FRAME1GENBITMAPTEXTBUTTON2, label=u'Simpaan & Tambah Data', name='genBitmapTextButton2', parent=self, pos=wx.Point(184, 504), size=wx.Size(184, 31), style=0) self.genBitmapTextButton3 = wx.lib.buttons.GenBitmapTextButton(bitmap=wx.NullBitmap, id=wxID_FRAME1GENBITMAPTEXTBUTTON3, label=u'Simpan & Ke Menu Utama', name='genBitmapTextButton3', parent=self, pos=wx.Point(376, 504), size=wx.Size(192, 31), style=0) self.genBitmapTextButton4 = wx.lib.buttons.GenBitmapTextButton(bitmap=wx.NullBitmap, id=wxID_FRAME1GENBITMAPTEXTBUTTON4, label=u'Batal Simpan', name='genBitmapTextButton4', parent=self, pos=wx.Point(576, 504), size=wx.Size(136, 31), style=0) self.staticText19 = wx.StaticText(id=wxID_FRAME1STATICTEXT19, label=u'Status Tinggal', name='staticText19', parent=self, pos=wx.Point(632, 184), size=wx.Size(84, 17), style=0) self.choice10 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE10, name='choice10', parent=self, pos=wx.Point(632, 200), size=wx.Size(248, 25), style=0) self.staticText20 = wx.StaticText(id=wxID_FRAME1STATICTEXT20, label=u'Penyandang Difabelitas', name='staticText20', parent=self, pos=wx.Point(632, 232), size=wx.Size(141, 17), style=0) self.choice11 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE11, name='choice11', parent=self, pos=wx.Point(632, 248), size=wx.Size(248, 25), style=0) self.staticText21 = wx.StaticText(id=wxID_FRAME1STATICTEXT21, label=u'Penggunaan Kontrasepsi', name='staticText21', parent=self, pos=wx.Point(632, 280), size=wx.Size(150, 17), style=0) self.choice12 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE12, name='choice12', parent=self, pos=wx.Point(632, 296), size=wx.Size(248, 25), style=0) self.staticText22 = wx.StaticText(id=wxID_FRAME1STATICTEXT22, label=u'Kepemilikan Dokumen', name='staticText22', parent=self, pos=wx.Point(632, 328), size=wx.Size(136, 17), style=0) self.choice13 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE13, name='choice13', parent=self, pos=wx.Point(632, 344), size=wx.Size(248, 25), style=0) self.staticText23 = wx.StaticText(id=wxID_FRAME1STATICTEXT23, label=u'Status Hubungan Dalam Keluarga', name='staticText23', parent=self, pos=wx.Point(32, 416), size=wx.Size(201, 17), style=0) self.choice14 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE14, name='choice14', parent=self, pos=wx.Point(32, 432), size=wx.Size(304, 25), style=0) self.staticText24 = wx.StaticText(id=wxID_FRAME1STATICTEXT24, label=u'Nama Ayah', name='staticText24', parent=self, pos=wx.Point(344, 416), size=wx.Size(70, 17), style=0) self.textCtrl9 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL9, name='textCtrl9', parent=self, pos=wx.Point(344, 432), size=wx.Size(280, 25), style=0, value=u'') self.staticText25 = wx.StaticText(id=wxID_FRAME1STATICTEXT25, label=u'Nama Ibu', name='staticText25', parent=self, pos=wx.Point(632, 416), size=wx.Size(61, 17), style=0) self.textCtrl10 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL10, name='textCtrl10', parent=self, pos=wx.Point(632, 432), size=wx.Size(240, 25), style=0, value=u'')
def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_LOGIN_INPUT_PENDUDUK, name=u'login_input_penduduk', parent=prnt, pos=wx.Point(479, 317), size=wx.Size(414, 170), style=wx.DEFAULT_FRAME_STYLE, title=u'login') self.SetClientSize(wx.Size(412, 145)) self.label_password = wx.StaticText( id=wxID_LOGIN_INPUT_PENDUDUKLABEL_PASSWORD, label=u'Password', name=u'label_password', parent=self, pos=wx.Point(16, 56), size=wx.Size(64, 24), style=0) self.input_password = wx.TextCtrl( id=wxID_LOGIN_INPUT_PENDUDUKINPUT_PASSWORD, name=u'input_password', parent=self, pos=wx.Point(96, 56), size=wx.Size(296, 25), style=wx.TE_PASSWORD, value='') self.label_masukan_password = wx.StaticText( id=wxID_LOGIN_INPUT_PENDUDUKLABEL_MASUKAN_PASSWORD, label=u'MASUKAN PASSWORD DAHULU', name=u'label_masukan_password', parent=self, pos=wx.Point(104, 16), size=wx.Size(203, 17), style=0) self.tombol_lanjutkan = wx.Button( id=wxID_LOGIN_INPUT_PENDUDUKTOMBOL_LANJUTKAN, label=u'Lanjutkan', name=u'tombol_lanjutkan', parent=self, pos=wx.Point(208, 96), size=wx.Size(184, 30), style=0) self.tombol_lanjutkan.SetBitmap( wx.Bitmap(u'/home/gedhe/python-sideka/png/a.png', wx.BITMAP_TYPE_PNG)) self.tombol_lanjutkan.Bind( wx.EVT_BUTTON, self.OnTombol_lanjutkanButton, id=wxID_LOGIN_INPUT_PENDUDUKTOMBOL_LANJUTKAN) self.tombol_kembali_kemenu = wx.Button( id=wxID_LOGIN_INPUT_PENDUDUKTOMBOL_KEMBALI_KEMENU, label=u'Kembali Ke Menu', name=u'tombol_kembali_kemenu', parent=self, pos=wx.Point(16, 96), size=wx.Size(184, 30), style=0) self.tombol_kembali_kemenu.SetBitmap( wx.Bitmap(u'/home/gedhe/python-sideka/png/a.png', wx.BITMAP_TYPE_PNG)) self.tombol_kembali_kemenu.Bind( wx.EVT_BUTTON, self.OnTombol_kembali_kemenuButton, id=wxID_LOGIN_INPUT_PENDUDUKTOMBOL_KEMBALI_KEMENU) self.garis_atas = wx.StaticLine(id=wxID_LOGIN_INPUT_PENDUDUKGARIS_ATAS, name=u'garis_atas', parent=self, pos=wx.Point(16, 40), size=wx.Size(368, 2), style=0)
def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt, pos=wx.Point(563, 189), size=wx.Size(326, 453), style=wx.FRAME_NO_TASKBAR, title=u'Input Data Kemiskinan') self.SetClientSize(wx.Size(326, 453)) self.staticBitmap1 = wx.StaticBitmap(bitmap=wx.Bitmap( 'png/sideka.png', wx.BITMAP_TYPE_PNG), id=wxID_FRAME1STATICBITMAP1, name='staticBitmap1', parent=self, pos=wx.Point(16, 0), size=wx.Size(276, 65), style=0) self.staticBox1 = wx.StaticBox(id=wxID_FRAME1STATICBOX1, label=u'Cari KK Untuk Input', name='staticBox1', parent=self, pos=wx.Point(8, 64), size=wx.Size(304, 120), style=0) self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1, label=u'Nomor KK', name='staticText1', parent=self, pos=wx.Point(24, 88), size=wx.Size(63, 17), style=0) self.textCtrl1 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL1, name='textCtrl1', parent=self, pos=wx.Point(24, 104), size=wx.Size(272, 25), style=0, value='textCtrl1') self.genBitmapTextButton1 = wx.lib.buttons.GenBitmapTextButton( bitmap=wx.NullBitmap, id=wxID_FRAME1GENBITMAPTEXTBUTTON1, label=u'Cari Untuk Input', name='genBitmapTextButton1', parent=self, pos=wx.Point(152, 136), size=wx.Size(144, 31), style=0) self.staticBox2 = wx.StaticBox(id=wxID_FRAME1STATICBOX2, label=u'Inputa Data Kemiskinan', name='staticBox2', parent=self, pos=wx.Point(8, 184), size=wx.Size(304, 176), style=0) self.staticText2 = wx.StaticText(id=wxID_FRAME1STATICTEXT2, label=u'Nomor KK', name='staticText2', parent=self, pos=wx.Point(24, 208), size=wx.Size(63, 17), style=0) self.textCtrl2 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL2, name='textCtrl2', parent=self, pos=wx.Point(24, 232), size=wx.Size(272, 25), style=0, value='textCtrl2') self.staticText3 = wx.StaticText(id=wxID_FRAME1STATICTEXT3, label=u'Alamat', name='staticText3', parent=self, pos=wx.Point(24, 256), size=wx.Size(43, 17), style=0) self.textCtrl3 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL3, name='textCtrl3', parent=self, pos=wx.Point(24, 272), size=wx.Size(272, 25), style=0, value='textCtrl3') self.staticText4 = wx.StaticText(id=wxID_FRAME1STATICTEXT4, label=u'Status Kemiskinan', name='staticText4', parent=self, pos=wx.Point(24, 304), size=wx.Size(111, 17), style=0) self.genBitmapTextButton2 = wx.lib.buttons.GenBitmapTextButton( bitmap=wx.NullBitmap, id=wxID_FRAME1GENBITMAPTEXTBUTTON2, label=u'Simpan Dan Tambah', name='genBitmapTextButton2', parent=self, pos=wx.Point(16, 368), size=wx.Size(152, 31), style=0) self.genBitmapTextButton3 = wx.lib.buttons.GenBitmapTextButton( bitmap=wx.NullBitmap, id=wxID_FRAME1GENBITMAPTEXTBUTTON3, label=u'Simpan', name='genBitmapTextButton3', parent=self, pos=wx.Point(176, 368), size=wx.Size(136, 31), style=0) self.genBitmapTextButton4 = wx.lib.buttons.GenBitmapTextButton( bitmap=wx.NullBitmap, id=wxID_FRAME1GENBITMAPTEXTBUTTON4, label=u'Batal', name='genBitmapTextButton4', parent=self, pos=wx.Point(104, 408), size=wx.Size(136, 31), style=0) self.genBitmapTextButton4.Bind(wx.EVT_BUTTON, self.OnGenBitmapTextButton4Button, id=wxID_FRAME1GENBITMAPTEXTBUTTON4) self.choice1 = wx.Choice(choices=[], id=wxID_FRAME1CHOICE1, name='choice1', parent=self, pos=wx.Point(24, 320), size=wx.Size(272, 25), style=0)
def _init_ctrls(self, prnt): wx.SplitterWindow.__init__(self, id=ID_EDITINGPANEL, name='MainSplitter', parent=prnt, point=wx.Point(0, 0), size=wx.Size(-1, -1), style=wx.SP_3D) self._init_utils() self.SetNeedUpdating(True) self.PartList = wx.ListBox(choices=[], id=ID_EDITINGPANELPARTLIST, name='PartList', parent=self, pos=wx.Point(0, 0), size=wx.Size(-1, -1), style=0) self.PartList.Bind(wx.EVT_LISTBOX, self.OnPartListBoxClick, id=ID_EDITINGPANELPARTLIST) self.SecondSplitter = wx.SplitterWindow(id=ID_EDITINGPANELSECONDSPLITTER, name='SecondSplitter', parent=self, point=wx.Point(0, 0), size=wx.Size(-1, -1), style=wx.SP_3D) self.SplitHorizontally(self.PartList, self.SecondSplitter, 110) self.SetMinimumPaneSize(1) self.SubindexGridPanel = wx.Panel(id=ID_EDITINGPANELSUBINDEXGRIDPANEL, name='SubindexGridPanel', parent=self.SecondSplitter, pos=wx.Point(0, 0), size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL) self.IndexListPanel = wx.Panel(id=ID_EDITINGPANELINDEXLISTPANEL, name='IndexListPanel', parent=self.SecondSplitter, pos=wx.Point(0, 0), size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL) self.SecondSplitter.SplitVertically(self.IndexListPanel, self.SubindexGridPanel, 280) self.SecondSplitter.SetMinimumPaneSize(1) self.SubindexGrid = wx.grid.Grid(id=ID_EDITINGPANELSUBINDEXGRID, name='SubindexGrid', parent=self.SubindexGridPanel, pos=wx.Point(0, 0), size=wx.Size(-1, -1), style=0) self.SubindexGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False, 'Sans')) self.SubindexGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL, False, 'Sans')) self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnSubindexGridCellChange) self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.OnSubindexGridRightClick) self.SubindexGrid.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnSubindexGridSelectCell) self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnSubindexGridCellLeftClick) self.SubindexGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN, self.OnSubindexGridEditorShown) self.CallbackCheck = wx.CheckBox(id=ID_EDITINGPANELCALLBACKCHECK, label=_('Have Callbacks'), name='CallbackCheck', parent=self.SubindexGridPanel, pos=wx.Point(0, 0), size=wx.Size(152, 24), style=0) self.CallbackCheck.Bind(wx.EVT_CHECKBOX, self.OnCallbackCheck, id=ID_EDITINGPANELCALLBACKCHECK) self.IndexList = wx.ListBox(choices=[], id=ID_EDITINGPANELINDEXLIST, name='IndexList', parent=self.IndexListPanel, pos=wx.Point(0, 0), size=wx.Size(-1, -1), style=0) self.IndexList.Bind(wx.EVT_LISTBOX, self.OnIndexListClick, id=ID_EDITINGPANELINDEXLIST) self.IndexList.Bind(wx.EVT_RIGHT_UP, self.OnIndexListRightUp) self.AddButton = wx.Button(id=ID_EDITINGPANELADDBUTTON, label=_('Add'), name='AddButton', parent=self.IndexListPanel, pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) self.AddButton.Bind(wx.EVT_BUTTON, self.OnAddButtonClick, id=ID_EDITINGPANELADDBUTTON) self.IndexChoice = wx.ComboBox(choices=[], id=ID_EDITINGPANELINDEXCHOICE, name='IndexChoice', parent=self.IndexListPanel, pos=wx.Point(50, 0), size=wx.Size(-1, 30), style=wx.CB_READONLY) self._init_sizers()
def DrawVertBandInverted(self, dc, rect): """ Draws vertical bands inverted. :param `dc`: an instance of :class:`wx.DC`; :param `rect`: the vertical bands client rectangle. """ vertBands = (self._ledBands > 1 and [self._ledBands] or [self._maxValue*BAND_PERCENT//100])[0] minVertLimit = self._minValue*vertBands//self._maxValue medVertLimit = self._medValue*vertBands//self._maxValue maxVertLimit = vertBands size = wx.Size(rect.width//self._numBands, rect.height//vertBands) rectBand = wx.Rect(rect.GetTopLeft(), size) # Draw band from top? rectBand.Offset(0, 0) xDecal = (self._numBands > 1 and [1] or [0])[0] yDecal = (self._ledBands > 1 and [1] or [0])[0] for horz in range(self._numBands): self._value = self._meterData[horz]._value vertLimit = self._value*vertBands//self._maxValue rectPrev = wx.Rect(*rectBand) for vert in range(vertBands): rectBand.Deflate(xDecal, 0) # Find colour based on range value colourRect = self._clrBackground if self._showGrid: colourRect = DarkenColour(self._clrBackground, GRID_INCREASEBY) # Draw grid line (level) bar if self._showGrid and (vert == minVertLimit or vert == (vertBands-1)): points = [wx.Point() for i in range(2)] points[0].x = rectBand.GetTopLeft().x - xDecal points[0].y = rectBand.GetTopLeft().y + (rectBand.height >> 1) points[1].x = rectBand.GetBottomRight().x + xDecal points[1].y = points[0].y dc.DrawLine(points[0], points[1]) if vert < vertLimit: if InRange(vert, 0, minVertLimit-1): colourRect = self._clrNormal elif InRange(vert, minVertLimit, medVertLimit-1): colourRect = self._clrMedium elif InRange(vert, medVertLimit, maxVertLimit): colourRect = self._clrHigh dc.SetBrush(wx.Brush(colourRect)) dc.DrawRectangle(rectBand) rectBand.Inflate(xDecal, 0) rectBand.Offset(0, size.y) # Draw falloff effect if self._showFalloff: oldPen = dc.GetPen() pen = wx.Pen(DarkenColour(self._clrBackground, FALL_INCREASEBY)) maxHeight = -size.y*vertBands points = [wx.Point() for i in range(2)] points[0].x = rectPrev.GetBottomLeft().x + xDecal points[0].y = rectPrev.GetTopRight().y - self._meterData[horz]._falloff*maxHeight/self._maxValue points[1].x = rectPrev.GetTopRight().x - xDecal points[1].y = points[0].y dc.SetPen(pen) dc.DrawLine(points[0], points[1]) dc.SetPen(oldPen) # Move to Next Horizontal band rectBand.Offset(size.x, -size.y*vertBands)
def DrawHorzBand(self, dc, rect): """ Draws horizontal bands. :param `dc`: an instance of :class:`wx.DC`; :param `rect`: the horizontal bands client rectangle. .. todo:: Implement falloff effect for horizontal bands. """ horzBands = (self._ledBands > 1 and [self._ledBands] or [self._maxValue*BAND_PERCENT//100])[0] minHorzLimit = self._minValue*horzBands//self._maxValue medHorzLimit = self._medValue*horzBands//self._maxValue maxHorzLimit = horzBands size = wx.Size(rect.width//horzBands, rect.height//self._numBands) rectBand = wx.Rect(rect.GetTopLeft(), size) # Draw band from top rectBand.Offset(0, rect.height-size.y*self._numBands) xDecal = (self._ledBands > 1 and [1] or [0])[0] yDecal = (self._numBands > 1 and [1] or [0])[0] rectPrev = wx.Rect(*rectBand) for vert in range(self._numBands): self._value = self._meterData[vert]._value horzLimit = self._value*horzBands//self._maxValue for horz in range(horzBands): rectBand.Deflate(0, yDecal) # Find colour based on range value colourRect = self._clrBackground if self._showGrid: colourRect = DarkenColour(self._clrBackground, GRID_INCREASEBY) if self._showGrid and (horz == minHorzLimit or horz == (horzBands-1)): points = [wx.Point() for i in range(2)] points[0].x = rectBand.GetTopLeft().x + (rectBand.width >> 1) points[0].y = rectBand.GetTopLeft().y - yDecal points[1].x = points[0].x points[1].y = rectBand.GetBottomRight().y + yDecal dc.DrawLine(points[0], points[1]) if horz < horzLimit: if InRange(horz, 0, minHorzLimit-1): colourRect = self._clrNormal elif InRange(horz, minHorzLimit, medHorzLimit-1): colourRect = self._clrMedium elif InRange(horz, medHorzLimit, maxHorzLimit): colourRect = self._clrHigh dc.SetBrush(wx.Brush(colourRect)) dc.DrawRectangle(rectBand) rectBand.Inflate(0, yDecal) rectBand.Offset(size.x, 0) # Draw falloff effect (Seems to be working now.) if self._showFalloff: oldPen = dc.GetPen() pen = wx.Pen(DarkenColour(self._clrBackground, FALL_INCREASEBY)) maxWidth = size.x*horzBands points = [wx.Point() for i in range(2)] points[0].y = rectPrev.GetTopRight().y - yDecal points[0].x = rectPrev.GetBottomLeft().x + self._meterData[vert]._falloff*maxWidth/self._maxValue points[1].y = rectPrev.GetBottomLeft().y + yDecal points[1].x = points[0].x dc.SetPen(pen) dc.DrawLine(points[0], points[1]) dc.SetPen(oldPen) # Move to Next Vertical band rectBand.Offset(-size.x*horzBands, size.y)
def _init_ctrls(self, prnt): # generated method, don't edit wx.Dialog.__init__(self, id=wxID_DIALOG2, name='', parent=prnt, pos=wx.Point(302, 249), size=wx.Size(597, 281), style=wx.DEFAULT_DIALOG_STYLE, title='About Notebook') self.SetClientSize(wx.Size(581, 245)) self.staticText1 = wx.StaticText( id=wxID_DIALOG2STATICTEXT1, label='Notebook - Simple text editor.', name='staticText1', parent=self, pos=wx.Point(4, 4), size=wx.Size(681, 24), style=wx.ALIGN_CENTRE) self.staticText1.SetFont( wx.Font(14, wx.SWISS, wx.NORMAL, wx.NORMAL, False, 'Microsoft Sans Serif')) self.staticText2 = wx.StaticText( id=wxID_DIALOG2STATICTEXT2, label='This is my first Boa Contstructor application', name='staticText2', parent=self, pos=wx.Point(244, 32), size=wx.Size(201, 13), style=0) self.staticText2.SetBackgroundColour(wx.Colour(255, 255, 0)) self.staticBitmap1 = wx.StaticBitmap(bitmap=wx.Bitmap( 'Boa.jpg', wx.BITMAP_TYPE_JPEG), id=wxID_DIALOG2STATICBITMAP1, name='staticBitmap1', parent=self, pos=wx.Point(173, 53), size=wx.Size(236, 157), style=0) self.staticBitmap2 = wx.StaticBitmap(bitmap=wx.Bitmap( 'Debian.png', wx.BITMAP_TYPE_PNG), id=wxID_DIALOG2STATICBITMAP2, name='staticBitmap2', parent=self, pos=wx.Point(52, 116), size=wx.Size(117, 31), style=0) self.staticBitmap3 = wx.StaticBitmap(bitmap=wx.Bitmap( 'wxWidgetsButton.png', wx.BITMAP_TYPE_PNG), id=wxID_DIALOG2STATICBITMAP3, name='staticBitmap3', parent=self, pos=wx.Point(413, 107), size=wx.Size(116, 49), style=0) self.button1 = wx.Button(id=wxID_DIALOG2BUTTON1, label='Close', name='button1', parent=self, pos=wx.Point(253, 218), size=wx.Size(75, 23), style=0) self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button, id=wxID_DIALOG2BUTTON1) self._init_sizers()
def _init_ctrls(self, prnt): wx.Frame.__init__(self, id=wxID_STBFRAME, name=u'stbFrame', parent=prnt, pos=wx.Point(20, 25), size=wx.Size(600, 120), style=wx.DEFAULT_FRAME_STYLE, title=u'Set Touchscreen Brightness:') self.SetClientSize(wx.Size(600, 120)) self.brtLevel = wx.Slider(id=wxID_STBFRAMEBRTLEVEL, maxValue=255, minValue=0, name=u'brtLevel', parent=self, pos=wx.Point(20, 20), size=wx.Size(500, 29), style=wx.SL_HORIZONTAL, value=20) self.brtLevel.SetLabel(u'Brightness') self.brtLevel.SetThumbLength(90) self.brtLevel.SetRange(0, 255) self.brtLevel.Bind(wx.EVT_LEFT_UP, self.OnBrtLevelLeftUp) self.brtLevel.Bind(wx.EVT_SCROLL, self.OnBrtLevelScroll) self.levelStr = wx.TextCtrl(id=wxID_STBFRAMELEVELSTR, name=u'levelStr', parent=self, pos=wx.Point(520, 20), size=wx.Size(60, 32), style=0, value=u'100') self.levelStr.SetEditable(False) self.levelStr.SetToolTipString(u'Brightness Level') self.levelStr.SetMaxLength(3) self.minLevelBt = wx.Button(id=wxID_STBFRAMEMINLEVELBT, label=u'&Minimize', name=u'minLevelBt', parent=self, pos=wx.Point(30, 60), size=wx.Size(110, 33), style=0) self.minLevelBt.SetToolTipString(u'Dim Screen') self.minLevelBt.Bind(wx.EVT_LEFT_UP, self.OnMinLevelBtLeftUp) self.maxLevelBt = wx.Button(id=wxID_STBFRAMEMAXLEVELBT, label=u'Ma&ximize', name=u'maxLevelBt', parent=self, pos=wx.Point(456, 60), size=wx.Size(110, 33), style=0) self.maxLevelBt.Bind(wx.EVT_LEFT_UP, self.OnMaxLevelBtLeftUp) self.doneBt = wx.Button(id=wxID_STBFRAMEDONEBT, label=u'D&ONE!', name=u'doneBt', parent=self, pos=wx.Point(250, 60), size=wx.Size(86, 33), style=0) self.doneBt.Bind(wx.EVT_LEFT_UP, self.OnDoneBtLeftUp)
def updatePosition(self): if "pos" not in self.__params: winCenterPoint = _GG("WindowObject").GetMainWindowCenterPoint(); self.SetPosition(wx.Point(winCenterPoint.x - self.GetSize()[0]/2, winCenterPoint.y - self.GetSize()[1]/2));
def _init_ctrls(self, prnt): # generated method, don't edit wx.Dialog.__init__(self, id=wxID_DIALOGEDITSPECTRUM, name='DialogEditSpectrum', parent=prnt, pos=wx.Point(389, 242), size=wx.Size(695, 554), style=wx.DEFAULT_FRAME_STYLE, title='Spectrum') self.SetClientSize(wx.Size(679, 518)) self.Bind(wx.EVT_ACTIVATE, self.OnDialogEditSpectrumActivate) self.panelActions = wx.Panel(id=wxID_DIALOGEDITSPECTRUMPANELACTIONS, name='panelActions', parent=self, pos=wx.Point(5, 28), size=wx.Size(669, 56), style=wx.TAB_TRAVERSAL) self.staticTextDescription = wx.StaticText( id=wxID_DIALOGEDITSPECTRUMSTATICTEXTDESCRIPTION, label='Colony code: A012A; file name: a012a.1.DAT; Status: ACTIVE', name='staticTextDescription', parent=self, pos=wx.Point(5, 5), size=wx.Size(669, 13), style=0) self.staticTextDescription.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD, False, 'MS Shell Dlg 2')) self.buttonActivate = wx.Button( id=wxID_DIALOGEDITSPECTRUMBUTTONACTIVATE, label='&Activate', name='buttonActivate', parent=self.panelActions, pos=wx.Point(90, 5), size=wx.Size(75, 23), style=0) self.buttonActivate.Bind(wx.EVT_BUTTON, self.OnButtonActivateButton, id=wxID_DIALOGEDITSPECTRUMBUTTONACTIVATE) self.buttonDeactivate = wx.Button( id=wxID_DIALOGEDITSPECTRUMBUTTONDEACTIVATE, label='&Deactivate', name='buttonDeactivate', parent=self.panelActions, pos=wx.Point(175, 5), size=wx.Size(75, 23), style=0) self.buttonDeactivate.Bind(wx.EVT_BUTTON, self.OnButtonDeactivateButton, id=wxID_DIALOGEDITSPECTRUMBUTTONDEACTIVATE) self.notebook1 = wx.Notebook(id=wxID_DIALOGEDITSPECTRUMNOTEBOOK1, name='notebook1', parent=self, pos=wx.Point(5, 94), size=wx.Size(669, 419), style=0) self.panelChart = wx.Panel(id=wxID_DIALOGEDITSPECTRUMPANELCHART, name='panelChart', parent=self.notebook1, pos=wx.Point(0, 0), size=wx.Size(661, 393), style=wx.TAB_TRAVERSAL) self.textCtrlReport = wx.TextCtrl( id=wxID_DIALOGEDITSPECTRUMTEXTCTRLREPORT, name='textCtrlReport', parent=self.notebook1, pos=wx.Point(0, 0), size=wx.Size(661, 393), style=wx.TE_MULTILINE, value='') self.buttonReload = wx.Button(id=wxID_DIALOGEDITSPECTRUMBUTTONRELOAD, label='Re&load', name='buttonReload', parent=self.panelActions, pos=wx.Point(5, 5), size=wx.Size(75, 23), style=0) self.buttonReload.Bind(wx.EVT_BUTTON, self.OnButtonReloadButton, id=wxID_DIALOGEDITSPECTRUMBUTTONRELOAD) self.panelComments = wx.Panel(id=wxID_DIALOGEDITSPECTRUMPANELCOMMENTS, name='panelComments', parent=self.panelActions, pos=wx.Point(255, 0), size=wx.Size(414, 56), style=wx.TAB_TRAVERSAL) self.staticTextComments = wx.StaticText( id=wxID_DIALOGEDITSPECTRUMSTATICTEXTCOMMENTS, label='Comments', name='staticTextComments', parent=self.panelComments, pos=wx.Point(5, 5), size=wx.Size(51, 13), style=0) self.textCtrlComments = wx.TextCtrl( id=wxID_DIALOGEDITSPECTRUMTEXTCTRLCOMMENTS, name='textCtrlComments', parent=self.panelComments, pos=wx.Point(66, 5), size=wx.Size(268, 46), style=wx.TE_MULTILINE, value='') self.buttonSave = wx.Button(id=wxID_DIALOGEDITSPECTRUMBUTTONSAVE, label='&Save', name='buttonSave', parent=self.panelComments, pos=wx.Point(339, 0), size=wx.Size(75, 23), style=0) self.buttonSave.Bind(wx.EVT_BUTTON, self.OnButtonSaveButton, id=wxID_DIALOGEDITSPECTRUMBUTTONSAVE) self._init_coll_notebook1_Pages(self.notebook1) self._init_sizers()
def UpdateSkin(self): key = self.skinkey self.native = native = not key if native: self.OpenNativeTheme() self.padding = wx.Point(2, 2) self.framesize = Margins([1, 1, 1, 1]) #[0,0,0,0] if uxthemed else sz = self.Parent.Sizer if sz: sz.Detach(1) sz.Detach(1) sz.Add(wx.Size(self.framesize.left, self.framesize.top), (0, 0)) sz.Add(wx.Size(self.framesize.right, self.framesize.bottom), (2, 2)) self.framebg = None self.menubg = None self.itembg = None self.selbg = None self.Font = default_font() self.normalfc = wx.SystemSettings_GetColour( wx.SYS_COLOUR_WINDOWTEXT) self.selfc = wx.SystemSettings_GetColour( wx.SYS_COLOUR_HIGHLIGHTTEXT) self.MakeNativeSubmenuIcons() self.separator = None else: self.CloseNativeTheme() s = lambda k, default: skin.get('%s.%s' % (key, k), default) self.padding = s('padding', wx.Point(2, 2)) self.framesize = s('framesize', Margins([0, 0, 0, 0])) sz = self.Parent.Sizer if sz: sz.Detach(1) sz.Detach(1) sz.Add(wx.Size(self.framesize.left, self.framesize.top), (0, 0)) sz.Add(wx.Size(self.framesize.right, self.framesize.bottom), (2, 2)) self.framebg = s('frame', lambda: SkinColor(wx.BLACK)) self.menubg = s('backgrounds.menu', None) self.itembg = s('backgrounds.item', None) self.selbg = s('backgrounds.selection', None) self.Font = s('font', default_font()) self.normalfc = s('fontcolors.normal', lambda: wx.BLACK) self.selfc = s('fontcolors.selection', lambda: wx.BLACK) #TODO: Default? submenuicon = self.submenuicon = s('submenuicon', None) if submenuicon is None: self.MakeNativeSubmenuIcons() else: self.submenuiconhot = s('submenuiconhover', submenuicon) #TODO: Default? self.separator = s('separatorimage', None) for item in self.items: if item.menu: item.menu.spine.SetSkinKey(key)
def __init__(self, parent, controller=None, window=None, enable_required=True): wx.Notebook.__init__(self, parent) self.Controller = controller self.ParentWindow = window self.Values = None # Project Panel elements self.ProjectPanel = wx.Panel(self, style=wx.TAB_TRAVERSAL) projectpanel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=5, vgap=15) projectpanel_sizer.AddGrowableCol(1) self.ProjectPanel.SetSizer(projectpanel_sizer) self.AddSizerParams( self.ProjectPanel, projectpanel_sizer, [("projectName", _('Project Name (required):')), ("projectVersion", _('Project Version (optional):')), ("productName", _('Product Name (required):')), ("productVersion", _('Product Version (required):')), ("productRelease", _('Product Release (optional):'))]) self.AddPage(self.ProjectPanel, _("Project")) # Author Panel elements self.AuthorPanel = wx.Panel(self, style=wx.TAB_TRAVERSAL) authorpanel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=4, vgap=15) authorpanel_sizer.AddGrowableCol(1) self.AuthorPanel.SetSizer(authorpanel_sizer) self.AddSizerParams(self.AuthorPanel, authorpanel_sizer, [("companyName", _('Company Name (required):')), ("companyURL", _('Company URL (optional):')), ("authorName", _('Author Name (optional):')), ("organization", _('Organization (optional):'))]) self.AddPage(self.AuthorPanel, _("Author")) # Graphics Panel elements self.GraphicsPanel = wx.Panel(self, style=wx.TAB_TRAVERSAL) graphicpanel_sizer = wx.FlexGridSizer(cols=1, hgap=5, rows=4, vgap=5) graphicpanel_sizer.AddGrowableCol(0) graphicpanel_sizer.AddGrowableRow(3) self.GraphicsPanel.SetSizer(graphicpanel_sizer) pageSize_st = wx.StaticText(self.GraphicsPanel, label=_('Page Size (optional):')) graphicpanel_sizer.AddWindow(pageSize_st, border=10, flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.LEFT | wx.RIGHT) pageSize_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=5) pageSize_sizer.AddGrowableCol(1) graphicpanel_sizer.AddSizer(pageSize_sizer, border=10, flag=wx.GROW | wx.LEFT | wx.RIGHT) for name, label in [('PageWidth', _('Width:')), ('PageHeight', _('Height:'))]: st = wx.StaticText(self.GraphicsPanel, label=label) pageSize_sizer.AddWindow(st, border=12, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT) sp = wx.SpinCtrl(self.GraphicsPanel, min=0, max=2**16, style=wx.TE_PROCESS_ENTER) setattr(self, name, sp) callback = self.GetPageSizeChangedFunction(sp, name) self.Bind(wx.EVT_TEXT_ENTER, callback, sp) sp.Bind(wx.EVT_KILL_FOCUS, callback) pageSize_sizer.AddWindow(sp, flag=wx.GROW) scaling_st = wx.StaticText(self.GraphicsPanel, label=_('Grid Resolution:')) graphicpanel_sizer.AddWindow(scaling_st, border=10, flag=wx.GROW | wx.LEFT | wx.RIGHT) scaling_nb = wx.Notebook(self.GraphicsPanel) graphicpanel_sizer.AddWindow(scaling_nb, border=10, flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT) self.Scalings = {} for language, translation in [("FBD", _("FBD")), ("LD", _("LD")), ("SFC", _("SFC"))]: scaling_panel = wx.Panel(scaling_nb, style=wx.TAB_TRAVERSAL) scalingpanel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=5) scalingpanel_sizer.AddGrowableCol(1) scaling_panel.SetSizer(scalingpanel_sizer) scaling_controls = [] for idx, (name, label) in enumerate([('XScale', _('Horizontal:')), ('YScale', _('Vertical:'))]): if idx == 0: border = wx.TOP else: border = wx.BOTTOM st = wx.StaticText(scaling_panel, label=label) scalingpanel_sizer.AddWindow(st, border=10, flag=wx.ALIGN_CENTER_VERTICAL | border | wx.LEFT) sp = wx.SpinCtrl(scaling_panel, min=0, max=2**16, style=wx.TE_PROCESS_ENTER) scaling_controls.append(sp) callback = self.GetScalingChangedFunction(sp, language, name) self.Bind(wx.EVT_TEXT_ENTER, callback, sp) sp.Bind(wx.EVT_KILL_FOCUS, callback) scalingpanel_sizer.AddWindow(sp, border=10, flag=wx.GROW | border | wx.RIGHT) self.Scalings[language] = scaling_controls scaling_nb.AddPage(scaling_panel, translation) self.AddPage(self.GraphicsPanel, _("Graphics")) # Miscellaneous Panel elements self.MiscellaneousPanel = wx.Panel(id=-1, parent=self, name='MiscellaneousPanel', pos=wx.Point(0, 0), size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL) miscellaneouspanel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=15) miscellaneouspanel_sizer.AddGrowableCol(1) miscellaneouspanel_sizer.AddGrowableRow(1) self.MiscellaneousPanel.SetSizer(miscellaneouspanel_sizer) language_label = wx.StaticText(self.MiscellaneousPanel, label=_('Language (optional):')) miscellaneouspanel_sizer.AddWindow(language_label, border=10, flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.LEFT) self.Language = wx.ComboBox(self.MiscellaneousPanel, style=wx.CB_READONLY) self.Bind(wx.EVT_COMBOBOX, self.OnLanguageChanged, self.Language) miscellaneouspanel_sizer.AddWindow(self.Language, border=10, flag=wx.GROW | wx.TOP | wx.RIGHT) description_label = wx.StaticText( self.MiscellaneousPanel, label=_('Content Description (optional):')) miscellaneouspanel_sizer.AddWindow(description_label, border=10, flag=wx.BOTTOM | wx.LEFT) self.ContentDescription = wx.TextCtrl(self.MiscellaneousPanel, size=wx.Size(240, 150), style=wx.TE_MULTILINE | wx.TE_PROCESS_ENTER) self.Bind(wx.EVT_TEXT_ENTER, self.OnContentDescriptionChanged, self.ContentDescription) self.ContentDescription.Bind(wx.EVT_KILL_FOCUS, self.OnContentDescriptionChanged) miscellaneouspanel_sizer.AddWindow(self.ContentDescription, border=10, flag=wx.GROW | wx.BOTTOM | wx.RIGHT) self.AddPage(self.MiscellaneousPanel, _("Miscellaneous")) for param in REQUIRED_PARAMS: getattr(self, param).Enable(enable_required) languages = ["", "en-US", "fr-FR", "zh-CN", "ru-RU"] for language in languages: self.Language.Append(language)
def OnResize(self, evt: wx.Event) -> None: self.chat.SetSize( wx.Size(self.GetSize()[0], int(0.70 * self.GetSize()[1]))) self.input.SetSize( wx.Size(self.GetSize()[0], int(0.30 * self.GetSize()[1]))) self.input.SetPosition(wx.Point(0, self.chat.GetSize()[1] + 1))
def _init_ctrls(self, prnt): # generated method, don't edit wx.Dialog.__init__(self, id=wxID_EXTMETHDLG, name='ExtMethDlg', parent=prnt, pos=wx.Point(363, 248), size=wx.Size(267, 141), style=wx.DEFAULT_DIALOG_STYLE, title='Add External Method') self.SetClientSize(wx.Size(259, 114)) self.panel1 = wx.Panel(id=wxID_EXTMETHDLGPANEL1, name='panel1', parent=self, pos=wx.Point(0, 0), size=wx.Size(259, 114), style=wx.TAB_TRAVERSAL) self.staticText1 = wx.StaticText(id=wxID_EXTMETHDLGSTATICTEXT1, label='Module:', name='staticText1', parent=self.panel1, pos=wx.Point(8, 16), size=wx.Size(56, 13), style=0) self.staticText2 = wx.StaticText(id=wxID_EXTMETHDLGSTATICTEXT2, label='Function:', name='staticText2', parent=self.panel1, pos=wx.Point(8, 48), size=wx.Size(56, 13), style=0) self.cbModule = wx.ComboBox(choices=[], id=wxID_EXTMETHDLGCBMODULE, name='cbModule', parent=self.panel1, pos=wx.Point(72, 8), size=wx.Size(176, 21), style=0, value='') self.cbModule.Bind(wx.EVT_COMBOBOX, self.OnCbmoduleCombobox, id=wxID_EXTMETHDLGCBMODULE) self.chFunction = wx.ComboBox(choices=[], id=wxID_EXTMETHDLGCHFUNCTION, name='chFunction', parent=self.panel1, pos=wx.Point(72, 40), size=wx.Size(176, 21), style=0, value='') self.chFunction.Bind(wx.EVT_COMBOBOX, self.OnChfunctionCombobox, id=wxID_EXTMETHDLGCHFUNCTION) self.btOK = wx.Button(id=wxID_EXTMETHDLGBTOK, label='OK', name='btOK', parent=self.panel1, pos=wx.Point(96, 80), size=wx.Size(72, 24), style=0) self.btOK.Bind(wx.EVT_BUTTON, self.OnBtokButton, id=wxID_EXTMETHDLGBTOK) self.btCancel = wx.Button(id=wxID_EXTMETHDLGBTCANCEL, label='Cancel', name='btCancel', parent=self.panel1, pos=wx.Point(176, 80), size=wx.Size(72, 24), style=0) self.btCancel.Bind(wx.EVT_BUTTON, self.OnBtcancelButton, id=wxID_EXTMETHDLGBTCANCEL)
def __init__(self): """Constructor""" wx.Dialog.__init__(self, None, title="中文纠错", size=(1200, 1600)) # input sentence info input_sentence = wx.BoxSizer(wx.HORIZONTAL) input_sentence_lbl = wx.StaticText(self, -1, "语句输入", wx.Point(0, 10), wx.Size(50, 200)) input_sentence.Add(input_sentence_lbl, 0, wx.ALL | wx.CENTER, 5) self.input_sentence = wx.TextCtrl(self, -1, pos=(5, 160), size=(600, 120), style=wx.TE_MULTILINE | wx.HSCROLL) input_sentence.Add(self.input_sentence, 0, wx.ALL, 5) # output info -- jieba p_sizer = wx.BoxSizer(wx.HORIZONTAL) p_lbl = wx.StaticText(self, label="文字纠错--1:") #jieba p_sizer.Add(p_lbl, 0, wx.ALL | wx.CENTER, 5) self.output = wx.TextCtrl(self, pos=(5, 480), size=(600, 120), style=wx.TE_MULTILINE | wx.HSCROLL) p_sizer.Add(self.output, 0, wx.ALL, 5) # output info -- thulac phraser_thu = wx.BoxSizer(wx.HORIZONTAL) phraser_thu_lbl = wx.StaticText(self, label="文字纠错--2:") #thulac phraser_thu.Add(phraser_thu_lbl, 0, wx.ALL | wx.CENTER, 5) self.output_thu = wx.TextCtrl(self, pos=(5, 320), size=(600, 120), style=wx.TE_MULTILINE | wx.HSCROLL) phraser_thu.Add(self.output_thu, 0, wx.ALL, 5) # output info -- 分词结果 phraser_res = wx.BoxSizer(wx.HORIZONTAL) phraser_res_lbl = wx.StaticText(self, label="原文分词--1") #jieba phraser_res.Add(phraser_res_lbl, 0, wx.ALL | wx.CENTER, 5) self.output_phraser_res = wx.TextCtrl(self, pos=(5, 640), size=(600, 120), style=wx.TE_MULTILINE | wx.HSCROLL) phraser_res.Add(self.output_phraser_res, 0, wx.ALL, 5) main_sizer = wx.BoxSizer(wx.VERTICAL) main_sizer.Add(input_sentence, 0, wx.ALL, 5) main_sizer.Add(p_sizer, 0, wx.ALL, 5) main_sizer.Add(phraser_thu, 0, wx.ALL, 5) main_sizer.Add(phraser_res, 0, wx.ALL, 5) btn = wx.Button(self, -1, label="开始纠错", pos=(125, 320), size=(80, 50)) btn.Bind(wx.EVT_BUTTON, self.onCheck) main_sizer.Add(btn, 0, wx.ALL | wx.CENTER, 5) self.SetSizer(main_sizer)
self.pininfo.SetLabel(PortInfo[s][1]) self.okbutton.Enable(1) if PortInfo[s][0] == 'O': self.filename.Enable(0) self.browse.Enable(0) self.stimulusfile.Enable(0) else: self.filename.Enable(1) self.browse.Enable(1) self.stimulusfile.Enable(1) def OnBrowse(self, event): s = wx.FileSelector("Select stimulus file", self.lastPath, "", ".sti", "Stimulus files (*.sti)|*.sti|All files (*.*)|*.*", wx.OPEN|wx.FILE_MUST_EXIST, self) if s: self.filename.SetValue(s) def SlurpData(self): d = {} d['pin'] = self.listbox.GetStringSelection() d['filename'] = self.filename.GetValue() d['IO'] = PortInfo[d['pin']][0] return d if __name__ == "__main__": app = wx.App() d = LAWaveformProperties(None, -1, "Waveform Properties", wx.Point(-1,-1)) if d.ShowModal() == wx.ID_OK: dlgdata = d.SlurpData() print(dlgdata['pin']) print(dlgdata['filename']) print(dlgdata['IO'])
def _init_ctrls(self, prnt): # generated method, don't edit wx.Dialog.__init__(self, id=wxID_MAKEPYDIALOG, name='MakePyDialog', parent=prnt, pos=wx.Point(498, 119), size=wx.Size(420, 433), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER, title='COM Library Generator') self.SetAutoLayout(True) self.SetClientSize(wx.Size(412, 406)) self.Bind(wx.EVT_INIT_DIALOG, self.OnMakepydialogInitDialog) self.typeLibraryList = wx.ListCtrl(id=wxID_MAKEPYDIALOGTYPELIBRARYLIST, name='typeLibraryList', parent=self, pos=wx.Point(16, 40), size=wx.Size(376, 280), style=wx.LC_NO_HEADER | wx.LC_REPORT, validator=wx.DefaultValidator) self.typeLibraryList.SetToolTipString( 'List of the registered COM type libraries on your system') self.typeLibraryList.SetConstraints( LayoutAnchors(self.typeLibraryList, True, True, True, True)) self._init_coll_typeLibraryList_Columns(self.typeLibraryList) self.typeLibraryList.Bind(wx.EVT_LEFT_DCLICK, self.OnTypelibrarylistLeftDclick) self.OK = wx.Button(id=wxID_MAKEPYDIALOGOK, label='Generate', name='OK', parent=self, pos=wx.Point(200, 360), size=wx.Size(88, 27), style=0) self.OK.SetToolTipString( 'Click to generate a wrapper for the selected library') self.OK.SetConstraints(LayoutAnchors(self.OK, False, False, True, True)) self.OK.Bind(wx.EVT_BUTTON, self.OnOkButton, id=wxID_MAKEPYDIALOGOK) self.Cancel = wx.Button(id=wx.ID_CANCEL, label='Cancel', name='Cancel', parent=self, pos=wx.Point(304, 360), size=wx.Size(88, 27), style=0) self.Cancel.SetToolTipString('Cancel wrapper generation') self.Cancel.SetConstraints( LayoutAnchors(self.Cancel, False, False, True, True)) self.bForDemand = wx.CheckBox(id=wxID_MAKEPYDIALOGBFORDEMAND, label='Generate Classes on Demand', name='bForDemand', parent=self, pos=wx.Point(144, 328), size=wx.Size(248, 20), style=0) self.bForDemand.SetToolTipString( 'Minimises amount of code generated by only wrapping used classes (recommended). Clear to generate a single-file wrapper.' ) self.bForDemand.SetValue(True) self.bForDemand.SetConstraints( LayoutAnchors(self.bForDemand, False, False, True, True)) self.bForDemand.Bind(wx.EVT_CHECKBOX, self.OnBfordemandCheckbox, id=wxID_MAKEPYDIALOGBFORDEMAND) self.directSpecification = wx.TextCtrl( id=wxID_MAKEPYDIALOGDIRECTSPECIFICATION, name='directSpecification', parent=self, pos=wx.Point(16, 8), size=wx.Size(376, 28), style=0, value='') self.directSpecification.SetToolTipString( 'Type text here to search for matching type libraries') self.directSpecification.SetConstraints( LayoutAnchors(self.directSpecification, True, True, True, False)) self.directSpecification.Bind(wx.EVT_TEXT, self.OnDirectspecificationText, id=wxID_MAKEPYDIALOGDIRECTSPECIFICATION)
def Layout(self): if len(self.GetChildren()) == 0: return True origin_ = wx.Point( self._art.GetMetric(RIBBON_ART_PAGE_BORDER_LEFT_SIZE), self._art.GetMetric(RIBBON_ART_PAGE_BORDER_TOP_SIZE)) major_axis = self.GetMajorAxis() if self._scroll_buttons_visible: if major_axis == wx.HORIZONTAL: origin_.x -= self._scroll_amount if self._scroll_left_btn: origin_.x -= self._scroll_left_btn.GetSize().GetWidth() else: origin_.y -= self._scroll_amount if self._scroll_left_btn: origin_.y -= self._scroll_left_btn.GetSize().GetHeight() origin = wx.Point(*origin_) if major_axis == wx.HORIZONTAL: gap = self._art.GetMetric(RIBBON_ART_PANEL_X_SEPARATION_SIZE) minor_axis_size = self.GetSize().GetHeight( ) - origin.y - self._art.GetMetric( RIBBON_ART_PAGE_BORDER_BOTTOM_SIZE) else: gap = self._art.GetMetric(RIBBON_ART_PANEL_Y_SEPARATION_SIZE) minor_axis_size = self.GetSize().GetWidth( ) - origin.x - self._art.GetMetric( RIBBON_ART_PAGE_BORDER_RIGHT_SIZE) if minor_axis_size < 0: minor_axis_size = 0 for iteration in range(1, 3): for child in self.GetChildren(): w, h = child.GetSize() if major_axis == wx.HORIZONTAL: child.SetSize(origin.x, origin.y, w, minor_axis_size) origin.x += w + gap else: child.SetSize(origin.x, origin.y, minor_axis_size, h) origin.y += h + gap if iteration == 1: if major_axis == wx.HORIZONTAL: available_space = self._size_in_major_axis_for_children - self._art.GetMetric( RIBBON_ART_PAGE_BORDER_RIGHT_SIZE) - origin.x + gap else: available_space = self._size_in_major_axis_for_children - self._art.GetMetric( RIBBON_ART_PAGE_BORDER_BOTTOM_SIZE) - origin.y + gap if self._scroll_buttons_visible: available_space -= self._scroll_amount if self._scroll_right_btn != None: available_space += GetSizeInOrientation( self._scroll_right_btn.GetSize(), major_axis) if available_space > 0: if self._scroll_buttons_visible: self.HideScrollButtons() break result = self.ExpandPanels(major_axis, available_space) if not result: break elif available_space < 0: if self._scroll_buttons_visible: # Scroll buttons already visible - not going to be able to downsize any more self._scroll_amount_limit = -available_space if self._scroll_amount > self._scroll_amount_limit: self.ScrollPixels(self._scroll_amount_limit - self._scroll_amount) else: result = self.CollapsePanels(major_axis, -available_space) if not result: self._scroll_amount = 0 self._scroll_amount_limit = -available_space self.ShowScrollButtons() break else: break origin = wx.Point(*origin_) # Reset the origin return True
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"WinAquire Header Editor", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) self.SetBackgroundColour(wx.Colour(208, 208, 208)) FULL_PAGE = wx.FlexGridSizer(3, 1, 0, 0) FULL_PAGE.SetFlexibleDirection(wx.BOTH) FULL_PAGE.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) fgSizer151 = wx.FlexGridSizer(3, 1, 0, 0) fgSizer151.SetFlexibleDirection(wx.BOTH) fgSizer151.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) fgSizer16 = wx.FlexGridSizer(3, 1, 0, 0) fgSizer16.SetFlexibleDirection(wx.BOTH) fgSizer16.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) SHPTRPSTN_GRID = wx.FlexGridSizer(1, 7, 0, 0) SHPTRPSTN_GRID.SetFlexibleDirection(wx.BOTH) SHPTRPSTN_GRID.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.CARD1_LABEL = wx.StaticText(self, wx.ID_ANY, u"NAFC_BPO_CARD 1 HEADER:", wx.DefaultPosition, wx.Size(230, -1), wx.ALIGN_RIGHT) self.CARD1_LABEL.Wrap(-1) self.CARD1_LABEL.SetFont(wx.Font(12, 74, 90, 92, False, "Arial")) SHPTRPSTN_GRID.Add(self.CARD1_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.SHIP_LABEL1 = wx.StaticText(self, wx.ID_ANY, u"SHIP_ID :", wx.DefaultPosition, wx.Size(180, -1), wx.ALIGN_RIGHT) self.SHIP_LABEL1.Wrap(-1) self.SHIP_LABEL1.SetFont(wx.Font(12, 74, 90, 92, False, "Arial")) SHPTRPSTN_GRID.Add(self.SHIP_LABEL1, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.SHIP = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(35, -1), wx.TE_READONLY) self.SHIP.SetMaxLength(2) self.SHIP.SetFont(wx.Font(12, 74, 90, 92, False, "Arial")) SHPTRPSTN_GRID.Add(self.SHIP, 0, wx.ALL, 5) self.TRIP_LABEL = wx.StaticText(self, wx.ID_ANY, u"TRIP :", wx.DefaultPosition, wx.Size(-1, -1), wx.ALIGN_RIGHT) self.TRIP_LABEL.Wrap(-1) self.TRIP_LABEL.SetFont(wx.Font(12, 74, 90, 92, False, "Arial")) SHPTRPSTN_GRID.Add(self.TRIP_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.TRIP = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(45, -1), wx.TE_READONLY) self.TRIP.SetMaxLength(3) self.TRIP.SetFont(wx.Font(12, 74, 90, 92, False, "Arial")) SHPTRPSTN_GRID.Add(self.TRIP, 0, wx.ALL, 5) self.STATION_LABEL = wx.StaticText(self, wx.ID_ANY, u"STATION :", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_RIGHT) self.STATION_LABEL.Wrap(-1) self.STATION_LABEL.SetFont(wx.Font(12, 74, 90, 92, False, "Arial")) SHPTRPSTN_GRID.Add(self.STATION_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.STN = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(45, -1), wx.TE_READONLY) self.STN.SetMaxLength(3) self.STN.SetFont(wx.Font(12, 74, 90, 92, False, "Arial")) SHPTRPSTN_GRID.Add(self.STN, 0, wx.ALL, 5) fgSizer16.Add(SHPTRPSTN_GRID, 1, wx.EXPAND, 5) MAIN_ENTER_GRID = wx.FlexGridSizer(1, 2, 0, 0) MAIN_ENTER_GRID.SetFlexibleDirection(wx.BOTH) MAIN_ENTER_GRID.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) LEFT_COL_GRID = wx.FlexGridSizer(6, 1, 0, 0) LEFT_COL_GRID.SetFlexibleDirection(wx.BOTH) LEFT_COL_GRID.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.LEF_staticline = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) LEFT_COL_GRID.Add(self.LEF_staticline, 0, wx.EXPAND | wx.ALL, 5) self.STATION_META_DATA = wx.StaticText(self, wx.ID_ANY, u"STATION META-DATA", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE) self.STATION_META_DATA.Wrap(-1) self.STATION_META_DATA.SetFont(wx.Font(12, 74, 93, 92, True, "Arial")) self.STATION_META_DATA.SetMinSize(wx.Size(340, -1)) LEFT_COL_GRID.Add(self.STATION_META_DATA, 0, wx.ALL, 5) LAT_LON_GRID = wx.FlexGridSizer(2, 5, 0, 0) LAT_LON_GRID.SetFlexibleDirection(wx.BOTH) LAT_LON_GRID.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.LAT_LABEL = wx.StaticText(self, wx.ID_ANY, u"LATITUDE : +", wx.DefaultPosition, wx.DefaultSize, 0) self.LAT_LABEL.Wrap(-1) self.LAT_LABEL.SetFont(wx.Font(10, 74, 90, 90, False, "Arial")) LAT_LON_GRID.Add(self.LAT_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.LATD = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(45, -1), 0, validator=IntRangeValidator("0", "90")) self.LATD.SetMaxLength(2) self.LATD.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY) self.LATD.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) LAT_LON_GRID.Add(self.LATD, 0, wx.ALL, 5) self.DEG_LAT_LABEL = wx.StaticText(self, wx.ID_ANY, u"°", wx.DefaultPosition, wx.DefaultSize, 0) self.DEG_LAT_LABEL.Wrap(-1) self.DEG_LAT_LABEL.SetFont(wx.Font(12, 74, 90, 92, False, "Arial")) LAT_LON_GRID.Add(self.DEG_LAT_LABEL, 0, wx.ALL, 5) self.LATM = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(60, -1), 0, validator=IntRangeValidator("0", "60")) self.LATM.SetMaxLength(5) self.LATM.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) LAT_LON_GRID.Add(self.LATM, 0, wx.ALL, 5) self.MINUTES_LAT_LABEL = wx.StaticText(self, wx.ID_ANY, u"'", wx.DefaultPosition, wx.DefaultSize, 0) self.MINUTES_LAT_LABEL.Wrap(-1) self.MINUTES_LAT_LABEL.SetFont(wx.Font(12, 74, 90, 92, False, "Arial")) LAT_LON_GRID.Add(self.MINUTES_LAT_LABEL, 0, wx.ALL, 5) self.LONGITUDE_LABEL = wx.StaticText(self, wx.ID_ANY, u"LONGITUDE : -0", wx.DefaultPosition, wx.DefaultSize, 0) self.LONGITUDE_LABEL.Wrap(-1) self.LONGITUDE_LABEL.SetFont(wx.Font(10, 74, 90, 90, False, "Arial")) LAT_LON_GRID.Add(self.LONGITUDE_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.LOND = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(50, -1), 0, validator=IntRangeValidator("0", "99")) self.LOND.SetMaxLength(2) self.LOND.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) LAT_LON_GRID.Add(self.LOND, 0, wx.ALL, 5) self.DEGLONG_LABEL = wx.StaticText(self, wx.ID_ANY, u"°", wx.DefaultPosition, wx.DefaultSize, 0) self.DEGLONG_LABEL.Wrap(-1) self.DEGLONG_LABEL.SetFont(wx.Font(12, 74, 90, 92, False, "Arial")) LAT_LON_GRID.Add(self.DEGLONG_LABEL, 0, wx.ALL, 5) self.LONM = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(60, -1), 0, validator=IntRangeValidator("0", "60")) self.LONM.SetMaxLength(5) self.LONM.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) LAT_LON_GRID.Add(self.LONM, 0, wx.ALL, 5) self.MIN_LONG_LABEL = wx.StaticText(self, wx.ID_ANY, u"'", wx.DefaultPosition, wx.DefaultSize, 0) self.MIN_LONG_LABEL.Wrap(-1) self.MIN_LONG_LABEL.SetFont(wx.Font(12, 74, 90, 92, False, "Arial")) LAT_LON_GRID.Add(self.MIN_LONG_LABEL, 0, wx.ALL, 5) LEFT_COL_GRID.Add(LAT_LON_GRID, 1, wx.EXPAND, 5) TIME_GRID = wx.FlexGridSizer(2, 6, 0, 0) TIME_GRID.SetFlexibleDirection(wx.BOTH) TIME_GRID.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.YEAR_LABEL = wx.StaticText(self, wx.ID_ANY, u"YEAR :", wx.DefaultPosition, wx.DefaultSize, 0) self.YEAR_LABEL.Wrap(-1) self.YEAR_LABEL.SetFont(wx.Font(10, 74, 90, 90, False, "Arial")) TIME_GRID.Add(self.YEAR_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.YEAR = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(50, -1), 0, validator=IntRangeValidator("0", "2030")) self.YEAR.SetMaxLength(4) self.YEAR.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) TIME_GRID.Add(self.YEAR, 0, wx.ALL, 5) self.HYPH1 = wx.StaticText(self, wx.ID_ANY, u"-", wx.DefaultPosition, wx.DefaultSize, 0) self.HYPH1.Wrap(-1) self.HYPH1.SetFont(wx.Font(14, 70, 90, 92, False, "Arial")) TIME_GRID.Add(self.HYPH1, 0, wx.ALL, 5) self.MONTH = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(35, -1), 0, validator=IntRangeValidator("0", "12")) self.MONTH.SetMaxLength(2) self.MONTH.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) TIME_GRID.Add(self.MONTH, 0, wx.ALL, 5) self.HYPH2 = wx.StaticText(self, wx.ID_ANY, u"-", wx.DefaultPosition, wx.DefaultSize, 0) self.HYPH2.Wrap(-1) self.HYPH2.SetFont(wx.Font(14, 70, 90, 92, False, "Arial")) TIME_GRID.Add(self.HYPH2, 0, wx.ALL, 5) self.DAY = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(38, -1), 0, validator=IntRangeValidator("0", "31")) self.DAY.SetMaxLength(2) self.DAY.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) TIME_GRID.Add(self.DAY, 0, wx.ALL, 5) self.HOUR_LABEL = wx.StaticText(self, wx.ID_ANY, u"HOUR :", wx.DefaultPosition, wx.Size(60, -1), 0) self.HOUR_LABEL.Wrap(-1) self.HOUR_LABEL.SetFont(wx.Font(10, 74, 90, 90, False, "Arial")) TIME_GRID.Add(self.HOUR_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.HOUR = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.Point(-1, -1), wx.Size(35, -1), 0, validator=IntRangeValidator("0", "23")) self.HOUR.SetMaxLength(2) self.HOUR.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) TIME_GRID.Add(self.HOUR, 0, wx.ALL, 5) self.MINS_T_LABEL = wx.StaticText(self, wx.ID_ANY, u":", wx.Point(-1, -1), wx.DefaultSize, 0) self.MINS_T_LABEL.Wrap(-1) self.MINS_T_LABEL.SetFont(wx.Font(14, 70, 90, 92, False, "Arial")) TIME_GRID.Add(self.MINS_T_LABEL, 0, wx.ALL, 5) self.MINUTES = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(35, -1), 0, validator=IntRangeValidator("0", "59")) self.MINUTES.SetMaxLength(2) self.MINUTES.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) TIME_GRID.Add(self.MINUTES, 0, wx.ALL, 5) self.DUMMY = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.DUMMY.Wrap(-1) TIME_GRID.Add(self.DUMMY, 0, wx.ALL, 5) self.GMT = wx.StaticText(self, wx.ID_ANY, u"GMT", wx.DefaultPosition, wx.Size(-1, -1), wx.ALIGN_LEFT | wx.ALIGN_RIGHT) self.GMT.Wrap(-1) self.GMT.SetFont(wx.Font(12, 74, 93, 90, False, "Arial")) TIME_GRID.Add(self.GMT, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) LEFT_COL_GRID.Add(TIME_GRID, 1, wx.EXPAND, 5) OTHER_DATA_GRID = wx.FlexGridSizer(5, 2, 0, 0) OTHER_DATA_GRID.SetFlexibleDirection(wx.BOTH) OTHER_DATA_GRID.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.BOTTOM_LABEL = wx.StaticText(self, wx.ID_ANY, u"BOTTOM DEPTH (M) :", wx.DefaultPosition, wx.DefaultSize, 0) self.BOTTOM_LABEL.Wrap(-1) self.BOTTOM_LABEL.SetFont(wx.Font(10, 74, 90, 90, False, "Arial")) OTHER_DATA_GRID.Add(self.BOTTOM_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.DEPTH = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(50, -1), 0, validator=IntRangeValidator("0", "6000")) self.DEPTH.SetMaxLength(4) self.DEPTH.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) OTHER_DATA_GRID.Add(self.DEPTH, 0, wx.ALL, 5) self.PROBE_TYPE_LABEL = wx.StaticText(self, wx.ID_ANY, u"PROBE TYPE :", wx.DefaultPosition, wx.DefaultSize, 0) self.PROBE_TYPE_LABEL.Wrap(-1) self.PROBE_TYPE_LABEL.SetFont(wx.Font(10, 74, 90, 90, False, "Arial")) OTHER_DATA_GRID.Add(self.PROBE_TYPE_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.PROBE = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(68, -1), wx.TE_READONLY) self.PROBE.SetMaxLength(5) self.PROBE.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) OTHER_DATA_GRID.Add(self.PROBE, 0, wx.ALL, 5) self.FISHSET_LABEL = wx.StaticText(self, wx.ID_ANY, u"FISH SET # :", wx.DefaultPosition, wx.DefaultSize, 0) self.FISHSET_LABEL.Wrap(-1) self.FISHSET_LABEL.SetFont(wx.Font(10, 74, 90, 90, False, "Arial")) OTHER_DATA_GRID.Add(self.FISHSET_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.FISHSET = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(50, -1), 0, validator=IntRangeValidator("0", "999")) self.FISHSET.SetMaxLength(3) self.FISHSET.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) OTHER_DATA_GRID.Add(self.FISHSET, 0, wx.ALL, 5) self.FORMAT_LABEL = wx.StaticText(self, wx.ID_ANY, u"PROFILE FORMAT :", wx.DefaultPosition, wx.DefaultSize, 0) self.FORMAT_LABEL.Wrap(-1) self.FORMAT_LABEL.SetFont(wx.Font(10, 74, 90, 90, False, "Arial")) OTHER_DATA_GRID.Add(self.FORMAT_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.FORMAT = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(30, -1), 0) self.FORMAT.SetMaxLength(1) self.FORMAT.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) OTHER_DATA_GRID.Add(self.FORMAT, 0, wx.ALL, 5) self.COMM_LABEL = wx.StaticText(self, wx.ID_ANY, u"COMMENT (14CHR) :", wx.DefaultPosition, wx.DefaultSize, 0) self.COMM_LABEL.Wrap(-1) self.COMM_LABEL.SetFont(wx.Font(10, 74, 90, 90, False, "Arial")) OTHER_DATA_GRID.Add(self.COMM_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.COMMENT = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(180, -1), 0) self.COMMENT.SetMaxLength(14) self.COMMENT.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) OTHER_DATA_GRID.Add(self.COMMENT, 0, wx.ALL, 5) LEFT_COL_GRID.Add(OTHER_DATA_GRID, 1, wx.EXPAND, 5) fgSizer18 = wx.FlexGridSizer(1, 2, 0, 0) fgSizer18.SetFlexibleDirection(wx.BOTH) fgSizer18.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.FileName_Label = wx.StaticText(self, wx.ID_ANY, u"FILE=", wx.DefaultPosition, wx.DefaultSize, 0) self.FileName_Label.Wrap(-1) self.FileName_Label.SetFont(wx.Font(12, 74, 90, 92, False, "Arial")) fgSizer18.Add(self.FileName_Label, 0, wx.ALL, 5) self.FileName = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(-1, -1), wx.TE_READONLY) self.FileName.SetFont(wx.Font(8, 74, 90, 90, False, "Arial")) self.FileName.SetMinSize(wx.Size(286, -1)) fgSizer18.Add(self.FileName, 0, wx.ALL, 5) LEFT_COL_GRID.Add(fgSizer18, 1, wx.EXPAND, 5) MAIN_ENTER_GRID.Add(LEFT_COL_GRID, 1, wx.EXPAND, 5) RIGHT_COL_GRID = wx.FlexGridSizer(2, 2, 0, 0) RIGHT_COL_GRID.SetFlexibleDirection(wx.BOTH) RIGHT_COL_GRID.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.RIGHT_staticline1 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) RIGHT_COL_GRID.Add(self.RIGHT_staticline1, 0, wx.EXPAND | wx.ALL, 5) self.RIGHT_staticline2 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) RIGHT_COL_GRID.Add(self.RIGHT_staticline2, 0, wx.EXPAND | wx.ALL, 5) METEROLOGY1 = wx.FlexGridSizer(3, 1, 0, 0) METEROLOGY1.SetFlexibleDirection(wx.BOTH) METEROLOGY1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.METEOROLOGY_LABEL = wx.StaticText(self, wx.ID_ANY, u"METEOROLOGY DATA", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE) self.METEOROLOGY_LABEL.Wrap(-1) self.METEOROLOGY_LABEL.SetFont(wx.Font(12, 74, 93, 92, True, "Arial")) self.METEOROLOGY_LABEL.SetMinSize(wx.Size(340, -1)) METEROLOGY1.Add(self.METEOROLOGY_LABEL, 0, wx.ALL, 5) fgSizer24 = wx.FlexGridSizer(3, 1, 0, 0) fgSizer24.SetFlexibleDirection(wx.BOTH) fgSizer24.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) fgSizer27 = wx.FlexGridSizer(1, 2, 0, 0) fgSizer27.SetFlexibleDirection(wx.BOTH) fgSizer27.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.AIR_LABEL = wx.StaticText(self, wx.ID_ANY, u"AIR", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE) self.AIR_LABEL.Wrap(-1) self.AIR_LABEL.SetFont(wx.Font(12, 74, 90, 92, True, "Arial")) self.AIR_LABEL.SetMinSize(wx.Size(180, -1)) fgSizer27.Add(self.AIR_LABEL, 0, wx.ALL, 5) self.WATER_LABEL = wx.StaticText(self, wx.ID_ANY, u"WATER", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE) self.WATER_LABEL.Wrap(-1) self.WATER_LABEL.SetFont(wx.Font(12, 74, 90, 92, True, "Arial")) self.WATER_LABEL.SetMinSize(wx.Size(175, -1)) fgSizer27.Add(self.WATER_LABEL, 0, wx.ALL, 5) fgSizer24.Add(fgSizer27, 1, wx.EXPAND, 5) fgSizer15 = wx.FlexGridSizer(1, 2, 0, 0) fgSizer15.SetFlexibleDirection(wx.BOTH) fgSizer15.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) AIR_GRID = wx.FlexGridSizer(9, 2, 0, 0) AIR_GRID.SetFlexibleDirection(wx.BOTH) AIR_GRID.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.CLOUD_LABEL = wx.StaticText(self, wx.ID_ANY, u"CLOUD (1-9-/) :", wx.DefaultPosition, wx.DefaultSize, 0) self.CLOUD_LABEL.Wrap(-1) self.CLOUD_LABEL.SetFont(wx.Font(9, 74, 90, 90, False, "Arial")) AIR_GRID.Add(self.CLOUD_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.CLOUD = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(30, -1), 0, validator=IntRangeValidator("0", "9")) self.CLOUD.SetMaxLength(1) self.CLOUD.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) AIR_GRID.Add(self.CLOUD, 0, wx.ALL, 5) self.WINDDIR_LABEL = wx.StaticText(self, wx.ID_ANY, u"WIND DIR (°/10) :", wx.DefaultPosition, wx.DefaultSize, 0) self.WINDDIR_LABEL.Wrap(-1) self.WINDDIR_LABEL.SetFont(wx.Font(9, 74, 90, 90, False, "Arial")) AIR_GRID.Add(self.WINDDIR_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.WINDDIR = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(35, -1), 0, validator=IntRangeValidator("0", "36")) self.WINDDIR.SetMaxLength(2) self.WINDDIR.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) AIR_GRID.Add(self.WINDDIR, 0, wx.ALL, 5) self.WINDSPD_LABEL = wx.StaticText(self, wx.ID_ANY, u"WIND SPEED (Knts) :", wx.DefaultPosition, wx.DefaultSize, 0) self.WINDSPD_LABEL.Wrap(-1) self.WINDSPD_LABEL.SetFont(wx.Font(9, 74, 90, 90, False, "Arial")) AIR_GRID.Add(self.WINDSPD_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.WINDSPD = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(35, -1), 0, validator=IntRangeValidator("0", "99")) self.WINDSPD.SetMaxLength(2) self.WINDSPD.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) AIR_GRID.Add(self.WINDSPD, 0, wx.ALL, 5) self.WW_CODE_LABEL = wx.StaticText(self, wx.ID_ANY, u"WW CODE :", wx.DefaultPosition, wx.DefaultSize, 0) self.WW_CODE_LABEL.Wrap(-1) AIR_GRID.Add(self.WW_CODE_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.WWCODE = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(35, -1), 0, validator=IntRangeValidator("0", "99")) self.WWCODE.SetMaxLength(2) self.WWCODE.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) AIR_GRID.Add(self.WWCODE, 0, wx.ALL, 5) self.AIRPRES_LABEL = wx.StaticText(self, wx.ID_ANY, u"AIR PRES. (mb) :", wx.DefaultPosition, wx.DefaultSize, 0) self.AIRPRES_LABEL.Wrap(-1) AIR_GRID.Add(self.AIRPRES_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.AIRPRES = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(65, -1), 0, validator=IntRangeValidator("0", "1400")) self.AIRPRES.SetMaxLength(6) self.AIRPRES.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) AIR_GRID.Add(self.AIRPRES, 0, wx.ALL, 5) self.AIRTEMPDRY_LABEL = wx.StaticText(self, wx.ID_ANY, u"AIR TEMP DRY (°C) :", wx.DefaultPosition, wx.DefaultSize, 0) self.AIRTEMPDRY_LABEL.Wrap(-1) AIR_GRID.Add(self.AIRTEMPDRY_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.DRYTEMP = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(60, -1), 0, validator=IntRangeValidator("-45", "45")) self.DRYTEMP.SetMaxLength(5) self.DRYTEMP.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) AIR_GRID.Add(self.DRYTEMP, 0, wx.ALL, 5) self.AIRTEMPWET_LABEL = wx.StaticText(self, wx.ID_ANY, u"AIR TEMP WET (°C) :", wx.DefaultPosition, wx.DefaultSize, 0) self.AIRTEMPWET_LABEL.Wrap(-1) AIR_GRID.Add(self.AIRTEMPWET_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.WETTEMP = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(60, -1), 0, validator=IntRangeValidator("-45", "45")) self.WETTEMP.SetMaxLength(5) self.WETTEMP.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) AIR_GRID.Add(self.WETTEMP, 0, wx.ALL, 5) fgSizer15.Add(AIR_GRID, 1, wx.EXPAND, 5) WATER_GRID = wx.FlexGridSizer(9, 2, 0, 0) WATER_GRID.SetFlexibleDirection(wx.BOTH) WATER_GRID.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.WAVEPERIOD_LABEL = wx.StaticText(self, wx.ID_ANY, u"WAVE PERIOD (SEC) :", wx.DefaultPosition, wx.DefaultSize, 0) self.WAVEPERIOD_LABEL.Wrap(-1) WATER_GRID.Add(self.WAVEPERIOD_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.WAVEP = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(30, -1), 0, validator=IntRangeValidator("0", "99")) self.WAVEP.SetMaxLength(2) self.WAVEP.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) WATER_GRID.Add(self.WAVEP, 0, wx.ALL, 5) self.WAVE_H_LABEL = wx.StaticText(self, wx.ID_ANY, u"WAVE HEIGHT (x½m) :", wx.DefaultPosition, wx.DefaultSize, 0) self.WAVE_H_LABEL.Wrap(-1) WATER_GRID.Add(self.WAVE_H_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.WAVEH = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(30, -1), 0, validator=IntRangeValidator("0", "99")) self.WAVEH.SetMaxLength(2) self.WAVEH.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) WATER_GRID.Add(self.WAVEH, 0, wx.ALL, 5) self.SWELLDIR_LABEL = wx.StaticText(self, wx.ID_ANY, u"SWELL DIR (°/10) :", wx.DefaultPosition, wx.DefaultSize, 0) self.SWELLDIR_LABEL.Wrap(-1) WATER_GRID.Add(self.SWELLDIR_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.SWELLD = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(30, -1), 0, validator=IntRangeValidator("0", "36")) self.SWELLD.SetMaxLength(2) self.SWELLD.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) WATER_GRID.Add(self.SWELLD, 0, wx.ALL, 5) self.SWELLPERIOD_LABEL = wx.StaticText(self, wx.ID_ANY, u"SWELL PERIOD (s) :", wx.DefaultPosition, wx.DefaultSize, 0) self.SWELLPERIOD_LABEL.Wrap(-1) WATER_GRID.Add(self.SWELLPERIOD_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.SWELLP = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(30, -1), 0, validator=IntRangeValidator("0", "99")) self.SWELLP.SetMaxLength(2) self.SWELLP.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) WATER_GRID.Add(self.SWELLP, 0, wx.ALL, 5) self.SWELL_H_LABEL = wx.StaticText(self, wx.ID_ANY, u"SWELL HEIGHT (x½m) :", wx.DefaultPosition, wx.DefaultSize, 0) self.SWELL_H_LABEL.Wrap(-1) WATER_GRID.Add(self.SWELL_H_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.SWELLH = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(30, -1), 0, validator=IntRangeValidator("0", "99")) self.SWELLH.SetMaxLength(2) self.SWELLH.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) WATER_GRID.Add(self.SWELLH, 0, wx.ALL, 5) self.ICE_CONC_LABEL = wx.StaticText(self, wx.ID_ANY, u"ICE CONC. (1/10s) :", wx.DefaultPosition, wx.DefaultSize, 0) self.ICE_CONC_LABEL.Wrap(-1) WATER_GRID.Add(self.ICE_CONC_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.ICECONC = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(30, -1), 0, validator=IntRangeValidator("0", "9")) self.ICECONC.SetMaxLength(1) self.ICECONC.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) WATER_GRID.Add(self.ICECONC, 0, wx.ALL, 5) self.ICESTAGE_LABEL = wx.StaticText(self, wx.ID_ANY, u"ICE STAGE (0-9/) :", wx.DefaultPosition, wx.DefaultSize, 0) self.ICESTAGE_LABEL.Wrap(-1) WATER_GRID.Add(self.ICESTAGE_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.ICESTAGE = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(30, -1), 0, validator=IntRangeValidator("0", "9")) self.ICESTAGE.SetMaxLength(1) self.ICESTAGE.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) WATER_GRID.Add(self.ICESTAGE, 0, wx.ALL, 5) self.BERGS_LABEL = wx.StaticText(self, wx.ID_ANY, u"BERGS (#) (0-9/) :", wx.DefaultPosition, wx.DefaultSize, 0) self.BERGS_LABEL.Wrap(-1) WATER_GRID.Add(self.BERGS_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.NBERGS = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(30, -1), 0, validator=IntRangeValidator("0", "9")) self.NBERGS.SetMaxLength(1) self.NBERGS.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) WATER_GRID.Add(self.NBERGS, 0, wx.ALL, 5) self.SITnTREND_LABEL = wx.StaticText(self, wx.ID_ANY, u"SIT and TREND :", wx.DefaultPosition, wx.DefaultSize, 0) self.SITnTREND_LABEL.Wrap(-1) WATER_GRID.Add(self.SITnTREND_LABEL, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.SandT = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(30, -1), 0, validator=IntRangeValidator("0", "9")) self.SandT.SetMaxLength(1) self.SandT.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) WATER_GRID.Add(self.SandT, 0, wx.ALL, 5) fgSizer15.Add(WATER_GRID, 1, wx.EXPAND, 5) fgSizer24.Add(fgSizer15, 1, wx.EXPAND, 5) BUTTONS_GRID = wx.FlexGridSizer(0, 3, 0, 0) BUTTONS_GRID.SetFlexibleDirection(wx.BOTH) BUTTONS_GRID.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.ClearButton = wx.Button(self, wx.ID_CANCEL, u"Clear All", wx.DefaultPosition, wx.DefaultSize, 0) self.ClearButton.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) BUTTONS_GRID.Add(self.ClearButton, 0, wx.ALL, 5) self.Save_n_Exit_Button = wx.Button(self, wx.ID_SAVE, u"Save and Exit", wx.DefaultPosition, wx.DefaultSize, 0) self.Save_n_Exit_Button.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) BUTTONS_GRID.Add(self.Save_n_Exit_Button, 0, wx.ALL, 5) self.QuitButton = wx.Button(self, wx.ID_ANY, u"Quit", wx.DefaultPosition, wx.DefaultSize, 0) self.QuitButton.SetFont(wx.Font(12, 74, 90, 90, False, "Arial")) BUTTONS_GRID.Add(self.QuitButton, 0, wx.ALL, 5) fgSizer24.Add(BUTTONS_GRID, 1, wx.EXPAND, 5) METEROLOGY1.Add(fgSizer24, 1, wx.EXPAND, 5) RIGHT_COL_GRID.Add(METEROLOGY1, 1, wx.EXPAND, 5) MAIN_ENTER_GRID.Add(RIGHT_COL_GRID, 1, wx.EXPAND, 5) fgSizer16.Add(MAIN_ENTER_GRID, 1, wx.EXPAND, 5) fgSizer151.Add(fgSizer16, 1, wx.EXPAND, 5) FULL_PAGE.Add(fgSizer151, 1, wx.EXPAND, 5) self.SetSizer(FULL_PAGE) self.Layout() FULL_PAGE.Fit(self) self.Centre(wx.BOTH) # Connect Events self.Bind(wx.EVT_CLOSE, self.OnClose) self.ClearButton.Bind(wx.EVT_BUTTON, self.clearFunc) self.Save_n_Exit_Button.Bind(wx.EVT_BUTTON, self.SaveNExit) self.QuitButton.Bind(wx.EVT_BUTTON, self.OnClose) ################ ALLOW ENTER KEY TO FUNCTION THE SAME AS TAB KEY return_id = wx.NewId() acc_table = wx.AcceleratorTable([(wx.ACCEL_NORMAL, wx.WXK_RETURN, return_id)]) self.SetAcceleratorTable(acc_table) # wx.EVT_MENU(self, return_id, self.on_return) Depreciated self.Bind(wx.EVT_MENU, self.on_return, id=return_id) self.Centre(wx.BOTH) # Disable ESc key from normal ehavior of cancel-clear self.SetEscapeId(wx.ID_SAVE)
def ShowScrollButtons(self): show_left = True show_right = True reposition = False if self._scroll_amount == 0: show_left = False if self._scroll_amount >= self._scroll_amount_limit: show_right = False self._scroll_amount = self._scroll_amount_limit self._scroll_buttons_visible = show_left or show_right if show_left: if self._scroll_left_btn == None: temp_dc = wx.MemoryDC() if self.GetMajorAxis() == wx.HORIZONTAL: direction = RIBBON_SCROLL_BTN_LEFT size = self._art.GetScrollButtonMinimumSize( temp_dc, self.GetParent(), direction) size.SetHeight(self.GetSize().GetHeight()) else: direction = RIBBON_SCROLL_BTN_UP size = self._art.GetScrollButtonMinimumSize( temp_dc, self.GetParent(), direction) size.SetWidth(self.GetSize().GetWidth()) self._scroll_left_btn = RibbonPageScrollButton( self, -1, self.GetPosition(), size, direction) if not self.IsShown(): self._scroll_left_btn.Hide() reposition = True else: if self._scroll_left_btn != None: self._scroll_left_btn.Destroy() self._scroll_left_btn = None reposition = True if show_right: if self._scroll_right_btn == None: temp_dc = wx.MemoryDC() if self.GetMajorAxis() == wx.HORIZONTAL: direction = RIBBON_SCROLL_BTN_RIGHT size = self._art.GetScrollButtonMinimumSize( temp_dc, self.GetParent(), direction) size.SetHeight(self.GetSize().GetHeight()) else: direction = RIBBON_SCROLL_BTN_DOWN size = self._art.GetScrollButtonMinimumSize( temp_dc, self.GetParent(), direction) size.SetWidth(self.GetSize().GetWidth()) initial_pos = self.GetPosition() + wx.Point( *self.GetSize()) - wx.Point(*size) self._scroll_right_btn = RibbonPageScrollButton( self, -1, initial_pos, size, direction) if not self.IsShown(): self._scroll_right_btn.Hide() reposition = True else: if self._scroll_right_btn != None: self._scroll_right_btn.Destroy() self._scroll_right_btn = None reposition = True if reposition: self.GetParent().RepositionPage(self)
def TryCollapseLayout(self, original, first_btn, last_button=None): btn_count = len(self._buttons) used_height = 0 used_width = 0 available_width = 0 available_height = 0 count = first_btn + 1 while 1: count -= 1 button = self._buttons[count] large_size_class = button.GetLargestSize() large_size = button.sizes[large_size_class].size t_available_height = max(available_height, large_size.GetHeight()) t_available_width = available_width + large_size.GetWidth() small_size_class = large_size_class result, small_size_class = button.GetSmallerSize(small_size_class) if not result: return False, count small_size = button.sizes[small_size_class].size t_used_height = used_height + small_size.GetHeight() t_used_width = max(used_width, small_size.GetWidth()) if t_used_height > t_available_height: count += 1 break else: used_height = t_used_height used_width = t_used_width available_width = t_available_width available_height = t_available_height if count <= 0: break if count >= first_btn or used_width >= available_width: return False, count if last_button is not None: last_button = count layout = RibbonButtonBarLayout() for indx, button in enumerate(original.buttons): instance = RibbonButtonBarButtonInstance() instance.position = wx.Point(*button.position) instance.size = button.size instance.base = self._buttons[indx] layout.buttons.append(instance) cursor = wx.Point(*layout.buttons[count].position) preserve_height = False if count == 0: # If height isn't preserved (i.e. it is reduced), then the minimum # size for the button bar will decrease, preventing the original # layout from being used (in some cases). # It may be a good idea to always preverse the height, but for now # it is only done when the first button is involved in a collapse. preserve_height = True for btn_i in range(count, first_btn+1): instance = layout.buttons[btn_i] result, instance.size = instance.base.GetSmallerSize(instance.size) instance.position = wx.Point(*cursor) cursor.y += instance.base.sizes[instance.size].size.GetHeight() x_adjust = available_width - used_width for btn_i in range(first_btn+1, btn_count): instance = layout.buttons[btn_i] instance.position.x -= x_adjust layout.CalculateOverallSize() ## # Sanity check ## if layout.overall_size.GetWidth() >= original.overall_size.GetWidth() or \ ## layout.overall_size.GetHeight() > original.overall_size.GetHeight(): ## ## del layout ## return False, count if preserve_height: layout.overall_size.SetHeight(original.overall_size.GetHeight()) self._layouts.append(layout) return True, count
def _init_ctrls(self, prnt): # generated method, don't edit wx.Panel.__init__(self, id=wxID_PANEL, name='Zplots', parent=prnt, pos=wx.Point(0, 0), size=wx.Size(604, 349), style=wx.TAB_TRAVERSAL) self._init_utils() self.SetClientSize(wx.Size(596, 315)) self.Color = wx.Choice(choices=[ 'black', 'white', 'red', 'green', 'blue', 'cyan', 'magenta', 'yellow' ], id=wxID_PANELCOLOR, name='Color', parent=self, pos=wx.Point(512, 0), size=wx.Size(80, 21), style=0, validator=wx.DefaultValidator) wx.EVT_CHOICE(self.Color, wxID_PANELCOLOR, self.OnColorChoice) self.LineType = wx.Choice( choices=['solid', 'dash', 'dot', 'dashdot', 'dashdotdot', 'none'], id=wxID_PANELLINETYPE, name='LineType', parent=self, pos=wx.Point(512, 24), size=wx.Size(80, 21), style=0, validator=wx.DefaultValidator) wx.EVT_CHOICE(self.LineType, wxID_PANELLINETYPE, self.OnLinetypeChoice) self.Marker = wx.TextCtrl(id=wxID_PANELMARKER, name='Marker', parent=self, pos=wx.Point(560, 72), size=wx.Size(22, 22), style=wx.TE_PROCESS_ENTER, value='A') wx.EVT_TEXT_ENTER(self.Marker, wxID_PANELMARKER, self.OnMarkerTextEnter) self.staticText1 = wx.StaticText(id=wxID_PANELSTATICTEXT1, label='Marker', name='staticText1', parent=self, pos=wx.Point(516, 74), size=wx.Size(39, 16), style=0) self.staticText2 = wx.StaticText(id=wxID_PANELSTATICTEXT2, label='Size', name='staticText2', parent=self, pos=wx.Point(516, 50), size=wx.Size(24, 16), style=0) # self.Size = wx.SpinCtrl(id=wxID_PANELSIZE, initial=1, max=10, min=1, # name='Size', parent=self, pos=wx.Point(550, 48), # size=wx.Size(40,22), style=wx.SP_ARROW_KEYS) # wx.EVT_SPINCTRL(self.Size, wxID_PANELSIZE, self.OnSizeSpinctrl) self.MarkerSize = wx.SpinCtrl(id=wxID_PANELMARKERSIZE, initial=1, max=10, min=1, name='MarkerSize', parent=self, pos=wx.Point(550, 96), size=wx.Size(40, 22), style=wx.SP_ARROW_KEYS) wx.EVT_SPINCTRL(self.MarkerSize, wxID_PANELMARKERSIZE, self.OnMarkersizeSpinctrl) self.staticText3 = wx.StaticText(id=wxID_PANELSTATICTEXT3, label='Size', name='staticText3', parent=self, pos=wx.Point(516, 98), size=wx.Size(24, 16), style=0) self.Marks = wx.CheckBox(id=wxID_PANELMARKS, label='', name='Marks', parent=self, pos=wx.Point(496, 71), size=wx.Size(20, 20), style=0) self.Marks.SetValue(false) wx.EVT_CHECKBOX(self.Marks, wxID_PANELMARKS, self.OnMarksCheckbox)