예제 #1
0
    def OnCloseWindow(self, event):
        self.destroying = True
        try:
            if hasattr(self, 'editor') and self.editor:
                self.editor.destroying = True
                self.editor.Close()
                if not self.destroying:
                    return

            if hasattr(self, 'inspector'):
                self.inspector.destroying = True
                self.inspector.Close()

                if hasattr(self, 'app'):
                    self.app = None

            Help.delHelp()

            self.palette.Hide()
            for page in self.palettePages:
                page.destroy()

        finally:
            if not self.destroying:
                self.editor.destroying = False
                self.inspector.destroying = False
            else:
                self.Destroy()
                event.Skip()

                app =wx.GetApp()
                if hasattr(app, 'tbicon'):
                    app.tbicon.Destroy()
예제 #2
0
class Kontroler:
    def __init__(self, nowyWidok = 0, nowyModel = 0) :
        self.widok = nowyWidok
        self.model = nowyModel
        self.strategia = 0


    def dodajWidok(self, nowyWidok) :
        if self.widok == 0 :
            self.widok = nowyWidok


    def dodajModel(self, nowyModel) :
        if self.model == 0 :
            self.model = nowyModel


    def glownaPetla(self) :
        while True :
            self.widok.obslugaKonsoli()
        

    def aktualizacja(self, idZadania, Args=None): # analizuje dzialania usera i zleca wykonanie odpowiednich dzialan
        args = []   # umieszczone tu zmienne wyladuja w argumentach metody main w zadaniu
        if idZadania == Zadania["ZlePolecenie"] :
            self.strategia = ZlePolecenie()
        elif idZadania == Zadania["Login"] :
            if self.model.gracz :
                self.strategia = ZlePolecenie()
            else :
                args.append(self.model)
                args.append(self.widok)
                if Args :
                    args.append(Args[0])
                    args.append(Args[1])
                self.strategia = login()
        elif idZadania == Zadania["exit"] :
            args.append(self.widok.czyscEkran)
            self.strategia = exit()
        elif idZadania == Zadania["Menu"] :
            args.append(self)
            self.strategia = Menu()
        elif idZadania == Zadania["Help"] :
            self.strategia = Help()
        if self.strategia != 0 :
            self.strategia.main(args)
예제 #3
0
    def OnClearHelpIndexes(self, event):
        import Help

        cd = Help.getCacheDir()
        for name in os.listdir(cd):
            if os.path.splitext(name)[1] == '.cached':
                os.remove(os.path.join(cd, name))
                wx.LogMessage(_('Deleted %s')%name)
예제 #4
0
 def aktualizacja(self, idZadania, Args=None): # analizuje dzialania usera i zleca wykonanie odpowiednich dzialan
     args = []   # umieszczone tu zmienne wyladuja w argumentach metody main w zadaniu
     if idZadania == Zadania["ZlePolecenie"] :
         self.strategia = ZlePolecenie()
     elif idZadania == Zadania["Login"] :
         if self.model.gracz :
             self.strategia = ZlePolecenie()
         else :
             args.append(self.model)
             args.append(self.widok)
             if Args :
                 args.append(Args[0])
                 args.append(Args[1])
             self.strategia = login()
     elif idZadania == Zadania["exit"] :
         args.append(self.widok.czyscEkran)
         self.strategia = exit()
     elif idZadania == Zadania["Menu"] :
         args.append(self)
         self.strategia = Menu()
     elif idZadania == Zadania["Help"] :
         self.strategia = Help()
     if self.strategia != 0 :
         self.strategia.main(args)
예제 #5
0
 def help(self, event=None):
     if self.helpDialog is None:
         self.helpDialog = Help.Window(self)
     else:
         self.helpDialog.deiconify()
예제 #6
0
 def OnCustomHelpToolClick(self, event):
     caption, helpFile = self.customHelpItems[event.GetId()]
     Help.showHelp(helpFile)
예제 #7
0
 def OnWxWinHelpToolClick(self, event):
     Help.showMainHelp(self.paletteHelpItems['wx'])
예제 #8
0
    def OnInit(self):
        Preferences.initScreenVars()

        # i18n support
        self.locale = wx.Locale(Preferences.i18nLanguage)
        wx.Locale.AddCatalogLookupPathPrefix(os.path.join(Preferences.pyPath, 'locale'))
        if hasattr(sys, 'frozen'):
            self.locale.AddCatalog('wxstd')   
        self.locale.AddCatalog('boa') 

        wx.ToolTip.Enable(True)
        if Preferences.debugMode == 'release':
            self.SetAssertMode(wx.PYAPP_ASSERT_SUPPRESS)
        elif Preferences.debugMode == 'development':
            self.SetAssertMode(wx.PYAPP_ASSERT_EXCEPTION)


        conf = Utils.createAndReadConfig('Explorer')
        if not conf.has_section('splash'):
            conf.add_section('splash')
            modTot = 1
        else:
            modTot = conf.getint('splash', 'modulecount')
        fileTot = len(eval(conf.get('editor', 'openfiles'), {}))

        abt = About.createSplash(None, modTot, fileTot)
        try:
            abt.Show()
            abt.Update()
            # Let the splash screen repaint
            wx.Yield()

            # Imported here to initialise core features and plug-ins
            import PaletteMapping

            print 'creating Palette'
            import Palette
            self.main = Palette.BoaFrame(None, -1, self)

            print 'creating Inspector'
            import Inspector
            inspector = Inspector.InspectorFrame(self.main)

            print 'creating Editor'
            import Editor
            editor = Editor.EditorFrame(self.main, -1, inspector, wx.Menu(),
                self.main.componentSB, self, self.main)
            self.SetTopWindow(editor)

            inspector.editor = editor

            conf.set('splash', 'modulecount', str(len(sys.modules)))
            try:
                Utils.writeConfig(conf)
            except IOError, err:
                startupErrors.append(_('Error writing config file: %s\nPlease '
              'ensure that the Explorer.*.cfg file is not read only.')% str(err))

            if not emptyEditor:
                editor.restoreEditorState()

            self.main.initPalette(inspector, editor)

    ##            editor.setupToolBar()

            import Help
            if not Preferences.delayInitHelp:
                print 'initialising help'
                Help.initHelp()

            global constricted
            constricted = constricted or Preferences.suBoaConstricted

            print 'showing main frames <<100/100>>'
            if constricted:
                editor.CenterOnScreen()
                inspector.CenterOnScreen()
                inspector.initSashes()
            else:
                self.main.Show()
                inspector.Show()
                # For some reason the splitters have to be visible on GTK before they
                # can be sized.
                inspector.initSashes()

            editor.Show()
            editor.doAfterShownActions()

            # Call startup files after complete editor initialisation
            global startupfile
            if Preferences.suExecPythonStartup and startupEnv:
                startupfile = startupEnv

            if editor.shell:
                editor.shell.execStartupScript(startupfile)
예제 #9
0
    def do_init(self, license):
        opts, files = self.tmpopts, self.tmpfiles
        del self.tmpopts
        del self.tmpfiles
        ##         del self.tmplicensedialog
        import MMurl
        import windowinterface
        if features.lightweight and len(files) > 1:
            windowinterface.showmessage(
                'Cannot open multiple files in this product.')
            files = files[:1]
        self._license = license
        ##         if not self._license.have('save'):
        ##             windowinterface.showmessage(
        ##                 'This is a demo version.\n'+
        ##                 'You will not be able to save your changes.',
        ##                 title='CMIFed license')
        self._tracing = 0
        self.tops = []
        self._mm_callbacks = {}
        self.last_location = ''
        self._untitled_counter = 1
        self.template_info = None
        try:
            import mm, posix, fcntl
        except ImportError:
            pass
        else:
            pipe_r, pipe_w = posix.pipe()
            mm.setsyncfd(pipe_w)
            self._mmfd = pipe_r
            windowinterface.select_setcallback(
                pipe_r, self._mmcallback,
                (posix.read, fcntl.fcntl, fcntl.F_SETFL, posix.O_NDELAY))
        self.commandlist = [
            EXIT(callback=(self.close_callback, ())),
            NEW_DOCUMENT(callback=(self.new_callback, ())),
            OPEN(callback=(self.open_callback, ())),
            OPENFILE(callback=(self.openfile_callback, ())),
            OPEN_RECENT(callback=self.open_recent_callback),  # Dynamic cascade
            PREFERENCES(callback=(self.preferences_callback, ())),
            CHECKVERSION(callback=(self.checkversion_callback, ())),
        ]
        import settings
        if self._license.have('preregistered'):
            settings.set('registered', 'preregistered')
        if not self._license.is_evaluation_license() and \
                        settings.get('registered') != 'preregistered':
            self.commandlist.append(
                REGISTER(callback=(self.register_callback, ())))
        import Help
        if hasattr(Help, 'hashelp') and Help.hashelp():
            self.commandlist.append(HELP(callback=(self.help_callback, ())))
        if __debug__:
            if settings.get('debug'):
                self.commandlist = self.commandlist + [
                    TRACE(callback=(self.trace_callback, ())),
                    DEBUG(callback=(self.debug_callback, ())),
                    CRASH(callback=(self.crash_callback, ())),
                ]

        if self.splash is not None:
            self.splash.unsplash()
            self.splash = None

        MainDialog.__init__(self, 'CMIFed', (not not files))

        for file in files:
            self.openURL_callback(MMurl.guessurl(file))
        self._update_recent(None)

        if ENABLE_FNORB_SUPPORT:
            import CORBA.services
            self.corba_services = CORBA.services.services(sys.argv)

        if settings.get('registered') == 'notyet' and \
                        not self._license.is_evaluation_license():
            answer = windowinterface.RegisterDialog()
            astr = ['yes', 'no', 'notyet'][answer]
            settings.set('registered', astr)
            settings.save()
            if astr == 'yes':
                self.register_callback()
예제 #10
0
        elif "update" == operator.lower():

            # TODO Check if working
            m.get_update()

        elif "uninstall" == operator.lower():
            Uninstall.uninstall("ccl", m.directory)

        elif "upgrade" == operator.lower():
            Install.updateMods(csv_list, m.directory)

        elif "help" == operator.lower():
            print("WORKING")
            if packages:
                if packages[0].lower() == "update":
                    HelpDB.update()
                elif packages[0].lower() == "upgrade":
                    HelpDB.upgrade()
                elif packages[0].lower() == "install":
                    HelpDB.install()
                elif packages[0].lower() == "list":
                    HelpDB.my_list()
                elif packages[0].lower() == "quit":
                    HelpDB.my_quit()
                elif packages[0].lower() == "help":
                    HelpDB.show_all()
                elif packages[0].lower() == "uninstall":
                    HelpDB.uninstall()
                elif packages[0].lower() == "listinstalled":
                    HelpDB.installed_list()
                else:
예제 #11
0
-qt:Do not open initial pulse window

W.T. Franks FMP Berlin
"""

import sys
from sys import argv
sys.path.append(root.UtilPath.getTopspinHome()+ '/exp/stan/nmr/py/BioPY/modules/')

import Setup, Help
import TS_Version as Ver

cmds=argv
WdB="W"
if Ver.get()[1] == "2": WdB="dB"
quiet="Loud"

########################
#  Read in preferences #
########################

for cmd in cmds:
  if cmd.find('-dB') >=0 or cmd.find('-DB') >=0 or cmd.find('-db') >=0 :
    WdB="dB"
  if cmd.find('-qt') >=0 or cmd.find('-QT') >=0 or cmd.find('-Qt') >=0 :
    quiet="Quiet"
  if cmd.find('-help') >=0 : Help.CP(); Hlep.Dec; EXIT()

if quiet=="Loud":Setup.LoadFromData(WdB)
Setup.NCOdec(WdB)
예제 #12
0
 def OnHelpToolClick(self, event):
     if self.componentSB.selection:
         Help.showCtrlHelp(self.componentSB.selection[1].__name__)
     else:
         Help.showMainHelp(self.paletteHelpItems['boa'])
예제 #13
0
########################
#  Read in preferences #
########################
Mode="Ampl"

for cmd in cmds:
  if cmd.find('-dB') >=0 or cmd.find('-DB') >=0 or cmd.find('-db') >=0 :
    WdB="dB"
  if cmd.find('-qt') >=0 or cmd.find('-QT') >=0 or cmd.find('-Qt') >=0 :
    quiet="Quiet"
  if cmd.find('-SW') >=0:
    Mode="Sweep"
  if cmd.find('-Fld') >=0:
    Mode="Field"
  if cmd.find('-pul') >=0:
    Mode="Pulse"
  if cmd.find('-help') >=0: Help.LG(); EXIT()

if quiet=="Loud":Setup.LoadFromData(WdB)
Cal=LG.FSLG(WdB)

#Cal.ByAmpl()
#Cal.ByPulse()
#Cal.ByField()
#Cal.BySW()
if Mode=="Pulse":Cal.ByPulse()
if Mode=="Field":Cal.ByField()
if Mode=="Sweep":Cal.BySW()
if Mode=="Ampl" :Cal.ByAmpl()
#LGCal.ByAmpl(WdB)
예제 #14
0
 def OnRestartHelp(self, event):
     import Help
     Help.delHelp()
     wx.Yield()
     Help.initHelp()
예제 #15
0
def day_month():
    text.insert(END, datetime.datetime.now().strftime('%A  %B'))

# --------------------------------------------------------------------------------------- #

# -------------------------------------- Menu Options ----------------------------------- #
main_menu = Menu(root)

m1 = Menu(main_menu, tearoff=0)
m1.add_command(label="New File", command=new_file)
m1.add_command(label="Open", command=open_file)
m1.add_command(label="Save", command=save_file)
m1.add_separator()
m1.add_command(label = "Signature", command=signature)
m1.add_separator()
m1.add_command(label="Exit", command=lambda : Help.exit(root))
main_menu.add_cascade(label="File", menu=m1)

m2 = Menu(main_menu, tearoff=0)
m2.add_command(label="Undo", command=undo)
m2.add_command(label="Redo", command=redo)
m2.add_separator()
m2.add_command(label="Cut", command=cut)
m2.add_command(label="Copy", command=copy)
m2.add_command(label="Paste", command=paste)
m2.add_command(label="Delete", command=delete)
m2.add_separator()
m2.add_command(label="Select All", command=select_all)
m2.add_command(label="Time/ Date", command=date_time)
m2.add_command(label="Day/ Month", command=day_month)
main_menu.add_cascade(label="Edit", menu=m2)
예제 #16
0
 def helpP(self):
     self.window.destroy()
     Help.help = Help.Help(Tk())
예제 #17
0
 def OnRestartHelp(self, event):
     import Help
     Help.delHelp()
     wx.Yield()
     Help.initHelp()
예제 #18
0
-dB:interact with db instead of watts
-qt:Do not open initial pulse window
W.T. Franks FMP Berlin
"""

import sys
from sys import argv

sys.path.append(root.UtilPath.getTopspinHome() +
                '/exp/stan/nmr/py/BioPY/modules/')

import Setup, Help
import TS_Version as Ver

cmds = argv
WdB = "W"
if Ver.get()[1] == "2": WdB = "dB"

########################
#  Read in preferences #
########################

for cmd in cmds:
    if cmd.find('-dB') >= 0 or cmd.find('-DB') >= 0 or cmd.find('-db') >= 0:
        WdB = "dB"
    if cmd.find('-help') >= 0:
        Help.Sym()
        EXIT()

Setup.C72(WdB)
예제 #19
0
 def OnWxWinHelpToolClick(self, event):
     Help.showMainHelp(self.paletteHelpItems['wx'])
예제 #20
0
#Define the highlight and its starting position/coaster
theHighlight = MainSprites.Highlight(1)
theHighlight.setLocation(coaster1)

#This is only true when the mouse is dragging a check
dragging = False

running = True

#This event is put into the queue every 10 seconds in order to spawn a check
addCheckEvent = pygame.USEREVENT
pygame.time.set_timer(addCheckEvent, 10000)

#Starts the game by calling the main menu and the info screen if so needed
if MainMenu.main(images) != "Start":
    Help.main(images)

#Reloads the screen and the image in case it is messed up by pygame form another file
image = pygame.image.load(images + "MainBackground.png")
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))

########################################################
#Below here are functions until we get to the main loop#
########################################################


#This function returns a coaster that is associated with the hand position it detects
def getHandPosition():

    #Gets the frame of when the function is called
    _, frame = cap.read()
예제 #21
0
 def OnPythonHelpToolClick(self, event):
     Help.showMainHelp(self.paletteHelpItems['python'])
예제 #22
0
 def showHelp(self, event):
     self.helpWindow = Toplevel()
     self.help = Help(self.helpWindow)
예제 #23
0
 def helpcall(self):
     import Help
     Help.givehelp('Hierarchy')
예제 #24
0
 def OnCustomHelpToolClick(self, event):
     caption, helpFile = self.customHelpItems[event.GetId()]
     Help.showHelp(helpFile)
예제 #25
0
 def OnContextHelp(self, event):
     Help.showCtrlHelp(self.objects[self.selection[0][0]][0].GetClass())
예제 #26
0
Arguments:
-dB:interact with db instead of watts
-qt:Do not open initial pulse window
W.T. Franks FMP Berlin
"""

import sys
from sys import argv
sys.path.append(root.UtilPath.getTopspinHome() +
                '/exp/stan/nmr/py/BioPY/modules/')

import Setup, Help
import TS_Version as Ver

cmds = argv
WdB = "W"
if Ver.get()[1] == "2": WdB = "dB"

########################
#  Read in preferences #
########################

for cmd in cmds:
    if cmd.find('-dB') >= 0 or cmd.find('-DB') >= 0 or cmd.find('-db') >= 0:
        WdB = "dB"
    if cmd.find('-help') >= 0:
        Help.SelPul()
        EXIT()

SelPul.S8refocus(WdB)
예제 #27
0
 def openHelp(self, event):
     dlg = Help.HelpDialog(self)
     dlg.ShowModal()
     event.Skip()
예제 #28
0
 def OnHelpToolClick(self, event):
     if self.componentSB.selection:
         Help.showCtrlHelp(self.componentSB.selection[1].__name__)
     else:
         Help.showMainHelp(self.paletteHelpItems['boa'])
예제 #29
0
def handleCommand(client, user, channel, msg):
    command = parseCommand("_", msg)

    if command:
        client.logger.write("Command in %s from %s: %s: '%s'" % (channel, user, command["command"], command["args"]))
        if command["command"] == "help":
            client.msg(channel, Help.getHelp(command["args"].strip()))

#            client.msg(channel,
#"""Type `snot <ticketNumber>` to get the contents of a ticket.
#snot <ticketNumber> <formatString> to customize the output.
#Example: $number | $summary_email | $assigned_to | $subject | $flags""")

        elif command["command"] == "snot":
            snotCommand = re.match("\s*#?(?P<ticketNumber>\d+)\s*(?P<fString>.*)", command["args"])

            number = snotCommand.group("ticketNumber")
            #fString = snotCommand.group("fString")
            fString = None
            if fString:
                formattedString = sp.formatTicket(int(number), fString)
            else:
                formattedString = sp.formatTicket(int(number), "$number | $from_line | $assigned_to | $subject | $flags")
            #client.msg(channel,"SNOT COMMAND TIME: %s" % snotCommand.groups("ticketNumber"))
            client.msg(channel, formattedString)

        elif command["command"] == "join":
            channeljoin = re.match("(#?\S*)\s*(.*)", command["args"])
            # client.msg(channel, str(channeljoin.groups()))
            # for item in channeljoin.groups():
            #     client.msg(channel, item)
            chan = channeljoin.group(1)
            key  = channeljoin.group(2)
            if (key):
                client.msg(channel, "Joining %s with key \"%s\"" % (chan, key))
                client.join(chan, key)
            else:
                client.msg(channel, "Joining %s (no key)" % (chan,))
                client.join(chan)

        elif command["command"] in ("part", "leave"):
            channelPart = re.match("(#?\S*)\s*", command["args"])
            client.leave(channelPart.group(1), "Parting is such sweet sorrow")

        elif command["command"] in ("listHandlers", "lh"):
            client.msg(channel, "Current handlers:")
            for handler in client.handlers:
                client.msg(channel, handler)

        elif command["command"] in ("reload", "rel"):
            client.msg(channel, client.reloadModule(command["args"].strip()))

        elif command["command"] in ("reloadHandler", "rh"):
            client.msg(channel, client.reloadHandler(command["args"].strip()))

        elif command["command"] in ("reloadConfig", "rc"):
            CONFIG_FILE = "config.yaml"
            with open(CONFIG_FILE) as cfgFile:
                client.config.update(yaml.load(cfgFile))

        elif command["command"] in ("startSNOTMonitoring", "ssm"):
            client.logger.write("Calling snot monitoring in subthread")
            client.msg(channel, "Restarting snot monitoring")
            reactor.callInThread(SNOTMagic.monitorLogs, client)

        elif command["command"] in ("ticketHistory", "th"):
            try:
                lines = sp.getTicketHistory(command["args"])
                for line in lines:
                    client.msg(channel, line.strip())
            except ValueError as e:
                client.msg(channel, "Invalid argument")

#        elif command["command"] in ("authstat"):
#            targetNick = command["args"]
#            def callback(prefix, command, params):
#                if prefix == "330" and params[1].lower() == targetNick.lower():
#                    client.msg(channel, "%s is logged in as %s" % (params[1], params[2]))
#                    return True
#                elif prefix == "ERR_NOSUCHNICK" and params[1].lower() == targetNick.lower():
#                    client.msg(channel, "%s does not appear to be a current user" % (params[1]))
#                    return True
#                elif prefix == "RPL_ENDOFWHOIS" and params[1].lower() == targetNick.lower():
#                    client.msg(channel, "%s does not appear to be logged in." % (params[1]))
#                else:
#                    return False
#            client.addCallback(callback)
#            client.sendLine("WHOIS %s" % command["args"])

        elif command["command"] in ("authstat",):
            targetNick = command["args"]
            LibUnderscore.checkAuthStatus(client, targetNick,
                                          lambda nick,account: client.msg(channel, "%s is logged in as %s" % (nick, account)),
                                          lambda nick        : client.msg(channel, "%s does not appear to be a current user" % (nick)),
                                          lambda nick        : client.msg(channel, "%s does not appear to be logged in" % (nick)))


        elif command["command"] in ("comp",):
            validUsers = client.users

            argSplit = command["args"].split(' ', 1)

            tickets = argSplit[0].split(',')
            if len(argSplit) >= 2:
                userMessage = argSplit[1]
            else:
                userMessage = None

            if tickets == None or tickets == ['']:
                client.msg(channel, "USAGE: comp tkt1[,tkt2,tkt3...] [message]")
                return

            def authCallback(nick,account):
                if account in validUsers:
                    for ticket in tickets:
                        if ticket.isdigit():
                            ticketDict = sp.parseTicket(int(ticket), client.config['snot']['defaultCommand'])
                            if (ticketDict):
                                client.msg(channel, "Completing %s (%s)" % (ticket, ticketDict['subject']))
                                message = "(Ticket comped by %s in %s)"
                                if userMessage:
                                    message = userMessage + "\n\n" + message
                                SNOTMagic.completeTicket(int(ticket), "*****@*****.**" % validUsers[account], client.config, message % (user,channel))
                            else:
                                client.msg(channel, "%s does not appear to be a valid ticket" % (ticket,))

                else:
                    client.msg(channel, "Sorry, you are not authorized to perform that action")
            LibUnderscore.checkAuthStatus(client, user, authCallback,
                                          lambda nick: client.msg(channel, "You don't exist. How is this even possible? Wren ^^"),
                                          lambda nick: client.msg(channel, "You must be authenticated to NickServ to perform this operation"))

        elif command["command"] in ("flag", "flags"):
            validUsers = client.users
            argSplit = command["args"].split(' ', 1)
            tickets = argSplit[0].split(',')
            if len(argSplit) >= 2:
                flags = argSplit[1]
                flagSplit = flags.split(',')
                print tickets, flags, flagSplit
                p = subprocess.Popen([client.config['snot']['defaultCommand'], '-hF'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
                print type(p.stdout)

                validFlags = [s.strip() for s in iter(p.stdout.readline,'\n')]
                print validFlags
                for flag in flagSplit:
                    if flag not in validFlags:
                        client.msg(channel, "%s is not a valid flag" % flag)
                        return
                flagsArg = flags
            else:
                client.msg(channel, "USAGE: flags tkt1,[tkt2,tkt3...] flag1[,flag2,flag3...]")
                return

            def authCallback(nick,account):
                if account in validUsers:
                    for ticket in tickets:
                        if ticket.isdigit():
                            ticketDict = sp.parseTicket(int(ticket), client.config['snot']['defaultCommand'])
                            if (ticketDict):
                                client.msg(channel, "Flagging %s (%s) as %s" % (ticket, ticketDict['subject'], flags))
                                message = "(Ticket flagged as %s by %s in %s)" % (flags,user,channel)
                                SNOTMagic.flagTicket(int(ticket), "*****@*****.**" % validUsers[account], client.config, flagsArg, message)
                            else:
                                client.msg(channel, "%s does not appear to be a valid ticket" % (ticket,))
                else:
                    client.msg(channel, "Sorry, you are not authorized to perform that action")
            LibUnderscore.checkAuthStatus(client, user, authCallback,
                                          lambda nick: client.msg(channel, "You don't exist. How is this even possible? Wren ^^"),
                                          lambda nick: client.msg(channel, "You must be authenticated to NickServ to perform this operation"))

           # if (ticket):


        elif command["command"] in ("nick",):
            def authCallback(nick,account):
                if account.lower() == "wren":
                    client.setNick(command["args"])
                else:
                    client.msg(channel, "Sorry, you are not authorized to perform that action")
            LibUnderscore.checkAuthStatus(client, user, authCallback,
                                          lambda nick: client.msg(channel, "You don't exist. How is this even possible? Wren ^^"),
                                          lambda nick: client.msg(channel, "You must be authenticated to NickServ to perform this operation"))

        elif command["command"] in ("chronicle", "chron"):
            ticketCommand = re.match("\s*#?(?P<ticketNumber>\d+)\s*(?P<fString>.*)", command["args"])
            number = int(ticketCommand.group("ticketNumber"))
            try:
                d = client.redmine_instance.getTicket(number)
                client.msg(channel, str(Template("#$id ($project) | $author | $assigned_to | $subject | $tracker").safe_substitute(d)))
            except urllib2.HTTPError as e:
                client.logger.write(str(type(e)))
                client.msg(channel, str(e))
        elif command["command"] in ("horse",):
            with open("horse_combined", 'r') as f:
                random_line = str(random.choice(f.readlines()))
                client.msg(channel, random_line)
        elif command["command"] in ("riker",):
            with open("riker.txt", 'r') as f:
                random_line = str(random.choice(f.readlines()))
                client.msg(channel, random_line)

        else:
            print "Unrecognized command"
예제 #30
0
 def OnPythonHelpToolClick(self, event):
     Help.showMainHelp(self.paletteHelpItems['python'])
예제 #31
0
MergedFrom = []

# Variables to track merged elements
Hhp, Chp, Nhp, HDec, hC, hN, NCa, NCo, CH, hhC, Nh, CX = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
NH2, CH2, Csoft = 0, 0, 0
MAS, Phases = 0, 0

########################
#  Read in preferences #
########################
i = 2
if len(cmds) >= 2:

    for cmd in cmds[1:]:
        if cmd.find('-help') >= 0:
            Help.Merger()
            EXIT()

        if cmd.find('-ph') >= 0 or cmd.find('-PH') >= 0 or cmd.find(
                '-Phase') >= 0:
            GetPhases = 1
        if cmd.find('-f') >= 0 or cmd.find('-file') >= 0 or cmd.find(
                '-F') >= 0:
            Usefile = 1
        if cmd.find('-dB') >= 0 or cmd.find('-DB') >= 0 or cmd.find(
                '-db') >= 0:
            WdB = "dB"
        if cmd.find('-ex') >= 0 or cmd.find('-EXPNO') >= 0 or cmd.find(
                '-EX') >= 0:
            expno = int(cmds[i])
            SkipFileDialog = 1
예제 #32
0
def handleCommand(client, user, channel, msg): 
    command = parseCommand(client.nickname, msg)
     
    if command:
        client.logger.write("Command in %s from %s: %s: '%s'" % (channel, user, command["command"], command["args"]))
        if command["command"] == "help":
            client.msg(channel, Help.getHelp(command["args"].strip()))

#            client.msg(channel,
#"""Type `snot <ticketNumber>` to get the contents of a ticket.
#snot <ticketNumber> <formatString> to customize the output.
#Example: $number | $summary_email | $assigned_to | $subject | $flags""")

        elif command["command"] == "snot":
            snotCommand = re.match("\s*#?(?P<ticketNumber>\d+)\s*(?P<fString>.*)", command["args"])
            
            number = snotCommand.group("ticketNumber")
            #fString = snotCommand.group("fString")
            fString = None
            if fString:
                formattedString = sp.formatTicket(int(number), fString) 
            else:
                formattedString = sp.formatTicket(int(number), "$number | $from_line | $assigned_to | $subject | $flags")
            #client.msg(channel,"SNOT COMMAND TIME: %s" % snotCommand.groups("ticketNumber"))
            client.msg(channel, formattedString)

        elif command["command"] == "join":
            channeljoin = re.match("(#?\S*)\s*(.*)", command["args"])       
            # client.msg(channel, str(channeljoin.groups()))
            # for item in channeljoin.groups():
            #     client.msg(channel, item)
            chan = channeljoin.group(1)
            key  = channeljoin.group(2)
            if (key):
                client.msg(channel, "Joining %s with key \"%s\"" % (chan, key)) 
                client.join(chan, key)
            else:
                client.msg(channel, "Joining %s (no key)" % (chan,))
                client.join(chan)

        elif command["command"] in ("part", "leave"):
            channelPart = re.match("(#?\S*)\s*", command["args"])       
            client.leave(channelPart.group(1), "Parting is such sweet sorrow")
        
        elif command["command"] in ("listHandlers", "lh"):
            client.msg(channel, "Current handlers:")
            for handler in client.handlers:
                client.msg(channel, handler)

        elif command["command"] in ("reload", "rel"):
            client.msg(channel, client.reloadModule(command["args"].strip()))
        
        elif command["command"] in ("reloadHandler", "rh"):
            client.msg(channel, client.reloadHandler(command["args"].strip()))

#        elif command["command"] in ("reloadConfig", "rc"):
#            CONFIG_FILE = "config.yaml"
#            with open(CONFIG_FILE) as cfgFile:
#                UnderscoreBot.config = yaml.load(cfgFile)

        elif command["command"] in ("startSNOTMonitoring", "ssm"):
            client.logger.write("Calling snot monitoring in subthread")
            client.msg(channel, "Restarting snot monitoring")
            reactor.callInThread(SNOTMagic.monitorLogs, client)

        elif command["command"] in ("ticketHistory", "th"):
            try:
                lines = sp.getTicketHistory(command["args"])
                for line in lines:
                    client.msg(channel, line.strip())
            except ValueError as e:
                client.msg(channel, "Invalid argument")
        
#        elif command["command"] in ("authstat"):
#            targetNick = command["args"]
#            def callback(prefix, command, params):
#                if prefix == "330" and params[1].lower() == targetNick.lower():
#                    client.msg(channel, "%s is logged in as %s" % (params[1], params[2]))
#                    return True
#                elif prefix == "ERR_NOSUCHNICK" and params[1].lower() == targetNick.lower():
#                    client.msg(channel, "%s does not appear to be a current user" % (params[1]))
#                    return True
#                elif prefix == "RPL_ENDOFWHOIS" and params[1].lower() == targetNick.lower():
#                    client.msg(channel, "%s does not appear to be logged in." % (params[1]))
#                else:
#                    return False
#            client.addCallback(callback)
#            client.sendLine("WHOIS %s" % command["args"])

        elif command["command"] in ("authstat"):
            targetNick = command["args"]
            LibUnderscore.checkAuthStatus(client, targetNick,
                                          lambda nick,account: client.msg(channel, "%s is logged in as %s" % (nick, account)),
                                          lambda nick        : client.msg(channel, "%s does not appear to be a current user" % (nick)),
                                          lambda nick        : client.msg(channel, "%s does not appear to be logged in" % (nick)))


        elif command["command"] in ("comp"):
            validUsers = client.users
            print validUsers
            tickets = command["args"].split()
            def authCallback(nick,account):
                if account in validUsers:
                    for ticket in tickets:
                        if ticket.isdigit():
                            SNOTMagic.completeTicket(int(ticket), "*****@*****.**" % validUsers[account], "Ticket comped by %s in %s" % (user,channel))
                    client.msg(channel, "Emails sent.")
                else:
                    client.msg(channel, "Sorry, you are not authorized to perform that action")
            LibUnderscore.checkAuthStatus(client, user, authCallback,
                                          lambda nick: client.msg(channel, "You don't exist. How is this even possible? Wren ^^"),
                                          lambda nick: client.msg(channel, "You must be authenticated to NickServ to perform this operation"))


        elif command["command"] in ("chronicle", "chron"):
            ticketCommand = re.match("\s*#?(?P<ticketNumber>\d+)\s*(?P<fString>.*)", command["args"])
            number = int(ticketCommand.group("ticketNumber"))
            try:
                d = client.redmine_instance.getTicket(number)
                client.msg(channel, str(Template("#$id ($project) | $author | $assigned_to | $subject | $tracker").safe_substitute(d)))
            except urllib2.HTTPError as e:
                client.logger.write(str(type(e)))
                client.msg(channel, str(e))
        else:
            print "Unrecognized command" 
예제 #33
0
    def GET(self, command1):
        command1 = str(command1)

        # help section
        if command1 == "/help":
            import Help
            return Help.script()

        # read counter value
        if command1 == "/getcountervalue":
            global counter
            return "counter value is %d" % counter

        # new approach for RPM measurement from rotary encoder
# this is based on the event detection (multiple threading process)
# when this section is selected, the rpm count is being processed in the background
# variable rpm is updated in each 5 second
# updated variable 'rpm' is return to show the current RPM to the user via web

        if command1 == "/startrpmcounter":

            t0 = time.time()
            rpmCount = -1

            def get_encoder_turn(channel):
                global rpmCount
                rpmCount = rpmCount + 1
                #print "rpm count %d"%rpmCount
                return rpmCount

            GPIO.add_event_detect(ROTARY_ENCODER,
                                  GPIO.BOTH,
                                  callback=get_encoder_turn)
            x = 0

            while True:
                t1 = time.time()

                if t1 - t0 >= 5:  #each 5 sec
                    global rpm
                    global rpmCount
                    x = get_encoder_turn(
                        ROTARY_ENCODER
                    )  # each 5 second it calls get_encoder_turn function
                    y = x
                    x = 0
                    rpmCount = -1
                    rpm = y / 8  #(y/48)*(60/5) --1 revolution is equal to 48 increment.
                    #(24 pulse per 360 degree)

                    #print "The motor RPM is:",rpm
                    t0 = t1

        if command1 == "/getrpm":
            global rpm
            return "rpm: %f " % rpm
        if command1 == "/getspeed":
            global rpm
            speed = 2 * 3.14159 * 3 * (
                float(rpm) / 60)  # 2*PI*radius in cm*rps (speed in cm/second)
            return "speed: %f" % speed
        if command1 == "/resetrpm":
            global rpm
            rpm = 0
            #GPIO.remove_event_detect (21)
            GPIO.remove_event_detect(ROTARY_ENCODER)
            return "RPM counter reseted"

        # reset counter
        if command1 == "/resetcounter":
            GPIO.remove_event_detect(23)
            global counter
            counter = 0
            return "counter reseted"

#RPM need not to be reseted

        if command1 == "/getlux":
            import LuxSensor39
            LuxSensor39.enable()
            return LuxSensor39.getLight()
            LuxSensor39.disable()

        if command1 == "/alldeviceoff":
            drivePWM.select(0, 0)
            drivePWM.select(1, 0)
            drivePWM.select(2, 0)
            drivePWM.select(3, 0)
            drivePWM.select(4, 0)
            drivePWM.select(5, 0)
            drivePWM.select(6, 0)

            return "All Devices are set to zero"
        else:
            return "Wrong Selection.Type help!!"
예제 #34
0
def KatanaCheckActionGlobalCommands(action,instance):
	if     action[:len(EXIT)]        == EXIT   or action[:len(EXIT)]        == EXIT_SHORT  : sys.exit(1995)
	elif   action[:len(HELP)]        == HELP   or action[:len(HELP_SHORT)]  == HELP_SHORT  : Help.help()
	elif   action[:len("version")]   == "version"        :printk.suff("V:["+version+"] B:["+build+"] D:["+date+"]")
	elif   action                    == UPDATE or action                    == UPDATE_SHORT: update("functions",True)
	elif action[:len(EXECUTECOMMAND)]==EXECUTECOMMAND    :subprocess.call(action[len(EXECUTECOMMAND):], shell=True)
	elif   action[:len(CLEAR)]       == CLEAR  or action[:len(CLEAR_SHORT)] == CLEAR_SHORT : subprocess.call('clear', shell=True)
	elif   action[:len(SAVEV)]       == SAVEV            :SaveValue(action)
	elif   action                    == ""               :return
	else                                                 :
		if instance == "main":MainCommandNotFound()
		else:CommandNotFound()
예제 #35
0
def driverGet(driver):
    DriverGet.DriverGet(driver).driverGet()


def rota(driver, first_location, last_location, date):
    Rota.Rota(driver, first_location, last_location, date).dataInput()


def control(driver, timee, email):
    response = Control.Control(driver, timee, email).sayfaKontrol()
    if response == "successful":
        driver.quit()
        sys.exit()


if __name__ == "__main__":
    if str(sys.argv[1]) == "--h":
        Help.Help()
    else:
        first_location = str(sys.argv[1])
        last_location = str(sys.argv[2])
        date = str(sys.argv[3])
        timee = str(sys.argv[4])
        email = str(sys.argv[5])
        while True:
            driver = driverSetting()
            driverGet(driver)
            rota(driver, first_location, last_location, date)
            control(driver, timee, email)
            time.sleep(300)
예제 #36
0
    def GET(self, command1):   
        command1=str (command1)
        
        # help section
        if command1 == "/help":
            import Help
            return Help.script()
                        
        # read counter value
        if command1 == "/getcountervalue":
            global counter
            return "counter value is %d" %counter

        # new approach for RPM measurement from rotary encoder      
	# this is based on the event detection (multiple threading process)
	# when this section is selected, the rpm count is being processed in the background
	# variable rpm is updated in each 5 second
	# updated variable 'rpm' is return to show the current RPM to the user via web

        if command1 == "/startrpmcounter":
            
            t0=time.time()
            rpmCount=-1
            
            def get_encoder_turn(channel):   
                global rpmCount
                rpmCount=rpmCount+1
                #print "rpm count %d"%rpmCount
                return rpmCount
            GPIO.add_event_detect(ROTARY_ENCODER, GPIO.BOTH, callback = get_encoder_turn)   	 
            x=0
            
            while True:              
                t1=time.time()
                          
                if t1-t0>=5:#each 5 sec
                    global rpm
                    global rpmCount
                    x=get_encoder_turn(ROTARY_ENCODER)# each 5 second it calls get_encoder_turn function
                    y=x
                    x=0
                    rpmCount=-1
                    rpm=y/8 #(y/48)*(60/5) --1 revolution is equal to 48 increment.
                            #(24 pulse per 360 degree)
                   
                    #print "The motor RPM is:",rpm                   
                    t0=t1
            
	if command1 == "/getrpm":
            global rpm
            return "rpm: %f " %rpm
        if command1 == "/getspeed":
            global rpm
            speed = 2*3.14159*3*(float(rpm)/60)# 2*PI*radius in cm*rps (speed in cm/second)
            return "speed: %f" %speed
        if command1 == "/resetrpm":
	    global rpm
            rpm=0
            #GPIO.remove_event_detect (21)
            GPIO.remove_event_detect (ROTARY_ENCODER)
            return "RPM counter reseted"
       
        # reset counter
        if command1 == "/resetcounter":
            GPIO.remove_event_detect (23)
            global counter
            counter=0
            return "counter reseted"
	#RPM need not to be reseted
        
        if command1 == "/getlux":          
            import LuxSensor39
            LuxSensor39.enable()
            return LuxSensor39.getLight()
            LuxSensor39.disable()
                                    
        if command1 == "/alldeviceoff":
            drivePWM.select(0,0)
            drivePWM.select(1,0)
            drivePWM.select(2,0)
            drivePWM.select(3,0)
            drivePWM.select(4,0)
            drivePWM.select(5,0)
            drivePWM.select(6,0)
           
            return "All Devices are set to zero"
        else:
            return "Wrong Selection.Type help!!"
 def run(self):
     while True:
         niftyPrice = h.getNiftyCurrentPrice()
         if niftyPrice != -1:
             self.signal.emit(niftyPrice)
         t.sleep(self.timer)
예제 #38
0
-qt:Do not open initial pulse window
W.T. Franks FMP Berlin
"""

import sys
from sys import argv
sys.path.append(root.UtilPath.getTopspinHome()+ '/exp/stan/nmr/py/BioPY/modules/')

import Setup, Help
import TS_Version as Ver

cmds=argv
WdB="W"
if Ver.get()[1] == "2": WdB="dB"
quiet="Loud"

########################
#  Read in preferences #
########################

for cmd in cmds:
  if cmd.find('-dB') >=0 or cmd.find('-DB') >=0 or cmd.find('-db') >=0 :
    WdB="dB"
  if cmd.find('-qt') >=0 or cmd.find('-QT') >=0 or cmd.find('-Qt') >=0 :
    quiet="Quiet"
  if cmd.find('-help') >=0 : Help.Sym(); EXIT()

if quiet=="Loud":Setup.LoadFromData(WdB)

Setup.C72(WdB)
예제 #39
0
파일: Menu.py 프로젝트: falled10/Nightmare
 def on_help(self):
     import Help
     director.push(SlideInTTransition(Help.get_help()))
예제 #40
0
 def OnContextHelp(self, event):
     Help.showCtrlHelp(self.objects[self.selection[0][0]][0].GetClass())
예제 #41
0
                    signal.signal(signal.SIGINT,
                                  lambda s, f, pdb=pdb: pdb.set_trace())
                    kbd_int = 'dummy value to prevent interrupts from being caught'

    #
##     import Help
##     if hasattr(Help, 'sethelpprogram'):
##         import settings
##         if settings.get('lightweight'):
##             Help.sethelpprogram('light')
##         else:
##             Help.sethelpprogram('editor')
    for opt, arg in opts:
        if opt == '-h':
            import Help
            Help.sethelpdir(arg)

    m = Main(opts, files, splash)

    try:
        try:
            m.run()
        except kbd_int:
            print 'Interrupt.'
            m.close_callback()
        except SystemExit, sts:
            if type(sts) is type(m):
                if sts.code:
                    print 'Exit %d' % sts.code
            elif sts:
                print 'Exit', sts
예제 #42
0
import sys
from sys import argv
sys.path.append(root.UtilPath.getTopspinHome() +
                '/exp/stan/nmr/py/BioPY/modules/')

import Setup, Help
import TS_Version as Ver

cmds = argv
WdB = "W"
if Ver.get()[1] == "2": WdB = "dB"
quiet = "Loud"

########################
#  Read in preferences #
########################

for cmd in cmds:
    if cmd.find('-dB') >= 0 or cmd.find('-DB') >= 0 or cmd.find('-db') >= 0:
        WdB = "dB"
    if cmd.find('-qt') >= 0 or cmd.find('-QT') >= 0 or cmd.find('-Qt') >= 0:
        quiet = "Quiet"
    if cmd.find('-help') >= 0:
        Help.CP()
        Help.Dec
        EXIT()

if quiet == "Loud": Setup.LoadFromData(WdB)
Setup.NCAdec(WdB)
예제 #43
0
 def help_callback(self, params=None):
     import Help
     Help.showhelpwindow()
예제 #44
0
    def OnInit(self):
        Preferences.initScreenVars()

        # i18n support
        self.locale = wx.Locale(Preferences.i18nLanguage)
        wx.Locale.AddCatalogLookupPathPrefix(os.path.join(Preferences.pyPath, 'locale'))
        if hasattr(sys, 'frozen'):
            self.locale.AddCatalog('wxstd')   
        self.locale.AddCatalog('boa') 

        wx.ToolTip.Enable(True)
        if Preferences.debugMode == 'release':
            self.SetAssertMode(wx.PYAPP_ASSERT_SUPPRESS)
        elif Preferences.debugMode == 'development':
            self.SetAssertMode(wx.PYAPP_ASSERT_EXCEPTION)


        conf = Utils.createAndReadConfig('Explorer')
        if not conf.has_section('splash'):
            conf.add_section('splash')
            modTot = 1
        else:
            modTot = conf.getint('splash', 'modulecount')
        fileTot = len(eval(conf.get('editor', 'openfiles'), {}))

        abt = About.createSplash(None, modTot, fileTot)
        try:
            abt.Show()
            abt.Update()
            # Let the splash screen repaint
            wx.Yield()

            # Imported here to initialise core features and plug-ins
            import PaletteMapping

            print 'creating Palette'
            import Palette
            self.main = Palette.BoaFrame(None, -1, self)

            print 'creating Inspector'
            import Inspector
            inspector = Inspector.InspectorFrame(self.main)

            print 'creating Editor'
            import Editor
            editor = Editor.EditorFrame(self.main, -1, inspector, wx.Menu(),
                self.main.componentSB, self, self.main)
            self.SetTopWindow(editor)

            inspector.editor = editor

            conf.set('splash', 'modulecount', str(len(sys.modules)))
            try:
                Utils.writeConfig(conf)
            except IOError, err:
                startupErrors.append(_('Error writing config file: %s\nPlease '
              'ensure that the Explorer.*.cfg file is not read only.')% str(err))

            if not emptyEditor:
                editor.restoreEditorState()

            self.main.initPalette(inspector, editor)

    ##            editor.setupToolBar()

            import Help
            if not Preferences.delayInitHelp:
                print 'initialising help'
                Help.initHelp()

            global constricted
            constricted = constricted or Preferences.suBoaConstricted

            print 'showing main frames <<100/100>>'
            if constricted:
                editor.CenterOnScreen()
                inspector.CenterOnScreen()
                inspector.initSashes()
            else:
                self.main.Show()
                inspector.Show()
                # For some reason the splitters have to be visible on GTK before they
                # can be sized.
                inspector.initSashes()

            editor.Show()
            editor.doAfterShownActions()

            # Call startup files after complete editor initialisation
            global startupfile
            if Preferences.suExecPythonStartup and startupEnv:
                startupfile = startupEnv

            if editor.shell:
                editor.shell.execStartupScript(startupfile)
예제 #45
0
                for elem in meta.get(suspicious_file):
                    print elem
            elif sys.argv[1] == "--packer":

                packers = packer.get(suspicious_file)
                print packers
            elif sys.argv[1] == "--suspicious_api":
                list = suspicious_api.get(suspicious_file)
                print list
            elif sys.argv[1] == "--sections":
                for section in sections.get(suspicious_file):
                    print section
            elif sys.argv[1] == "--strings":
                print strings.get(sys.argv[2])

            elif sys.argv[1] == "--suspicious_sections":
                print suspicious_sections.get(suspicious_file)
            elif sys.argv[1] == "--help":
                print Help.help()

            elif sys.argv[1] == "--scan":
                virusto = analyzePattern.analyzeInstance()
                virusto.configuration(sys.argv[2])
                report = analyzePattern.getReport(virusto)
                analyzePattern.get(report, displayMode="default")
            else:
                Help.help()

    else:
        Help.help()