def printMenuButton(tk, text, mes, count, column): if ServiceOpt.getServiceState(mes) == -1: btn = Button(tk, text=text, anchor='w', height=1, relief=FLAT, activeforeground="blue") btn.bind("<Button-1>", lambda index=None, title="错误", mes="服务未安装": ServiceOpt. createWindow(title, mes)) btn.bind("<Enter>", lambda event: event.widget.config(fg="blue")) btn.bind("<Leave>", lambda event: event.widget.config(fg="black")) btn.grid(row=count, column=column, sticky=W) else: btn = Menubutton(tk, text=text, anchor='w', height=1, relief=FLAT, activeforeground="blue") btn.grid(row=count, column=column, sticky=W) fileMenu = Menu(btn, tearoff=False) fileMenu.add_radiobutton(label=START, value=1, command=lambda: ServiceOpt.ServiceStart(mes)) fileMenu.add_radiobutton(label=STOP, value=2, command=lambda: ServiceOpt.ServiceStop(mes)) fileMenu.add_radiobutton( label=RE_START, value=3, command=lambda: ServiceOpt.ServiceReStart(mes)) fileMenu.add_radiobutton( label=LOG_FILE, value=4, command=lambda: ServiceOpt.openNoteByName(LogListAddress, mes)) fileMenu.add_radiobutton( label=SET_START_AUTO, value=5, command=lambda: ServiceOpt.ServiceSetStartAuto(mes, "auto")) fileMenu.add_radiobutton( label=SET_START_DEMAND, value=6, command=lambda: ServiceOpt.ServiceSetStartAuto(mes, "demand")) fileMenu.add_radiobutton( label=SET_START_DISABLED, value=7, command=lambda: ServiceOpt.ServiceSetStartAuto(mes, "disabled")) btn.config(menu=fileMenu)
def btnStart(mes): ServiceOpt.ServiceStart(mes) fileMenu.entryconfig(START, state=DISABLED) printLabel(tk, STATE_STARTING, count, 4, 1)
def ServiceAllStart(ServiceNameList): for count in range(int(len(ServiceNameList) / 3)): ServiceOpt.ServiceStart(ServiceNameList[int(count * 3)])
def ServiceAllStart(ServiceNameList): for count in range(int(len(ServiceNameList) / 2)): ServiceOpt.ServiceStart(ServiceNameList[int(count * 2)]) ServiceState(count, 3, 1, ServiceNameList[int(count * 2)])
def ServiceAllStart(ServiceNameList): for count in range(len(ServiceNameList)): ServiceOpt.ServiceStart(ServiceNameList[count])