Exemplo n.º 1
0
def main():
    try:
        login()
    except Exception as e:
        if (DataCenter.DEBUG):
            print(e)

    if not os.path.exists("problemset"):
        os.mkdir("problemset")
    if not os.path.exists("data"):
        os.mkdir("data")
    if not os.path.exists("test"):
        os.mkdir("test")
    if not os.path.exists("code"):
        os.mkdir("code")

    banfile = open(BANLIST_FILE, "w+")
    banfile.write('')
    banfile.close()

    problemfile = open(PROBLEMLIST_FILE, "w+")
    problemfile.write('')
    problemfile.close()

    load_banlist()
    load_problemlist()

    DataCenter.MF = MainFrame.MainFrame()
    DataCenter.MF.start_window()
Exemplo n.º 2
0
 def OnInit(self):
     '''
     :return:
     '''
     test_list = ['MainFrame/test_script.py']
     main_frame = MainFrame(self, test_list=test_list)
     login_frame = LoginFrame(self, MainApp=main_frame)
     return True
Exemplo n.º 3
0
def main():
    app = wx.App()
    win = MainFrame(None,
                    title="我们自己的线上聊天小程序! (Version %s)" % VERSION,
                    size=wx.Size(850, 800))
    win.Centre()
    win.Show()
    app.MainLoop()
Exemplo n.º 4
0
 def CreateFrame(self, type):
     if type == 0:
         return UserFrame.UserFrame(parent=None,
                                    id=type,
                                    UpdateUI=self.UpdateUI)
     elif type == 1:
         return MainFrame.MainFrame(parent=None,
                                    id=type,
                                    UpdateUI=self.UpdateUI)
Exemplo n.º 5
0
 def addNewUser(self, inputlist):
     _db = UserTable.UserTable()
     _db.Connect()
     if not _db.AddNewUser([inputlist[0], inputlist[2], inputlist[1]]):
         self.tryAgain("用户已存在")
         _db.CloseCon()
         return
     _db.CloseCon()
     self.Destroy()
     MainFrame.MainFrame("综合评价", inputlist[0],
                         MagicNum.UserDB.PERMISSION_NOTHING)
Exemplo n.º 6
0
    def OnInit(self):
        wxInitAllImageHandlers()
        if not self.CheckSingleInstance():
            return False

        self.m_MainFrame = MainFrame()
        #print self.GetAppName()

        self.m_MainFrame.Show()
        self.SetTopWindow(self.m_MainFrame)
        return True
Exemplo n.º 7
0
    def OnLogin(self, event):
        global PASSWORD
        PASSWORD = self.password.GetValue()
        # Valid Check
        if self.username.GetValue() == '' or self.password.GetValue() == '':
            Util.MessageBox(self, u'缺少用户名或密码!', u'错误', wx.OK | wx.ICON_ERROR)
            return

        dlg = ProgressDialog.ProgressDialog(self, u'连接服务器...')

        url = 'http://%s:5000/v2.0' % (Setting.getServer())

        RestartDeviceRequests()

        loginthread = LoginThread(dlg, url, self.username.GetValue(),
                                  self.password.GetValue())
        loginthread.start()
        #ret = dlg.ShowModal()
        #dlg.Destroy()
        if dlg.ShowModal() == wx.ID_CANCEL:
            loginthread.stop()
            return
        if loginthread:
            loginthread.stop()
        dlg.Destroy()

        Logger.info("Connect to %s", url)
        Logger.info("UserId: %s, Password: ******", self.username.GetValue())
        ret, reason, detail = loginthread.getReturnValue()
        Logger.info("Result: %s, reason: %s, detail: %s", ret, reason, detail)

        if Setting.getSign().lower() == 'false':
            self.password.SetValue('')

        self.password.SetFocus()

        if not ret:
            Util.MessageBox(self, detail, reason, wx.OK | wx.ICON_ERROR)
            Session.logout()
        else:
            Setting.setLastLogin(FirstUser['firstuser'].username)
            if self.sign.GetValue() == True:
                Setting.setPasswd(self.password.GetValue())
            else:
                Setting.setPasswd('1df#$!cd123~')
            Setting.save()
            area = wx.Display().GetGeometry()
            width = area.GetWidth()
            height = area.GetHeight()
            f = MainFrame.MainFrame(self.GetParent(), (width, height))

            f.ShowFullScreen(True)
            self.GetParent().Hide()
Exemplo n.º 8
0
 def secondButtonFun(self):
     _inputlist = self.getInputText()
     _db = UserTable.UserTable()
     _db.Connect()
     _res = _db.SearchUser(_inputlist[0])
     if not _res:
         self.tryAgain("该用户不存在")
     elif _res[0][1] != _inputlist[1]:
         self.tryAgain("密码错误")
     else:
         self.Destroy()
         MainFrame.MainFrame("在线客户群价值评价系统", _res[0][0], _res[0][3])
     _db.CloseCon()
Exemplo n.º 9
0
    def __init__(self, master):
        self.master = master

        # Конфигурация основного окна приложения
        master.title("Создание сертификата")
        master.geometry("{0}x{1}+400+200".format(GUI_WIDTH, GUI_HEIGHT))
        master.grid_columnconfigure(0, weight=1)

        # Инициализация и отображение главного экрана с выбором необходимого сертификата для создания
        self.main_frame = MainFrame(self)
        self.main_frame.show()

        # Инициализация экранов создания сертификатов
        self.self_signed_ssl_frame = SelfSignedSslFrame(self)
        self.signed_ssl_frame = SignedSslFrame(self)
Exemplo n.º 10
0
    def autoLogin(self):
        if Setting.getSign().lower() == 'false':
            return False
        if Setting.getAuto().lower() == 'true':
            pass
        else:
            return False

        username = Setting.getLastLogin()
        passwd = Setting.getPasswd()
        if username == '' or passwd == '':
            Util.MessageBox(self, u'缺少用户名或密码!', u'错误', wx.OK | wx.ICON_ERROR)
            return

        dlg = ProgressDialog.ProgressDialog(self, u'连接服务器...')
        dlg.CenterOnScreen()

        url = 'http://%s:5000/v2.0' % (Setting.getServer())

        RestartDeviceRequests()

        loginthread = LoginThread(dlg, url, username, passwd)
        loginthread.start()
        #dlg.SetPosition((100,100))
        #dlg.Move((Resource.screenX-dlg.))
        #dlg.CenterOnScreen()
        #ret = dlg.ShowModal()
        #dlg.Destroy()
        if dlg.ShowModal() == wx.ID_CANCEL:
            loginthread.stop()
            return
        if loginthread:
            loginthread.stop()
        dlg.Destroy()

        Logger.info("Connect to %s", url)
        Logger.info("UserId: %s, Password: ******", username)
        ret, reason, detail = loginthread.getReturnValue()
        Logger.info("Result: %s, reason: %s, detail: %s", ret, reason, detail)

        if not ret:
            Util.MessageBox(self, detail, reason, wx.OK | wx.ICON_ERROR)
            self.ShowFullScreen(True)
            Session.logout()
        else:
            f = MainFrame.MainFrame(self.GetParent(), wx.ScreenDC().GetSize())
            f.ShowFullScreen(True)
            self.GetParent().Hide()
Exemplo n.º 11
0
Arquivo: App.py Projeto: Sawiq/pykpc
 def OnInit (self):
     """ App initialiser """
     wx.SetDefaultPyEncoding("utf-8")
     
     self.SetAppName(u'pykpc')
     
     config = wx.Config()
     lang = config.Read('lang', 'LANGUAGE_DEFAULT')
     
     self.locale = wx.Locale(getattr(wx, lang))
     self.localePath = os.path.abspath('./locale') + os.path.sep
     self.locale.AddCatalogLookupPathPrefix(self.localePath)
     self.locale.AddCatalog(self.AppName)
     
     self.frame = MainFrame.MainFrame(None, title=_("Pump"))
     self.frame.Show()
     return True
Exemplo n.º 12
0
    def __init__(self, port=5478, IP1='192.168.10.60', IP2='192.168.10.61'):
        '''
        Constructor
        '''
        self.port = port  # currently we are always using 5478

        self.IP1 = IP1  # the ip addresses of the wto level parsperry pis

        self.IP2 = IP2

        self.MC = MC = MainFrame.MainFrame(
            None,
            title="test")  # this redirects out put into a wx python window.
        MC.SetFramePosition(500)  # sets the left corner in x
        MC.SizeFrame(x=600, y=600)  #sizes the frame

        #Now we start beautify the frame.

        self.CreateMenu()
        self.CreateButton()
Exemplo n.º 13
0
def main():
    # 第1步,实例化object,建立窗口window
    window = tk.Tk()

    # 设置窗口大小
    winWidth = window.winfo_screenwidth()
    winHeight = window.winfo_screenheight()
    # 获取屏幕分辨率
    screenWidth = window.winfo_screenwidth()
    screenHeight = window.winfo_screenheight()

    x = int((screenWidth - winWidth) / 2)
    y = int((screenHeight - winHeight) / 2)
    # 设置主窗口标题
    window.title("像机构一样思考")
    # 设置窗口初始位置在屏幕居中
    # window.geometry("%sx%s+%s+%s" % (winWidth, winHeight, x, y))
    window.geometry('640x480+200+200')
    # 设置窗口图标
    # window.iconbitmap("./image/android_icon.ico")
    # 设置窗口宽高固定
    window.resizable(True, True)

    global mainframe
    mainframe = MainFrame(window)
    mainframe.pack(fill=BOTH, expand=1)

    create_menu(window)

    message = SplashMessage()
    message.title('新股')
    message.geometry('480x320+200+200')
    message.attributes("-topmost", True)  # 永远处于顶层
    message.mainloop()

    window.mainloop()
Exemplo n.º 14
0
import MainFrame
import wx

if __name__ == '__main__':
    app = wx.App(False)
    frame = MainFrame.MainFrame()
    app.MainLoop()
Exemplo n.º 15
0
 def OnInit(self):
     wx.InitAllImageHandlers()
     mainFrame = MainFrame.MainFrame(None, -1, "")
     self.SetTopWindow(mainFrame)
     mainFrame.Show()
     return 1
Exemplo n.º 16
0
import Tkinter as tk
import MainFrame

root = tk.Tk()

mf = MainFrame.MainFrame(root)
mf.pack(fill=tk.BOTH, expand=1)

root.update()
root.minsize(root.winfo_width(), root.winfo_height())

root.mainloop()
Exemplo n.º 17
0
import wx

from {{ cookiecutter.repo_name }}.{{ cookiecutter.repo_name }} import MainFrame

if __name__ == '__main__':
    app = wx.App()
    frm = MainFrame(None, title='This is the title')
    frm.Show()
    app.MainLoop()
Exemplo n.º 18
0
    root.title("Paràmetres")
    lbl = tk.Label(
        root, text="Introduïu el tamany del tauler, per defecte serà de 5x5")
    lbl.pack()
    num = tk.Entry(root, width=5)
    num.pack()

    tamany = tk.Button(root, text="CREA SIMULACIÓ")
    tamany["command"] = lambda: asignar_params(num)
    tamany.pack()

    root.mainloop()

    root = tk.Tk()
    root.title("ROBOT AMB PASSADISSOS ESTRETS")
    mf = MainFrame(root, n)
    mf.pack(side="left", fill="both", expand=True)
    a = Robot(n)

    # Botó per inserir els murs
    mur = tk.Button(root, text="Mur", bg="Grey", width=5, height=2)
    mur["command"] = lambda: mf.afegirElement(1)
    mur.pack(side="top", fill="both")

    # Botó per inserir l'agent en una posició en concret
    agent = tk.Button(root, text="Agent", bg="Grey", width=5, height=2)
    agent["command"] = lambda: mf.afegirElement(2)
    agent.pack(side="top", fill="both")

    # Botó per inicialitzar la simulació
    init = tk.Button(root, text="Inicialitza", bg="yellow")
Exemplo n.º 19
0
#!/usr/bin/env python
import wx
import sys

sys.path.append("classes")

import MainFrame

app = wx.App(False)
frame = MainFrame.MainFrame(None, 'Hisaab')
#Show the Main Frame in center
frame.CenterOnScreen()
frame.Show(True)
app.MainLoop()
Exemplo n.º 20
0
"""
    ******************************************************************
    *                                                                *
    * Travel Sales Man problem is a type of problem where we can use *
    * genethic algorithm to find better and faster answer.          *
    *                                                                *
    ******************************************************************
    
    1.) This class is main class for this project

"""

import MainFrame

#-------------------------------------------------------------------------------------
if __name__ == "__main__":
    app = MainFrame.MainFrame()
    app.mainloop()
#-------------------------------------------------------------------------------------