Пример #1
0
     def render_xlsx(self, outfd, data):
-        BoldStyle = Style(font=Font(name='Calibri',
+        BoldStyle = NamedStyle(name='BoldStyle', font=Font(name='Calibri',
                  size=11,
                  bold=True,
                  italic=False,
@@ -244,7 +244,7 @@ class PsXview(common.AbstractWindowsComm
     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)
Пример #3
0
    def getSearchLayout(self):
        # Widget
        sortLabel = QLabel('Sort')
        sortLabel.setFont(Font("Bahnschrift Condensed", 16).getFont())
        self.sortComboBox = QComboBox()
        self.sortComboBox.addItems(['recent Map', 'my Map'])
        self.searchLine = QLineEdit('')
        self.searchLine.setStyleSheet("border-style: outset; \
                        border-width: 5px; \
                        border-radius: 10px; \
                        border-color: grey; \
                        min-width: 10em; \
                        padding: 6px;")
        self.searchButton = MapListButton('Search',
                                          connectLayout=self,
                                          x=100,
                                          y=35,
                                          fontsize=12)

        # Event
        self.sortComboBox.currentTextChanged.connect(
            self.changeListViewData)  # if ComboBox Text Changed
        self.searchButton.clicked.connect(self.changeListViewData)

        # Layout
        layout = QHBoxLayout()
        layout.addWidget(sortLabel)
        layout.addWidget(self.sortComboBox)
        layout.addStretch(1)
        layout.addWidget(self.searchLine)
        layout.addWidget(self.searchButton)
        return layout
Пример #4
0
    def __init__(self, **kwargs):
        super(TextAnimBase, self).__init__(**kwargs)

        # override defaults
        # gather any passed in values
        for key, value in kwargs.iteritems():
            setattr(self, key, value)

        assert isinstance(self.text,
                          Text), "text parameter must be an instance of Text."

        self.font = Font.Font(self.text.getFontFace(), self.text.getFontSize())

        # This needs changing to use self.text.Xpos etc at some point
        self.origin = (self.Xpos, self.Ypos)
        self.Xpos1, self.Ypos1 = self.origin

        if self.text.lineType:
            self.lineType = self.text.lineType

        # buffer size needs to be adjusted if HERSHEY because openCV seems to
        #lose the first two horizontal pixels (left and right) and 2 vertical (top and bottom)

        # set the textBuffer to transparent black to start with
        w, h = self.font.getTextBbox(self.text.getText())
        if self.font.getFontType() == BDF_FONTTYPE:
            # BDF font width does not leave a gap between letters
            self.textBuffer = np.zeros((h + 2, w, 4), dtype=np.uint8)
        else:
            # openCV fonts need a bigger margin
            self.textBuffer = np.zeros((h + 4, w + 4, 4), dtype=np.uint8)

        self.setBgColor()
Пример #5
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
Пример #6
0
    def getMainLabelLayout(self):
        # Label
        label_font = Font("Copperplate Gothic Bold", 60)
        label = QLabel('Loading...')
        label.setFont(label_font.getFont())

        # Layout
        layout = QHBoxLayout()
        layout.addWidget(label)
        layout.setAlignment(Qt.AlignCenter)
        return layout
Пример #7
0
    def getLoadingStatusLabelLayout(self):
        # LoadingStatus Label
        self.LoadingStatus = QLabel('Game Initializing...')
        ls_font = Font("Century Schoolbook", 15)
        self.LoadingStatus.setFont(ls_font.getFont())

        # Layout
        layout = QHBoxLayout()
        layout.addWidget(self.LoadingStatus)
        layout.setAlignment(Qt.AlignCenter)
        return layout
Пример #8
0
    def __init__(self, size: Size, position: Position, text: str, theme: UIThemes,
                 font: Font = Font(Fonts.comic_sans.name, 15)):
        self.size = size
        self.position = position
        self.theme = theme
        self.text = text
        self.font = font

        super().__init__("btn", self.size, self.position, self.__background_colors[theme.value],
                         self.__click_background_colors[theme.value],
                         self.__hover_background_colors[theme.value])
Пример #9
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
Пример #10
0
    def __init__(self, size: Size, position: Position, text: str, font: Font = Font(Fonts.comic_sans.name, 15)):
        self.position = position
        self.size = size
        self.text = text
        self.font = font

        self.elements = list()

        super().__init__("txt", self.size, self.position)

        self.style = Styles.text_box

        self.__last_blink_time = Time.millis()

        self.event_handler = self.__event_handler
Пример #11
0
 def __init__(self, text, GameMain):
     # Initialization
     super().__init__(text)
     font = Font("Script MT Bold", 16)
     font.setBold(True)
     self.setFont(font.getFont())
     self.setFixedSize(120, 60)
     self.clicked.connect(self.buttonClicked)
     self.GameMain = GameMain
     self.setFlat(True)
     self.setStyleSheet("border-style: outset; \
             border-width: 5px; \
             border-radius: 10px; \
             border-color: grey; \
             min-width: 10em; \
             padding: 6px;")
Пример #12
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()
Пример #13
0
    def getListViewLayout(self):
        # ListView Widget
        self.ListView = QListView()
        self.ListView.setFont(Font("Bahnschrift Condensed", 12).getFont())
        self.ListView.setEditTriggers(
            QAbstractItemView.NoEditTriggers)  # Uneditable QListView
        self.ListView.doubleClicked.connect(self.processMapRawData)

        # Page Move Layout
        PageMoveLayout = self.getPageMoveLayout()

        # layout
        layout = QVBoxLayout()
        layout.addWidget(self.ListView)
        layout.addLayout(PageMoveLayout)
        return layout
Пример #14
0
    def getPageMoveLayout(self):
        # Widget
        self.LeftMove = MapListButton('<', connectLayout=self, x=40, y=40)
        self.Page = QLabel('1')
        PageFont = Font('Century Gothic', 13)
        self.Page.setFont(PageFont.getFont())
        self.RightMove = MapListButton('>', connectLayout=self, x=40, y=40)

        # layout
        layout = QHBoxLayout()
        layout.addStretch(1)
        layout.addWidget(self.LeftMove)
        layout.addWidget(self.Page)
        layout.addWidget(self.RightMove)
        layout.addStretch(1)
        layout.setAlignment(Qt.AlignCenter)
        return layout
Пример #15
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
Пример #16
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
Пример #17
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)))
Пример #18
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.time = time.time()
     self.svbo = ui.SharedVbo()
import Font
import numpy as np
import cv2
from Constants import *

FONTSIZE=10

msg="A" #BCDEFGHIJKLMNOPQRSTUVWXYZyjqp"

f=Font.Font(FONT_HERSHEY_SIMPLEX,FONTSIZE)
w,h,b=f.getBbox(msg)

print "CV2 Bbox",w,h,b

#img=np.zeros((h+b+4,w+4,4),dtype=np.uint8)
img=np.zeros((100,100,4),dtype=np.uint8)


cv2.line(img,(0,FONTSIZE+2),(100,FONTSIZE+2),(0,0,255,255),1,LINE_8)
f.drawText(img,(2,h+2),msg,(255,255,0,255))

fBdf=Font.Font("BDF",FONTSIZE)
w,h,b=fBdf.getBbox(msg)

print "BDF Bbox",w,h,b

fBdf.drawText(img,(30,2),msg,(255,255,0,255))

cv2.imshow("CV2 image",img)
cv2.waitKey(0)
Пример #20
0
xl.cell.get_column_letter(1) #get column letter, result would be 'A'
#inverse
xl.cell.column_index_from_string('A') #get column integer, result would be 1

wb.create_sheet(title="My sheet name", index=1)
wb.save('new_transactions3.xlsx')


sheet.column_dimensions('B').width = 20
sheet.row_dimensions(2).height = 70

wb.save('new_transactions4.xlsx')

From openpyxl.styles import Font

sheet['B1'].font = Font(sz=14, bold=True, italic=True)
wb.save('new_transactions5.xlsx')

wb = xl.Workbook()
sheet = wb.create_sheet('My Sheething')
import random 

for i in range(1, 11):
    sheet['A' + str(i)].value = random.randint(1, 100)

wb.save('new_transactions6.xlsx')


refObj = xl.chart.Reference(sheet, (1, 1), (10, 1))

#sheet['C8'].value = '=SUM(C1:C7)'
Пример #21
0
 def __init__(self, text, windowtitle, fontname, fontsize):
     super().__init__()
     self.setText(text)
     self.setStandardButtons(QMessageBox.Ok | QMessageBox.Close)
     self.setWindowTitle(windowtitle)
     self.setFont(Font(fontname, fontsize).getFont())
Пример #22
0
@@ -233,7 +233,7 @@ class PsXview(common.AbstractWindowsComm
                     yield offset, source[offset], ps_sources
 
     def render_xlsx(self, outfd, data):
-        BoldStyle = Style(font=Font(name='Calibri',
+        BoldStyle = NamedStyle(name='BoldStyle', font=Font(name='Calibri',
                  size=11,
                  bold=True,
                  italic=False,
@@ -244,7 +244,7 @@ class PsXview(common.AbstractWindowsComm
             fill=PatternFill(fill_type="solid",
                  start_color='FF000000',
                  end_color='FF000000'))
-        RedStyle = Style(font=Font(name='Calibri',
+        RedStyle = NamedStyle(name='RedStyle', font=Font(name='Calibri',
                  size=11,
                  bold=False,
                  italic=False,
@@ -272,7 +272,7 @@ class PsXview(common.AbstractWindowsComm
             fill=PatternFill(start_color = 'FFFF0000',
                     end_color = 'FFFF0000',
                     fill_type = 'solid'))
-        GreenStyle = Style(font=Font(name='Calibri',
+        GreenStyle = NamedStyle(name='GreenStyle', font=Font(name='Calibri',
                  size=11,
                  bold=False,
                  italic=False,
@@ -284,7 +284,7 @@ class PsXview(common.AbstractWindowsComm
                     end_color = "FF00FF00",
                     fill_type = "solid"))
 
-        wb = Workbook(optimized_write = True)