当前位置: 首页>>代码示例>>Python>>正文


Python Theme类代码示例

本文整理汇总了Python中Theme的典型用法代码示例。如果您正苦于以下问题:Python Theme类的具体用法?Python Theme怎么用?Python Theme使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Theme类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_menu_javascript

    def make_menu_javascript(self,query):
        """ Creates the javascript function required to generate the menu """
        result = '''<table class=MenuBar><tr>'''
        submenus = ''
        
        ## Find all families:
        module_list = Registry.REPORTS.get_families()
        Theme.order_families(module_list)

        for k in module_list:
            items = 0
            submenu_text = '\n<table class=PopupMenu id="PopupMenu%s">' % k
            ## Add the reports in the family:
            report_list = Registry.REPORTS.family[k]
            for r in report_list:
                if r.hidden: continue
                submenu_text+="<tr class='MenuItem' onclick='SelectMenuItem(\"f?report=%s&family=%s\")'><td>%s</td></tr>\n" % (r.name, k, r.name)
                items += 1
                continue

            if items > 0:
                result += "\n<td class=MenuBarItem id='MenuBarItem%s' onmouseover='displaySubMenu(\"%s\")'>%s</td>" % (k,k,k.replace(" ","&nbsp;"))
                submenus += submenu_text + "</table>"

        return result + "<td style='width=100%'></td></tr></table>" + submenus
开发者ID:CarbonWolf,项目名称:aff4,代码行数:25,代码来源:Menus.py

示例2: render

  def render(self, visibility, topMost):
    v = (1 - visibility) ** 2

    self.engine.view.setOrthogonalProjection(normalize = True)
    font = self.engine.data.font
    
    fadeScreen(v)
          
    try:
      glEnable(GL_BLEND)
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
      glEnable(GL_COLOR_MATERIAL)
      Theme.setBaseColor(1 - v)
      wrapText(font, (.1, .2 - v), self.prompt)

      for n, c in enumerate(Guitar.KEYS):
        if self.controls.getState(c):
          glColor3f(*self.fretColors[n])
        else:
          glColor3f(.4, .4, .4)
        font.render("#%d" % (n + 1), (.5 - .15 * (2 - n), .4 + v))

      if self.controls.getState(Player.ACTION1) or \
         self.controls.getState(Player.ACTION2):
        Theme.setSelectedColor(1 - v)
      else:
        glColor3f(.4, .4, .4)
      font.render(_("Pick!"), (.45, .5 + v))
        
    finally:
      self.engine.view.resetProjection()
开发者ID:miracle2k,项目名称:fretsonfire,代码行数:31,代码来源:Dialogs.py

示例3: render

  def render(self, visibility, topMost):
    v = (1 - visibility) ** 2

    # render the background

    t = self.time / 100
    w, h, = self.engine.view.geometry[2:4]
    r = .5

    if self.spinnyDisabled != True and Theme.spinnyEditorDisabled != True:      
      self.background.transform.reset()
      self.background.transform.translate(v * 2 * w + w / 2 + math.sin(t / 2) * w / 2 * r, h / 2 + math.cos(t) * h / 2 * r)
      self.background.transform.rotate(-t)
      self.background.transform.scale(math.sin(t / 8) + 2, math.sin(t / 8) + 2)
    self.background.draw()
      
    self.engine.view.setOrthogonalProjection(normalize = True)
    font = self.engine.data.font
    
    try:
      glEnable(GL_BLEND)
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
      glEnable(GL_COLOR_MATERIAL)
      Theme.setBaseColor(1 - v)
      wrapText(font, (.1, .05 - v), self.prompt)
    finally:
      self.engine.view.resetProjection()
开发者ID:broccoliftw,项目名称:workingfofwindows8,代码行数:27,代码来源:Dialogs.py

示例4: activateMod

def activateMod(engine, modName):
    modPath = _getModPath(engine)
    m = os.path.join(modPath, modName)
    t = os.path.join(m, "theme.ini")
    if os.path.isdir(m):
        engine.resource.addDataPath(m)
        if os.path.isfile(t):
            theme = Config.load(t)
            Theme.open(theme)
开发者ID:Richardgriff,项目名称:fofix,代码行数:9,代码来源:Mod.py

示例5: setCassetteColor

 def setCassetteColor(self):
   if self.song.info.cassetteColor:
     color = Theme.colorToHex(self.song.info.cassetteColor)
   else:
     color = ""
   color = Dialogs.getText(self.engine, _("Enter cassette color in HTML (#RRGGBB) format."), color)
   if color:
     try:
       self.song.info.setCassetteColor(Theme.hexToColor(color))
       self.modified = True
     except ValueError:
       Dialogs.showMessage(self.engine, _("That isn't a color."))
开发者ID:fretsonfire,项目名称:fof-python,代码行数:12,代码来源:Editor.py

示例6: debugOut

  def debugOut(self, engine):
    f = open("debug.txt", "w+")
    version = Version.version()
    currentDir = os.getcwd()
    dataDir = Version.dataPath()
    translationDir = dataDir + "/translations"
    modsDir = dataDir + "/mods"

    f.write("Date = %s\n" % datetime.datetime.now())   
    f.write("\nVersion = %s\n" %  version)
    f.write("\nOS = %s\n" % os.name)

    f.write("\nCurrent Directory = %s\n" % currentDir)
    self.directoryList(f, currentDir)

    f.write("\nData Directory = %s\n" % dataDir)
    self.directoryList(f, dataDir)

    f.write("\nLibrary.zip\n")
    zip = zipfile.ZipFile(dataDir + "/library.zip", 'r')
    for info in zip.infolist():
      fileName = info.filename
      fileCSize = info.compress_size
      fileSize = info.file_size
      fileDate = datetime.datetime(*(info.date_time))
      f.write("%s, %s, %s, %s\n" % (fileName, fileCSize, fileSize, fileDate))

    
    f.write("\nTranslation Directory = %s\n" % translationDir)
    self.directoryList(f, translationDir)
    
    f.write("\nMods Directory = %s\n" % modsDir)
    self.directoryList(f, modsDir)

    mods = os.listdir(modsDir)

    for mod in mods:
      modDir = os.path.join(modsDir, mod)
      if os.path.isdir(modDir):
        f.write("\nMod Directory = %s\n" % modDir)
        self.directoryList(f, modDir)

    f.write("\nFretsonfire.ini\n")   
    engine.config.config.write(f)

    f.write("\nTheme.ini\n")   
    Theme.write(f, engine.config)

    f.write("\nStage.ini\n")
    stage = Stage.Stage(self, self.engine.resource.fileName("stage.ini"))
    stage.config.write(f)
    f.close()
开发者ID:broccoliftw,项目名称:workingfofwindows8,代码行数:52,代码来源:Debug.py

示例7: render

  def render(self, visibility, topMost):
    if not self.song:
      return

    v = 1.0 - ((1 - visibility) ** 2)

    # render the background
    t = self.time / 100 + 34
    w, h, = self.engine.view.geometry[2:4]
    r = .5

    if self.spinnyDisabled != True and Theme.spinnyEditorDisabled:    
      self.background.transform.reset()
      self.background.transform.translate(w / 2 + math.sin(t / 2) * w / 2 * r, h / 2 + math.cos(t) * h / 2 * r)
      self.background.transform.rotate(-t)
      self.background.transform.scale(math.sin(t / 8) + 2, math.sin(t / 8) + 2)
    self.background.draw()

    self.camera.target = ( 2, 0, 5.5)
    self.camera.origin = (-2, 9, 5.5)

    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    gluPerspective(60, 4.0 / 3.0, 0.1, 1000)
    glMatrixMode(GL_MODELVIEW)
    glLoadIdentity()
    self.camera.apply()
    self.guitar.render(v, self.song, self.scrollPos, self.controls)

    self.engine.view.setOrthogonalProjection(normalize = True)
    font = self.engine.data.font

    try:
      Theme.setSelectedColor()

      w, h = font.getStringSize(" ")

      if self.song.isPlaying():
        status = str("Playing")
      else:
        status = str("Stopped")

      t = "%d.%02d'%03d" % (self.pos / 60000, (self.pos % 60000) / 1000, self.pos % 1000)
      font.render(t, (.05, .05 - h / 2))
      font.render(status, (.05, .05 + h / 2))
      font.render(unicode(self.song.difficulty[0]), (.05, .05 + 3 * h / 2))

      Theme.setBaseColor()
      text = self.song.info.name + (self.modified and "*" or "")
      Dialogs.wrapText(font, (.5, .05 - h / 2), text)
    finally:
      self.engine.view.resetProjection()
开发者ID:Gamer125,项目名称:fofix,代码行数:52,代码来源:Editor.py

示例8: render

  def render(self, visibility, topMost):
    v = (1 - visibility) ** 2

    self.engine.view.setOrthogonalProjection(normalize = True)
    font = self.engine.data.font

    try:
      w, h = font.getStringSize(" ")

      Theme.setSelectedColor()
      font.render(_("Importing Songs"), (.05, .05 - v))
      if self.stageInfoText:
        font.render("%s (%d%%)" % (self.stageInfoText, 100 * self.stageProgress), (.05, .7 + v), scale = 0.001)

      Theme.setBaseColor()
      Dialogs.wrapText(font, (.1, .3 + v), self.statusText)
    finally:
      self.engine.view.resetProjection()
开发者ID:fretsonfire,项目名称:fof-python,代码行数:18,代码来源:Editor.py

示例9: cellLayoutFunc

 def cellLayoutFunc(self, layout, cell, model, iter):
     """show pixbuf for status"""
     item = model[iter][2]
     if item == None:
         return
     if item == "connected":
         item = "online"
     pixbuf = self.controller.theme.statusToPixbuf(item)
     cell.set_property("pixbuf", Theme.resizePixbuf(pixbuf, 16, 16))
开发者ID:csuarez,项目名称:emesene-1.6.3-fixed,代码行数:9,代码来源:StatusHistory.py

示例10: render

  def render(self, visibility, topMost):
    if not visibility:
      return

    self.engine.view.setOrthogonalProjection(normalize = True)
    try:
      v = (1 - visibility) ** 2
      font = self.engine.data.font

      if self.fadeScreen:
        Dialogs.fadeScreen(v)
      
      glEnable(GL_BLEND)
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
      glEnable(GL_COLOR_MATERIAL)

      n = len(self.choices)
      x, y = self.pos
      w, h = font.getStringSize("_")

      for i, choice in enumerate(self.choices[self.viewOffset:self.viewOffset + self.viewSize]):
        text = choice.getText(i + self.viewOffset == self.currentIndex)
        glPushMatrix()
        glRotate(v * 45, 0, 0, 1)

        # Draw arrows if scrolling is needed to see all items
        if i == 0 and self.viewOffset > 0:
          Theme.setBaseColor((1 - v) * max(.1, 1 - (1.0 / self.viewOffset) / 3))
          glPushMatrix()
          glTranslatef(x - v / 4 - w * 2, y + h / 2, 0)
          self.renderTriangle(up = (0, -1), s = .015)
          glPopMatrix()
        elif i == self.viewSize - 1 and self.viewOffset + self.viewSize < n:
          Theme.setBaseColor((1 - v) * max(.1, 1 - (1.0 / (n - self.viewOffset - self.viewSize)) / 3))
          glPushMatrix()
          glTranslatef(x - v / 4 - w * 2, y + h / 2, 0)
          self.renderTriangle(up = (0, 1), s = .015)
          glPopMatrix()

        if i + self.viewOffset == self.currentIndex:
          a = (math.sin(self.time) * .15 + .75) * (1 - v * 2)
          Theme.setSelectedColor(a)
          a *= -.005
          glTranslatef(a, a, a)
        else:
          Theme.setBaseColor(1 - v)

        font.render(text, (x - v / 4, y))
        v *= 2
        y += h
        glPopMatrix()
    finally:
      self.engine.view.resetProjection()
开发者ID:fretsonfire,项目名称:fof-python,代码行数:53,代码来源:Menu.py

示例11: initTheme

	def initTheme(self):
		'''
		loads the current theme
		'''
		self.theme = Theme(self.setting.get('gui_theme_name','DarkBlue'), self.screen)
		self.theme.load()
		self.images, self.colours, self.fonts = {}, {}, {}
		for k, v in self.theme.images.iteritems():
			self.images[k] = Tkinter.PhotoImage(file = os.path.join(self.theme.basepath, v))
		self.colours = self.theme.colours
		for k, v in self.theme.fonts.iteritems():
			self.fonts[k] = tkFont.Font(family=v['family'], size=v['size'])
开发者ID:allmyservos,项目名称:allmyservos,代码行数:12,代码来源:GUI.py

示例12: renderTracks

  def renderTracks(self, visibility):
    w = self.boardWidth / self.strings
    v = 1.0 - visibility

    if self.editorMode:
      x = (self.strings / 2 - self.selectedString) * w
      s = 2 * w / self.strings
      z1 = -0.5 * visibility ** 2
      z2 = (self.boardLength - 0.5) * visibility ** 2
      
      glColor4f(1, 1, 1, .15)
      
      glBegin(GL_TRIANGLE_STRIP)
      glVertex3f(x - s, 0, z1)
      glVertex3f(x + s, 0, z1)
      glVertex3f(x - s, 0, z2)
      glVertex3f(x + s, 0, z2)
      glEnd()

    sw = 0.035
    glEnable(GL_TEXTURE_2D)
    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    Theme.setBaseColor(1 - v)
    self.stringDrawing.texture.bind()
    for n in range(self.strings - 1, -1, -1):
      glBegin(GL_TRIANGLE_STRIP)
      glTexCoord2f(0.0, 0.0)
      glVertex3f((n - self.strings / 2) * w - sw, -v, -2)
      glTexCoord2f(1.0, 0.0)
      glVertex3f((n - self.strings / 2) * w + sw, -v, -2)
      glTexCoord2f(0.0, 1.0)
      glVertex3f((n - self.strings / 2) * w - sw, -v, self.boardLength)
      glTexCoord2f(1.0, 1.0)
      glVertex3f((n - self.strings / 2) * w + sw, -v, self.boardLength)
      glEnd()
      v *= 2
    glDisable(GL_TEXTURE_2D)
开发者ID:fretsonfire,项目名称:fof-python,代码行数:38,代码来源:Guitar.py

示例13: renderBars

  def renderBars(self, visibility, song, pos):
    if not song:
      return
    
    w            = self.boardWidth
    v            = 1.0 - visibility
    sw           = 0.02
    beatsPerUnit = self.beatsPerBoard / self.boardLength
    pos         -= self.lastBpmChange
    offset       = pos / self.currentPeriod * beatsPerUnit
    currentBeat  = pos / self.currentPeriod
    beat         = int(currentBeat)

    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    
    glPushMatrix()
    while beat < currentBeat + self.beatsPerBoard:
      z = (beat - currentBeat) / beatsPerUnit

      if z > self.boardLength * .8:
        c = (self.boardLength - z) / (self.boardLength * .2)
      elif z < 0:
        c = max(0, 1 + z)
      else:
        c = 1.0
        
      glRotate(v * 90, 0, 0, 1)

      if (beat % 1.0) < 0.001:
        Theme.setBaseColor(visibility * c * .75)
      else:
        Theme.setBaseColor(visibility * c * .5)

      glBegin(GL_TRIANGLE_STRIP)
      glVertex3f(-(w / 2), -v, z + sw)
      glVertex3f(-(w / 2), -v, z - sw)
      glVertex3f(w / 2,    -v, z + sw)
      glVertex3f(w / 2,    -v, z - sw)
      glEnd()
      
      if self.editorMode:
        beat += 1.0 / 4.0
      else:
        beat += 1
    glPopMatrix()

    Theme.setSelectedColor(visibility * .5)
    glBegin(GL_TRIANGLE_STRIP)
    glVertex3f(-w / 2, 0,  sw)
    glVertex3f(-w / 2, 0, -sw)
    glVertex3f(w / 2,  0,  sw)
    glVertex3f(w / 2,  0, -sw)
    glEnd()
开发者ID:miracle2k,项目名称:fretsonfire,代码行数:54,代码来源:Guitar.py

示例14: renderTracks

  def renderTracks(self, visibility):
    w = self.boardWidth / self.strings
    v = 1.0 - visibility

    if self.editorMode:
      x = (self.strings / 2 - self.selectedString) * w
      s = 2 * w / self.strings
      z1 = -0.5 * visibility ** 2
      z2 = (self.boardLength - 0.5) * visibility ** 2
      
      glColor4f(1, 1, 1, .15)
      
      glBegin(GL_TRIANGLE_STRIP)
      glVertex3f(x - s, 0, z1)
      glVertex3f(x + s, 0, z1)
      glVertex3f(x - s, 0, z2)
      glVertex3f(x + s, 0, z2)
      glEnd()

    sw = 0.025
    for n in range(self.strings - 1, -1, -1):
      glBegin(GL_TRIANGLE_STRIP)
      Theme.setBaseColor(0)
      glVertex3f((n - self.strings / 2) * w - sw, -v, -2)
      glVertex3f((n - self.strings / 2) * w + sw, -v, -2)
      Theme.setBaseColor((1.0 - v) * .75)
      glVertex3f((n - self.strings / 2) * w - sw, -v, -1)
      glVertex3f((n - self.strings / 2) * w + sw, -v, -1)
      Theme.setBaseColor((1.0 - v) * .75)
      glVertex3f((n - self.strings / 2) * w - sw, -v, self.boardLength * .7)
      glVertex3f((n - self.strings / 2) * w + sw, -v, self.boardLength * .7)
      Theme.setBaseColor(0)
      glVertex3f((n - self.strings / 2) * w - sw, -v, self.boardLength)
      glVertex3f((n - self.strings / 2) * w + sw, -v, self.boardLength)
      glEnd()
      v *= 2
开发者ID:miracle2k,项目名称:fretsonfire,代码行数:36,代码来源:Guitar.py

示例15: __init__

    def __init__(self, config = None):
        """
        Constructor.

        @param config:  L{Config} instance for settings
        """

        if not config:
            config = Config.load()

        self.config  = config

        fps          = self.config.get("video", "fps")
        tickrate     = self.config.get("engine", "tickrate")
        Engine.__init__(self, fps = fps, tickrate = tickrate)

        pygame.init()

        self.title             = _("Frets on Fire")
        self.restartRequested  = False
        self.handlingException = False
        self.video             = Video(self.title)
        self.audio             = Audio()

        Log.debug("Initializing audio.")
        frequency    = self.config.get("audio", "frequency")
        bits         = self.config.get("audio", "bits")
        stereo       = self.config.get("audio", "stereo")
        bufferSize   = self.config.get("audio", "buffersize")

        self.audio.pre_open(frequency = frequency, bits = bits, stereo = stereo, bufferSize = bufferSize)
        pygame.init()
        self.audio.open(frequency = frequency, bits = bits, stereo = stereo, bufferSize = bufferSize)

        Log.debug("Initializing video.")
        width, height = [int(s) for s in self.config.get("video", "resolution").split("x")]
        fullscreen    = self.config.get("video", "fullscreen")
        multisamples  = self.config.get("video", "multisamples")
        self.video.setMode((width, height), fullscreen = fullscreen, multisamples = multisamples)

        # Enable the high priority timer if configured
        if self.config.get("engine", "highpriority"):
            Log.debug("Enabling high priority timer.")
            self.timer.highPriority = True

        viewport = glGetIntegerv(GL_VIEWPORT)
        h = viewport[3] - viewport[1]
        w = viewport[2] - viewport[0]
        geometry = (0, 0, w, h)
        self.img = ImgContext(geometry)
        glViewport(int(viewport[0]), int(viewport[1]), int(viewport[2]), int(viewport[3]))

        self.input     = Input()
        self.view      = View(self, geometry)
        self.resizeScreen(w, h)

        self.resource  = Resource(Version.dataPath())
        self.server    = None
        self.sessions  = []
        self.mainloop  = self.loading

        # Load game modifications
        Mod.init(self)
        theme = Config.load(self.resource.fileName("theme.ini"))
        Theme.open(theme)

        # Make sure we are using the new upload URL
        if self.config.get("game", "uploadurl").startswith("http://kempele.fi"):
            self.config.set("game", "uploadurl", "http://fretsonfire.sourceforge.net/play")

        self.addTask(self.audio, synchronized = False)
        self.addTask(self.input, synchronized = False)
        self.addTask(self.view)
        self.addTask(self.resource, synchronized = False)
        self.data = Data(self.resource, self.img)

        self.input.addKeyListener(FullScreenSwitcher(self), priority = True)
        self.input.addSystemEventListener(SystemEventHandler(self))

        self.debugLayer         = None
        self.startupLayer       = None
        self.loadingScreenShown = False

        Log.debug("Ready.")
开发者ID:Hawkheart,项目名称:fof-reborn,代码行数:84,代码来源:GameEngine.py


注:本文中的Theme类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。