Пример #1
0
 def win32special(self):
     lang = self.getstringitem('system_language')
     import Font
     if lang == 'el' or lang == 'EL':
         Font.set_win32_charset('GREEK')
     else:
         Font.set_win32_charset('DEFAULT')
Пример #2
0
def process_line(i: str) -> str:
    global x_height
    out = ""
    for character in i:
        out += """\n       <g  transform="matrix(1,0,0,1,%d,%d)">""" % (x_height, y_height)
        out += Font.generate_svg_code(character)

        out += "       </g>\n"
        x_height += Font.get_character_width(character)
    return out
Пример #3
0
    def nameWidget(self):
        # Initialization
        ret = QLabel('')
        font = Font("Copperplate Gothic Bold", 50)
        ret.setFont(font.getFont())
        ret.setAlignment(Qt.AlignCenter)

        # set Game Name
        ret.setText(GAME_TITLE)
        ret.setToolTip("<html><head/><body><p>별을 찾아...</p></body></html>")
        return ret
     def render_xlsx(self, outfd, data):
+        BoldStyle = Style(font=Font(name='Calibri',
+                 size=11,
+                 bold=True,
+                 italic=False,
+                 vertAlign=None,
+                 underline='none',
+                 strike=False,
+                 color='FFFFFFFF'),
+            fill=PatternFill(fill_type="solid",
+                 start_color='FF000000',
+                 end_color='FF000000'))
+        RedStyle = Style(font=Font(name='Calibri',
+                 size=11,
+                 bold=False,
+                 italic=False,
+                 vertAlign=None,
+                 underline='none',
+                 strike=False,
+                 color='FF000000'),
+            border=Border(left=Side(border_style="thick",
+                                color='FF000000'),
+                      right=Side(border_style="thick",
+                                 color='FF000000'),
+                      top=Side(border_style="thick",
+                               color='FF000000'),
+                      bottom=Side(border_style="thick",
+                                  color='FF000000'),
+                      diagonal=Side(border_style="thick",
+                                    color='FF000000'),
+                      diagonal_direction=0,
+                      outline=Side(border_style="thick",
+                                   color='FF000000'),
+                      vertical=Side(border_style="thick",
+                                    color='FF000000'),
+                      horizontal=Side(border_style="thick",
+                                     color='FF000000')),
+            fill=PatternFill(start_color = 'FFFF0000',
+                    end_color = 'FFFF0000',
+                    fill_type = 'solid'))
+        GreenStyle = Style(font=Font(name='Calibri',
+                 size=11,
+                 bold=False,
+                 italic=False,
+                 vertAlign=None,
+                 underline='none',
+                 strike=False,
+                 color='FF000000'),
+            fill=PatternFill(start_color = "FF00FF00",
+                    end_color = "FF00FF00",
+                    fill_type = "solid"))
+
         wb = Workbook(optimized_write = True)
Пример #5
0
    def close(self):
        if self._subwindows:
            self._subwindows[0].onApplicationExit()
        for func, args in self._closecallbacks:
            apply(func, args)
        for win in self._subwindows[:]:
            win.close()
            if hasattr(win,'DestroyWindow'):
                win.DestroyWindow()
        self._closecallbacks = []
        self._subwindows = []

        import Font
        Font.delfonts()
Пример #6
0
 def update(self, keys, leftClicked, mousePos, enemies, projectiles):
     self.levelNum = Font.createTextObject(Font.smallCambria,
                                           str(self.level),
                                           Color.black)  #Inefficient
     self.cooldown += 1
     if self.cooldown > 7500:
         self.cooldown = 0
     self.rect = pygame.Rect(self.x, self.y, self.width, self.height)
     for e in enemies:
         if e.rect.colliderect(self.rect):
             self.hp -= 3 / 30
             self.score -= 1
     if leftClicked and self.cooldown > 30:
         self.cooldown = 0
         self.weapon.fire(mousePos, projectiles)
     self.healthBar.update(self.x, self.y, self.hp)
     self.levelBar.update(self.x, self.y, self.xp)
     if keys[0]:
         self.move(-self.speed, 1)
     elif keys[1]:
         self.move(self.speed, 1)
     if keys[2]:
         self.move(-self.speed, 0)
     elif keys[3]:
         self.move(self.speed, 0)
Пример #7
0
 def __init__(self, x, y, sprite):
     self.image = sprite.image
     self.spawnX = x
     self.spawnY = y
     self.x = x
     self.y = y + Level.yOffset
     self.width = sprite.width
     self.height = sprite.height
     self.rect = pygame.Rect(self.x, self.y, self.width, self.height)
     self.speed = 10
     self.hp = 10
     self.score = 0
     self.xp = 0
     self.level = 0
     self.levelNum = Font.createTextObject(Font.smallCambria,
                                           str(self.level), Color.black)
     self.healthBar = Bar(self, self.hp, self.hp)
     self.levelBar = LevelBar(self,
                              self.xp,
                              100,
                              Color.purple,
                              Color.white,
                              yOffset=-2,
                              height=2)
     self.inv = Inventory(self)
     self.weapon = Weapons.Flame(self)
     self.cooldown = 0
Пример #8
0
 def __init__(self):
     self.window = Tk()
     self.make_bind()
     # self.window.bind('<Control-s>', lambda e: self.test())
     self.window.title('New Document')
     self.menu_bar = Menu(self.window)
     self.window.config(menu=self.menu_bar)
     self.file_menu = Menu(self.menu_bar, tearoff=0)
     self.help_menu = Menu(self.menu_bar, tearoff=0)
     self.format_menu = Menu(self.menu_bar, tearoff=0)
     self.display = Text()
     self.display.pack(fill=BOTH, expand=1)
     self.font = Font(self.window, self.display)
     self.font.change_font()
     self.path = None
     self.make_template()
Пример #9
0
def get_max_x(text: str) -> int:
    out = 20
    for i in text.split("\n"):
        line_length = 20
        for character in i:
            line_length += Font.get_character_width(character)
        if line_length > out:
            out = line_length
    return out
Пример #10
0
 def update(self, nx, ny, filler):
     if filler >= self.max:
         self.owner.xp -= self.max
         self.owner.level += 1
         self.owner.levelNum = Font.createTextObject(
             Font.smallCambria, str(self.owner.level), Color.black)
     self.x = nx
     self.y = ny + self.offset
     width = filler * self.pixelsPerUnit
     rect = (0, 0, width, self.height)
     self.image.fill(self.bg)
     self.image.fill(self.fg, rect)
Пример #11
0
 def __init__(self, **kwds):
     super(Viewer, self).__init__(width=960, height=540, **kwds)
     self._init = False
     self.font = Font.Font(os.path.join(root, "data/os.glf"))
     self.icons = zlib.decompress(
         file(os.path.join(root, "data/icons.z"), 'rb').read())
     self.iconsz = int(math.sqrt(len(self.icons)))
     self.timeline = ui.Timeline()
     self.timeline.setNow(time.time())
     self.svbo = ui.SharedVbo()
     self.wasFull = False
     self.keyfocus = None
Пример #12
0
    def ClientDataLayout(self):
        # Initialization
        ret = QVBoxLayout()
        Label = QLabel('')
        ret.addWidget(Label)
        Label.setAlignment(Qt.AlignRight)
        font = Font("Century Schoolbook", 10)
        Label.setFont(font.getFont())

        # get Client, Server Version
        ClientVersion = str(VERSION)  # import options
        ServerVersion = str(self.GameMain.serverVersion)

        # get Client ID
        data = DataManagement("playerdata.dat")
        ClientID = data.get(CLIENT_ID_KEY)

        # Label Text
        LabelText = "Client Ver: %s\n Server Ver: %s\n Client ID: %s" \
                    % (ClientVersion, ServerVersion, ClientID)

        Label.setText(LabelText)
        return ret
Пример #13
0
 def __init__(self,
              text,
              connectLayout,
              x=120,
              y=60,
              fontname="Bahnschrift Condensed",
              fontsize=16):
     # Initialization
     super().__init__(text)
     font = Font(fontname, fontsize)
     font.setBold(True)
     self.setFont(font.getFont())
     self.setFlat(True)
     self.setStyleSheet("border-style: outset; \
                     border-width: 5px; \
                     border-radius: 10px; \
                     border-color: grey; \
                     min-width: 6em; \
                     padding: 1px;")
     self.setFixedSize(x, y)
     self.clicked.connect(self.buttonClicked)
     self.GameMain = connectLayout.GameMain
     self.connectedLayout = connectLayout
Пример #14
0
def enter():
    global background

    background = load_image("IMAGE/Ending.png")

    global font

    font = Font.load("FONT/koverwatch.ttf", 35)

    global bgm, clear_wav

    bgm = load_music("SOUND/ending theme.mp3")
    clear_wav = load_wav("SOUND/clear.wav")

    bgm.repeat_play()
    clear_wav.play()

    global y

    y = 0
Пример #15
0
lamb = 1        # neural network parameter cost, regularization

n_train_batches = 10
n_epochs = 200000       #original:1500
batch_size = 1

learning_rate = 1   # learning rate, when using 0.02, less than 200000 epoches will not work.

output_num = 3      # test font output number

total_layer = 6     # writing def in loop is complicated, this parameter is not used
#%% compare output
n = 0

Fonts = Font(basis_size, font_dir, input_letter, output_letter )
#%%
trainInput, trainOutput, testInput, testOutput = Fonts.getLetterSets(n_train_batches * batch_size, output_num * batch_size)
trainInput = 1 - trainInput
trainOutput = 1 - trainOutput
testInput = 1 - testInput
testOutput = 1 - testOutput


n_train = trainInput.shape[0]
n_test = testInput.shape[0]
input_size = len(input_letter) * basis_size * basis_size
output_size = len(output_letter) * basis_size * basis_size
image_size = basis_size * basis_size

trainInput = trainInput.reshape((n_train,image_size*len(input_letter)))
Пример #16
0
#%% Load Data

import numpy as np
import theano
from theano import tensor as T


from Font import *
from utility import *
from NeuralNets import *
basis_size = 36
font_dir = 'Fonts'
input_letter = ['B','A','S','Q']
output_letter = ['R']

Fonts = Font(basis_size, font_dir, input_letter, output_letter )
#%%
trainInput, trainOutput, testInput, testOutput = Fonts.getLetterSets(10510,51)
trainInput = 1 - trainInput
trainOutput = 1 - trainOutput
testInput = 1 - testInput
testOutput = 1 - testOutput

n_train = trainInput.shape[0]
n_test = testInput.shape[0]
input_size = len(input_letter) * basis_size * basis_size
output_size = len(output_letter) * basis_size * basis_size
image_size = basis_size * basis_size

trainInput = trainInput.reshape((n_train,image_size*len(input_letter)))
trainOutput = trainOutput.reshape((n_train,image_size*len(output_letter)))