コード例 #1
0
ファイル: mainController.py プロジェクト: late2game/ttools2
    def _mouseDown(self, infoDict):
        mouseDownPoint = infoDict['point']
        mouseDownClickCount = infoDict['clickCount']

        # double click
        if mouseDownClickCount == 2:
            if self.lftNeighborActive is True and self.lftGlyphName:
                lftGlyph = chooseRightGlyph(self.lftFontPath,
                                            self.lftGlyphName)
                if version[0] == '2':
                    xMin, yMin, xMax, yMax = lftGlyph.bounds
                else:
                    xMin, yMin, xMax, yMax = lftGlyph.box
                if xMin < (mouseDownPoint.x + lftGlyph.width
                           ) < xMax and yMin < mouseDownPoint.y < yMax:
                    OpenGlyphWindow(glyph=lftGlyph, newWindow=True)

            if self.rgtNeighborActive is True and self.rgtGlyphName:
                rgtGlyph = chooseRightGlyph(self.rgtFontPath,
                                            self.rgtGlyphName)
                if version[0] == '2':
                    xMin, yMin, xMax, yMax = rgtGlyph.bounds
                else:
                    xMin, yMin, xMax, yMax = rgtGlyph.box
                if xMin < (mouseDownPoint.x - self.currentGlyph.width
                           ) < xMax and yMin < mouseDownPoint.y < yMax:
                    OpenGlyphWindow(glyph=rgtGlyph, newWindow=True)
コード例 #2
0
ファイル: switch.py プロジェクト: frankrolf/hTools2_extension
 def update(self):
     self.glyph_window = CurrentGlyphWindow()
     if self.glyph_window is not None:
         self.glyph = CurrentGlyph()
         self.font = self.glyph.getParent()
         self.glyph_index = self.font.glyphOrder.index(self.glyph.name)
         self.font_index = self.all_fonts.index(self.font)
         self._update_text_box()
         return True
     else:
         f = CurrentFont()
         if f is not None:
             self.font = f
             self.font_index = self.all_fonts.index(self.font)
             glyph_names = get_glyphs(f)
             if len(glyph_names) > 0:
                 self.glyph = self.font[glyph_names[0]]
                 self.glyph_index = self.font.glyphOrder.index(
                     self.glyph.name)
                 self.glyph_window = OpenGlyphWindow(self.glyph,
                                                     newWindow=False)
                 self._update_text_box()
                 return True
             else:
                 print(no_glyph_selected)
                 return False
         else:
             print(no_font_open)
             return False
コード例 #3
0
 def openGlyph(self, sender):
     sel = sender.getSelection()
     if sel:
         i = sel[0]
         name = sender[i]
         self._canUpdateChangeCount = False
         OpenGlyphWindow(self._font[name])
         self._canUpdateChangeCount = True
コード例 #4
0
ファイル: GlyphSet.py プロジェクト: cjdunn/robo-cjk
 def _glyphset_List_doubleClickCallback(self, sender):
     sel = sender.getSelection()
     if not sel: return
     if self.ui.glyph is None: return
     OpenGlyphWindow(self.ui.glyph)
     gw = CurrentGlyphWindow()
     appearance = NSAppearance.appearanceNamed_(
         'NSAppearanceNameVibrantDark')
     gw.window().getNSWindow().setAppearance_(appearance)
コード例 #5
0
 def mouseDown(self, info):
     pointX, pointY = info.locationInWindow()
     for loc in self.glyphLocation_in_Window:
         x, y, w, h = loc
         if x < (pointX-400)/self.scale < x+w and y < (pointY-224)/self.scale < y+h:
             self.gl.StorageGlyphCurrentLayer = self.glyphLocation_in_Window[loc]
             if info.clickCount() == 2:
                 OpenGlyphWindow(self.gl.StorageGlyphCurrentLayer)
     self.update()
コード例 #6
0
 def lineViewDoubleClickCallback(self, sender):
     if sender.getSelectedGlyph() is not None:
         doodleGlyph = sender.getSelectedGlyph()
         doodleFont = doodleGlyph.getParent()
         for indexFont, eachFont in enumerate(self.fontsOrder):
             if eachFont.path == doodleFont.path:
                 roboGlyph = self.fontsOrder[indexFont][doodleGlyph.name]
                 break
         if roboGlyph is not None:
             OpenGlyphWindow(glyph=roboGlyph, newWindow=False)
コード例 #7
0
ファイル: TextCenter.py プロジェクト: cjdunn/robo-cjk
    def mouseDown(self, info):
        pointX, pointY = info.locationInWindow()
        didInside = False

        for loc in self.glyphLocation_in_Window:

            x, y, w, h = loc
            if x < (pointX -
                    self.margin) / self.scale - self.scrollX < x + w and y < (
                        pointY + 20) / self.scale - self.scroll < y + h:
                self.selectedGlyph = self.glyphLocation_in_Window[loc]
                didInside = True
                if info.clickCount() == 2:
                    OpenGlyphWindow(self.ui.font[self.selectedGlyph.name])

        if not didInside:
            self.selectedGlyph = None
        self.w.canvas.update()
コード例 #8
0
ファイル: switch.py プロジェクト: frankrolf/hTools2_extension
 def _down_left_callback(self, sender):
     if len(self.all_fonts) > 1:
         # get next font
         f = CurrentFont()
         i = self.all_fonts.index(f)
         try:
             prev_i = i - 1
             prev_font = self.all_fonts[prev_i]
         except IndexError:
             prev_i = -1
             prev_font = self.all_fonts[prev_i]
         # get glyph
         g_current = CurrentGlyph()
         if g_current is not None:
             if g_current.name in prev_font:
                 prev_glyph = prev_font[g_current.name]
             else:
                 prev_glyph = prev_font[prev_font.glyphOrder[0]]
             # switch to glyph window
             G = OpenGlyphWindow(prev_glyph, newWindow=False)
             # update UI
             self.update()
コード例 #9
0
ファイル: switch.py プロジェクト: frankrolf/hTools2_extension
 def _up_right_callback(self, sender):
     if len(self.all_fonts) > 1:
         # get next font
         f = CurrentFont()
         i = self.all_fonts.index(f)
         try:
             next_i = i + 1
             next_font = self.all_fonts[next_i]
         except IndexError:
             next_i = 0
             next_font = self.all_fonts[next_i]
         # get glyph
         g_current = CurrentGlyph()
         if g_current is not None:
             if g_current.name in next_font:
                 next_glyph = next_font[g_current.name]
             else:
                 next_glyph = next_font[next_font.glyphOrder[0]]
             # switch to glyph window
             G = OpenGlyphWindow(next_glyph, newWindow=False)
             # update UI
             self.update()
コード例 #10
0
    def openSelectedComponent(self, f, g):
        selectedComponents = [c for c in g.components if c.selected]

        if not len(selectedComponents):
            message("There is no selected components")
            return

        selectedComponent = selectedComponents[0]
        self.selectedComponentName = selectedComponent.baseGlyph
        self.selectedComponentOffset = selectedComponent.transformation[-2:]
        
        self.oldGlyph = g

        OpenGlyphWindow(f[self.selectedComponentName])

        self.currentGlyph = CurrentGlyph()

        addObserver(self, "currentGlyphChanged", "currentGlyphChanged")
        addObserver(self, "draw", "draw")
        addObserver(self, "draw", "drawPreview")
        addObserver(self, "draw", "drawInactive")
        addObserver(self, "mouseDown", "mouseDown")

        UpdateCurrentGlyphView()
コード例 #11
0
 def openGlyphDiffWindow(self, sender):
     newGlyphName = sender.get()[sender.getSelection()[0]]["Glyph"]
     #print "Goto Glyph:", newGlyphName
     OpenGlyphWindow(glyph=self.font[newGlyphName])
コード例 #12
0
 def selectGlyph(self, sender):
     g = self.w.info.get()
     if self.w.info.getSelection() != []:
         gs = self.w.info.getSelection()[0]
         if CurrentFont() != None:
             OpenGlyphWindow(CurrentFont()[g[gs]["Name"]], newWindow=False)
コード例 #13
0
 def mouseDown(self, info):
     if info.clickCount() == 2:
         OpenGlyphWindow(self.ui.glyph)
コード例 #14
0
    def openFirstGlyph(self):

        glyphName = "A"

        if glyphName in font.keys():
            OpenGlyphWindow(self._font[glyphName])
from mojo.UI import OpenGlyphWindow

g = CurrentGlyph()

for font in AllFonts():
    print(font)
    fontG = font[g.name]
    if fontG is not None:
        OpenGlyphWindow(fontG, newWindow=True)
コード例 #16
0
 def mouseDown(self, info):
     if info['clickCount'] == 2:
         x, y = info['point']
         tx, ty = self.selectedComponentOffset
         if self.oldGlyph.pointInside((x+tx, y+ty)):
             OpenGlyphWindow(self.oldGlyph)