python类Font()的实例源码

UploaderApp.py 文件源码 项目:irida-miseq-uploader 作者: phac-nml 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def _post_processing_task_started(self):
        """Show a 'processing' message on the UI while the post processing task is executing."""
        pub.unsubscribe(self._post_processing_task_started, RunUploaderTopics.started_post_processing)
        pub.subscribe(self._post_processing_task_completed, RunUploaderTopics.finished_post_processing)
        pub.subscribe(self._post_processing_task_failed, RunUploaderTopics.failed_post_processing)
        logging.info("Post-processing started, updating UI.")

        self.Freeze()
        self._post_processing_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self._post_processing_placeholder = ProcessingPlaceholderText(self)
        self._post_processing_placeholder.SetFont(wx.Font(pointSize=18, family=wx.FONTFAMILY_DEFAULT, style=wx.NORMAL, weight=wx.FONTWEIGHT_BOLD, face="Segoe UI Symbol"))
        self._post_processing_text = wx.StaticText(self, label="Executing post-processing task.")
        self._post_processing_text.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD))
        self._post_processing_text.Wrap(350)
        self._post_processing_text.SetToolTipString("Executing command `{}`.".format(read_config_option("completion_cmd")))
        self._post_processing_sizer.Add(self._post_processing_text, flag=wx.RIGHT, border=5, proportion=1)
        self._post_processing_sizer.Add(self._post_processing_placeholder, flag=wx.LEFT, border=5, proportion=0)

        self._sizer.Insert(0, self._post_processing_sizer, flag=wx.EXPAND | wx.ALL, border=5)
        self.Layout()
        self.Thaw()
textstim.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def initConfig(self):
        #self.stimColor = (179, 179, 36)
        self.stimColor = (255, 255, 10)

        self.stimFont = wx.Font(pointSize=196, family=wx.FONTFAMILY_SWISS,
                            style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL)

        self.protocols = ('3minutes', 'letter practice b',
                          'letter b', 'letter d', 'letter p',
                          'letter m', 'letter t', 'letter x',
                          'motortasks practice',
                          'motortasks trial1', 'motortasks trial2',
                          'mentaltasks practice',
                          'mentaltasks trial1',
                          'mentaltasks trial2',
                          'mentaltasks trial3',
                          'mentaltasks trial4',
                          'mentaltasks trial5')
        self.nProtocols = len(self.protocols)

        self.setProtocol('3minutes')

        self.startPause = 2.0
gridspeller.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def initDefaultFonts(self):
        """Initialize default fonts.
        """
        fontEnum = wx.FontEnumerator()
        fontEnum.EnumerateFacenames()
        faceList = fontEnum.GetFacenames()
        if 'Utopia' in faceList:
            self.defaultStimFont = wx.Font(pointSize=50, family=wx.FONTFAMILY_ROMAN,
                style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL,
                #underline=False, faceName='Utopia') # wxpython3
                underline=False, face='Utopia')
            #self.defaultFeedFont = wx.Font(pointSize=36, family=wx.FONTFAMILY_ROMAN,
            #    style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL,
            #    underline=True, faceName='Utopia')
        else:
            self.defaultStimFont = wx.Font(pointSize=50, family=wx.FONTFAMILY_ROMAN,
                style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL, underline=False)
            #self.defaultFeedFont = wx.Font(pointSize=32, family=wx.FONTFAMILY_ROMAN,
            #    style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL, underline=True)

        self.defaultFeedFont = wx.Font(pointSize=32, family=wx.FONTFAMILY_MODERN,
            style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL, underline=False)
textstim.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def initDefaultFonts(self):
        """Initialize default fonts.
        """
        fontEnum = wx.FontEnumerator()
        fontEnum.EnumerateFacenames()
        faceList = fontEnum.GetFacenames()
        if 'Utopia' in faceList:
            self.defaultStimFont = wx.Font(pointSize=196, family=wx.FONTFAMILY_ROMAN,
                style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL,
                #underline=False, faceName='Utopia') # wxpython3
                underline=False, face='Utopia')
            self.defaultFeedFont = wx.Font(pointSize=32, family=wx.FONTFAMILY_ROMAN,
                style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL,
                #underline=True, faceName='Utopia') # wxpython3
                underline=True, face='Utopia')
        else:
            self.defaultStimFont = wx.Font(pointSize=196, family=wx.FONTFAMILY_ROMAN,
                style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL, underline=False)
            self.defaultFeedFont = wx.Font(pointSize=32, family=wx.FONTFAMILY_ROMAN,
                style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL, underline=True)
wx_2048_02.py 文件源码 项目:python_2048 作者: OATOMO 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def initGame(self):
        #font argument (??|??|????|????|???)
        self.bgFont = wx.Font(50,wx.SWISS,wx.NORMAL,wx.BOLD,face=u"Roboto")#????
        self.scFont = wx.Font(36,wx.SWISS,wx.NORMAL,wx.BOLD,face=u"Roboto")
        self.smFont = wx.Font(12,wx.SWISS,wx.NORMAL,wx.NORMAL,face=u"Roboto")

        self.curScore = 0 #????
        self.bstScore = 0 #????
        self.loadScore()  #?????????????????
        self.data = [[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]] #4x4 ???
                                        #?????????????
        count = 0
        while count < 2: 
            row = random.randint(0,len(self.data)-1)
            col = random.randint(0,len(self.data[0])-1)
            if self.data[row][col] != 0:
                continue
            self.data[row][col] = 2 if random.randint(0,1) else 4
            count += 1
wx_2048_02.py 文件源码 项目:python_2048 作者: OATOMO 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def drawTiles(self,dc):
        dc.SetFont(self.scFont)
        for row in range(4):
            for col in range(4):
                value = self.data[row][col]
                color = self.colors[value]
                if value==2 or value==4:
                    dc.SetTextForeground((119,110,101))
                else:
                    dc.SetTextForeground((255,255,255))
                dc.SetBrush(wx.Brush(color))
                dc.SetPen(wx.Pen(color))
                dc.DrawRoundedRectangle(30+col*115,165+row*115,100,100,2)
                size = dc.GetTextExtent(str(value))
                while size[0]>100-15*2:
                    self.scFont = wx.Font(self.scFont.GetPointSize()*4/5,wx.SWISS,wx.NORMAL,wx.BOLD,face=u"Roboto")
                    dc.SetFont(self.scFont)
                    size = dc.GetTextExtent(str(value))
                if value!=0: dc.DrawText(str(value),30+col*115+(100-size[0])/2,165+row*115+(100-size[1])/2)
statistic_plgs.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen((255,255,0), width=1, style=wx.SOLID))
        dc.SetTextForeground((255,255,0))
        font = wx.Font(8, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)

        dc.SetFont(font)
        data = self.data[0 if len(self.data)==0 else key['cur']]

        pos = [f(*(i[0][1], i[0][0])) for i in data]
        for i in pos:dc.DrawCircle(i[0], i[1], 2)

        txts = ['id={}'.format(i) for i in range(len(data))]
        dc.DrawTextList(txts, pos)

        if data[0][1]==None:return
        lt = [f(*(i[1][1], i[1][0])) for i in data]
        rb = [f(*(i[1][3], i[1][2])) for i in data]
        rects = [(x1,y1,x2-x1,y2-y1) for (x1,y1),(x2,y2) in zip(*(lt,rb))]
        dc.DrawRectangleList(rects, brushes = wx.Brush((0,0,0), wx.BRUSHSTYLE_TRANSPARENT))
statistic_plgs.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def draw(self, dc, f, **key):
        dc.SetTextForeground((255,255,0))
        font = wx.Font(8, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
        dc.SetFont(font)

        dc.SetPen(wx.Pen((0,255,0), width=1, style=wx.SOLID))
        dc.SetBrush(wx.Brush((0,255,0)))
        pos = [f(*(i[1], i[0])) for i in self.xy[self.msk]]
        for i in pos:dc.DrawCircle(int(i[0]), int(i[1]), 2)


        dc.SetPen(wx.Pen((255,0,0), width=1, style=wx.SOLID))
        dc.SetBrush(wx.Brush((255,0,0)))
        pos = [f(*(i[1], i[0])) for i in self.xy[~self.msk]]
        for i in pos:dc.DrawCircle(int(i[0]), int(i[1]), 2)
angle_tol.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
        dc.SetTextForeground(Setting['tcolor'])
        linefont = wx.Font(8, wx.FONTFAMILY_DEFAULT, 
                           wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)

        dc.SetFont(linefont)
        dc.DrawLines([f(*i) for i in self.buf])
        for i in self.buf:dc.DrawCircle(f(*i),2)
        for line in self.body:
            dc.DrawLines([f(*i) for i in line])
            for i in line:dc.DrawCircle(f(*i),2)
            pts = np.array(line)
            v1 = pts[:-2]-pts[1:-1]
            v2 = pts[2:]-pts[1:-1]
            a = np.sum(v1*v2, axis=1)*1.0
            a/=norm(v1,axis=1)*norm(v2,axis=1)
            ang = np.arccos(a)/np.pi*180
            for i,j in zip(ang,line[1:-1]):
                dc.DrawText('%.0f'%i, f(*j))
angle2_tol.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
        dc.SetTextForeground(Setting['tcolor'])
        linefont = wx.Font(10, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
        dc.SetFont(linefont)
        dc.DrawLines([f(*i) for i in self.buf])
        for i in self.buf:dc.DrawCircle(f(*i),2)
        for line in self.body:
            dc.DrawLines([f(*i) for i in line])
            for i in line:dc.DrawCircle(f(*i),2)
            pts = np.array(line)
            mid = (pts[:-1]+pts[1:])/2

            dxy = (pts[:-1]-pts[1:])
            dxy[:,1][dxy[:,1]==0] = 1
            l = norm(dxy, axis=1)*-np.sign(dxy[:,1])
            ang = np.arccos(dxy[:,0]/l)/np.pi*180
            for i,j in zip(ang, mid):
                dc.DrawText('%.0f'%i, f(*j))
area_tol.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
        dc.SetTextForeground(Setting['tcolor'])
        font = wx.Font(10, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)

        dc.SetFont(font)
        dc.DrawLines([f(*i) for i in self.buf])
        for i in self.buf:dc.DrawCircle(f(*i),2)

        for pg in self.body:
            plg = Polygon(pg)
            dc.DrawLines([f(*i) for i in pg])
            for i in pg: dc.DrawCircle(f(*i),2)
            area, xy = plg.area, plg.centroid
            if self.unit!=None: 
                area *= self.unit[0]**2
            dc.DrawText('%.1f'%area, f(xy.x, xy.y))
profile_tol.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def draw(self, dc, f, **key):
        dc.SetPen(wx.Pen(Setting['color'], width=1, style=wx.SOLID))
        dc.SetTextForeground(Setting['tcolor'])
        linefont = wx.Font(10, wx.FONTFAMILY_DEFAULT, 
                       wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
        dc.SetFont(linefont)
        if len(self.buf)>1:
            dc.DrawLines([f(*i) for i in self.buf])
        for i in self.buf:dc.DrawCircle(f(*i),2)
        for line in self.body:
            dc.DrawLines([f(*i) for i in line])
            for i in line:dc.DrawCircle(f(*i),2)
            pts = np.array(line)
            mid = (pts[:-1]+pts[1:])/2

            dxy = (pts[:-1]-pts[1:])
            dis = norm(dxy, axis=1)
            unit = 1 if self.unit is None else self.unit[0]
            for i,j in zip(dis, mid):
                dc.DrawText('%.2f'%(i*unit), f(*j))
login_OLD.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 69 收藏 0 点赞 0 评论 0
def __set_properties(self):
        # begin wxGlade: Login.__set_properties
        self.SetTitle("Login")
        #_icon = wx.EmptyIcon()
        #_icon.CopyFromBitmap(wx.Bitmap("/media/f67bc164-f440-4c0f-9e9b-3ad70ff1adc2/home/asif/Desktop/waiter animation/2.gif", wx.BITMAP_TYPE_ANY))
        #self.SetIcon(_icon)
        self.SetSize((462, 239))
        self.SetFocus()
        self.label_1.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.combo_box_1.SetSelection(0)
        self.label_2.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.text_ctrl_1.SetMinSize((185, 30))
        self.button_1.SetMinSize((85, 35))
        self.button_1.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Ubuntu"))
        self.button_2.SetMinSize((85, 35))
        self.button_2.Disable()
        # end wxGlade
user_operations.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __set_properties(self):
        # begin wxGlade: chng_pass.__set_properties
        self.SetTitle("Change Password")
        self.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.label_3.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.combo_box_1.SetMinSize((180, 32))
        self.combo_box_1.SetSelection(0)
        self.label_4.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.text_ctrl_1.SetMinSize((180, 33))
        self.label_5.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.text_ctrl_2.SetMinSize((180, 33))
        self.label_6.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.text_ctrl_3.SetMinSize((180, 33))
        self.button_1.SetMinSize((85, 33))
        self.button_2.SetMinSize((85, 33))
        self.button_2.Enable(False)
        # end wxGlade
custom_report.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __set_properties(self):
        # begin wxGlade: consolidated_report.__set_properties
        self.SetTitle("Consolidated Report")
        self.SetSize((420, 550))
        self.combo_box_1.SetSelection(0)
        self.combo_box_2.SetSelection(0)
        self.combo_box_3.SetSelection(0)
        self.combo_box_4.SetSelection(0)
        self.label_1.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.check_list_box_1.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.button_1.SetMinSize((85, 32))
        self.button_2.SetMinSize((85, 32))

        self.checkbox_1.SetValue(1)
        self.checkbox_2.SetValue(1)
        self.checkbox_3.SetValue(1)
        self.checkbox_4.SetValue(1)
        self.button_2.Enable(False)
        # end wxGlade
promotion_list.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __set_properties(self):
        # begin wxGlade: MyFrame.__set_properties
        self.SetTitle("Promotion List")
        self.SetSize((450, 350))
        self.label_1.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.combo_box_1.SetSelection(0)
        self.label_2.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.combo_box_2.SetSelection(0)

        self.button_1.SetMinSize((90, 35))
        self.button_2.SetMinSize((90, 35))
        self.button_2.Enable(False)
        #self.label_4.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        #self.combo_box_4.SetSelection(0)

        # end wxGlade
settings.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __set_properties(self):
        # begin wxGlade: Institution.__set_properties
        self.SetTitle("Institution")
        self.SetSize((550, 303))
        self.SetFocus()
        self.label_1.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.label_2.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.text_ctrl_5.SetFont(wx.Font(7, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.text_ctrl_5.SetMinSize((250, 27))
        self.label_4.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.text_ctrl_6.SetFont(wx.Font(7, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))

        self.label_6.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.text_ctrl_1.SetMinSize((250, 27))
        self.label_7.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.text_ctrl_2.SetMinSize((250, 27))
        self.label_8.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        self.text_ctrl_3.SetMinSize((250, 27))
        self.button_1.SetMinSize((80, 33))
        self.button_2.SetMinSize((80, 33))
        # end wxGlade
__init__.py 文件源码 项目:Cognitive-Face-Python 作者: Microsoft 项目源码 文件源码 阅读 74 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        super(MyTitle, self).__init__(parent)
        self.SetBackgroundColour('#00b294')
        self.SetMinSize((-1, 80))

        sizer = wx.BoxSizer()
        sizer.AddStretchSpacer()

        family = wx.FONTFAMILY_DEFAULT
        style = wx.FONTSTYLE_NORMAL
        weight = wx.FONTWEIGHT_NORMAL
        font = wx.Font(20, family, style, weight)
        self.text = wx.StaticText(self, label=TITLE, style=wx.ALIGN_CENTER)
        self.text.SetFont(font)
        sizer.Add(self.text, flag=wx.ALIGN_CENTER_VERTICAL)

        sizer.AddStretchSpacer()
        self.SetSizer(sizer)
formatframe.py 文件源码 项目:GRIPy 作者: giruenf 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def OnDrawItem(self, dc, rect, item, flags):
        if item == wx.NOT_FOUND:
            # painting the control, but there is no valid item selected yet
            return 
        font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, 'Segoe UI')             
        dc.SetFont(font)
        if flags == 3:
            margin = 3    
        else:
            margin = 1
        r = wx.Rect(*rect)  # make a copy
        r.Deflate(margin, margin)
        tam = self.OnMeasureItem(item)-2
        dc.SetPen(wx.Pen("grey", style=wx.TRANSPARENT))
        color_name = self.GetString(item)     
        color = self.colors.get(color_name)
        if not color:
            color = wx.NamedColour(color_name)
        dc.SetBrush(wx.Brush(color))
        dc.DrawRectangle(r.x, r.y, tam, tam)
        dc.DrawText(self.GetString(item), r.x + tam + 2, r.y)
UploaderApp.py 文件源码 项目:irida-miseq-uploader 作者: phac-nml 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def _settings_changed(self, api=None):
        """Reset the main display and attempt to connect to the server
           whenever the connection settings may have changed.

        Args:
            api: A placeholder for a complete api that's passed when the event is fired.
        """

        # before doing anything, clear all of the children from the sizer and
        # also delete any windows attached (Buttons and stuff extend from Window!)
        self._sizer.Clear(deleteWindows=True)
        # and clear out the list of discovered runs that we might be uploading to the server.
        self._discovered_runs = []
        # initialize the invalid sheets panel so that it can listen for events
        # before directory scanning starts, but hide it until we actually get
        # an error raised by the validation part.
        self._invalid_sheets_panel = InvalidSampleSheetsPanel(self, self._get_default_directory())
        self._invalid_sheets_panel.Hide()

        should_monitor_directory = read_config_option("monitor_default_dir", expected_type=bool, default_value=False)

        if should_monitor_directory:
            automatic_upload_status_sizer = wx.BoxSizer(wx.HORIZONTAL)
            auto_upload_enabled_text = wx.StaticText(self, label=u"? Automatic upload enabled.")
            auto_upload_enabled_text.SetFont(wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.BOLD))
            auto_upload_enabled_text.SetForegroundColour(wx.Colour(51, 102, 255))
            auto_upload_enabled_text.SetToolTipString("Monitoring {} for CompletedJobInfo.xml".format(self._get_default_directory()))

            self._sizer.Add(auto_upload_enabled_text, flag=wx.ALIGN_CENTER | wx.ALL, border=5)
            logging.info("Going to monitor default directory [{}] for new runs.".format(self._get_default_directory()))
            # topics to handle when monitoring a directory for automatic upload
            pub.subscribe(self._prepare_for_automatic_upload, DirectoryMonitorTopics.new_run_observed)
            pub.subscribe(self._start_upload, DirectoryMonitorTopics.finished_discovering_run)

            threading.Thread(target=monitor_directory, kwargs={"directory": self._get_default_directory()}).start()

       # run connecting in a different thread so we don't freeze up the GUI
        threading.Thread(target=self._connect_to_irida).start()
UploaderApp.py 文件源码 项目:irida-miseq-uploader 作者: phac-nml 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _handle_connection_error(self, error_message=None):
        """Handle connection errors that might be thrown when initially connecting to IRIDA.

        Args:
            error_message: A more detailed error message than "Can't connect"
        """

        logging.error("Handling connection error.")

        self.Freeze()

        connection_error_sizer = wx.BoxSizer(wx.HORIZONTAL)
        connection_error_header = wx.StaticText(self, label=u"? Uh-oh. I couldn't to connect to IRIDA.")
        connection_error_header.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD))
        connection_error_header.SetForegroundColour(wx.Colour(255, 0, 0))
        connection_error_header.Wrap(350)
        connection_error_sizer.Add(connection_error_header, flag=wx.LEFT | wx.RIGHT, border=5)

        self._sizer.Add(connection_error_sizer, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5)
        if error_message:
            self._sizer.Add(wx.StaticText(self, label=wordwrap(error_message, 350, wx.ClientDC(self))), flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5)

        open_settings_button = wx.Button(self, label="Open Settings")
        self.Bind(wx.EVT_BUTTON, self._parent._open_settings, id=open_settings_button.GetId())
        self._sizer.Add(open_settings_button, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5)

        self.Layout()
        self.Thaw()
        pub.unsubscribe(self._handle_connection_error, APIConnectorTopics.connection_error_topic)
UploaderApp.py 文件源码 项目:irida-miseq-uploader 作者: phac-nml 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _finished_loading(self):
        """Update the display when the run scan is finished.

        When the `DirectoryScannerTopics.finished_run_scan` topic is received, add
        the upload button to the page so that the user can start the upload.
        """
        if not self._invalid_sheets_panel.IsShown():
            self.Freeze()
            if self._discovered_runs:
                upload_button = wx.Button(self, label="Upload")
                self._upload_sizer.Add(upload_button, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5)
                self.Bind(wx.EVT_BUTTON, self._start_upload, id=upload_button.GetId())
            else:
                all_uploaded_sizer = wx.BoxSizer(wx.HORIZONTAL)
                all_uploaded_header = wx.StaticText(self, label=u"? All sample sheets uploaded.")
                all_uploaded_header.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD))
                all_uploaded_header.SetForegroundColour(wx.Colour(51, 204, 51))
                all_uploaded_header.Wrap(350)
                all_uploaded_sizer.Add(all_uploaded_header, flag=wx.LEFT | wx.RIGHT, border=5)

                self._sizer.Add(all_uploaded_sizer, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5)

                all_uploaded_details = wx.StaticText(self, label="I scanned {}, but I didn't find any sample sheets that weren't already uploaded. Click 'Scan again' to try finding new runs.".format(self._get_default_directory()))
                all_uploaded_details.Wrap(350)

                self._sizer.Add(all_uploaded_details, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5)

                scan_again = wx.Button(self, label="Scan again")
                self._sizer.Add(scan_again, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5)
                self.Bind(wx.EVT_BUTTON, self._settings_changed, id=scan_again.GetId())

            self.Layout()
            self.Thaw()
SamplePanel.py 文件源码 项目:irida-miseq-uploader 作者: phac-nml 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _upload_terminated(self, label, colour, tooltip):
        """Stop the timer and hide self when the upload is has terminated."""

        self._timer.Stop()
        self.Freeze()
        status_label = wx.StaticText(self, label=label)
        status_label.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD))
        status_label.SetForegroundColour(colour)
        status_label.SetToolTipString(tooltip)
        self._sizer.Add(status_label, flag=wx.EXPAND | wx.RIGHT, border=5)
        if self._progress is not None:
            self._progress.Destroy()
        self.Layout()
        self.Thaw()
RunPanel.py 文件源码 项目:irida-miseq-uploader 作者: phac-nml 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _upload_failed(self, exception=None):
        """Update the display when the upload has failed.

        Args:
            exception: the exception that caused the failure.
        """

        pub.unsubscribe(self._upload_failed, self._run.upload_failed_topic)
        pub.unsubscribe(self._handle_progress, self._run.upload_progress_topic)
        pub.unsubscribe(self._upload_complete, self._run.upload_completed_topic)

        self.Freeze()
        self._timer.Stop()
        self._progress_text.Destroy()
        self._progress.Destroy()
        error_label = wx.StaticText(self, label=u"? Yikes!")
        error_label.SetForegroundColour(wx.Colour(255, 0, 0))
        error_label.SetFont(wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.BOLD))
        detailed_error_label = wx.StaticText(self, label="The IRIDA server failed to accept the upload. You can try again by clicking the 'Try again' button below. If the problem persists, please contact an IRIDA administrator.".format(str(exception)))
        detailed_error_label.Wrap(350)

        self._sizer.Insert(0, detailed_error_label, flag=wx.EXPAND | wx.ALL, border=5)
        self._sizer.Insert(0, error_label, flag=wx.EXPAND | wx.ALL, border=5)

        self.Layout()
        self.Thaw()
ProcessingPlaceholderText.py 文件源码 项目:irida-miseq-uploader 作者: phac-nml 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def __init__(self, parent, *args, **kwargs):
        wx.StaticText.__init__(self, parent, *args, **kwargs)
        self._timer = wx.Timer(self)
        self._current_char = 0

        # this is the only font face on windows that actually renders the clock faces correctly.
        self.SetFont(wx.Font(pointSize=wx.DEFAULT, family=wx.FONTFAMILY_DEFAULT, style=wx.NORMAL, weight=wx.FONTWEIGHT_NORMAL, face="Segoe UI Symbol"))

        self.Bind(wx.EVT_TIMER, self._update_progress_text, self._timer)
        self.Restart()
aboutdialog.py 文件源码 项目:fritzchecksum 作者: mementum 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        maingui.AboutDialog.__init__(self, parent)
        self.font = wx.Font(10, wx.MODERN, wx.NORMAL, wx.NORMAL, False, u'Consolas')
        self.FillPanelAbout()
        self.AddDocuments()
        self.Fit() # Ensure the Dialog resizes to fit the added Panels
        self.Centre()
bciplayer.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def initPieMenu(self):
        font = wx.Font(pointSize=10, family=wx.FONTFAMILY_SWISS,
                       style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD,
                       #underline=False, face='DejaVu Serif')
                       #underline=False, faceName='Utopia') #wxpython3
                       underline=False, face='Utopia')

        self.pieMenu = widgets.PieMenu(self,
                choices=self.pg.choices, #font=font,
                rotation=4.0*np.pi/len(self.pg.choices),
                colors=('turquoise', 'red', 'blue violet', 'orange',
                        'blue', 'crimson'))
                #colors=('turquoise', 'red', 'blue', 'green',
                #        'yellow', 'blue violet'))
pong.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self):
        PongObject.__init__(self)

        self.score = np.array([0,0])

        self.scoreFont = wx.Font(pointSize=12, family=wx.FONTFAMILY_SWISS,
                style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL, underline=False)

        self.setCoords(np.array([0.07, 0.06]))
piemenu.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def initFont(self, font):
        """Initialize font for drawing text.
        """
        # if none, use SWISS font
        if font is None:
            self.font = \
                wx.Font(pointSize=12, family=wx.FONTFAMILY_SWISS,
                        style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD,
                        #underline=False)#, faceName='Utopia') # wxpython3
                        underline=False)#, face='Utopia') # wxpython3

        # otherwise, use given font
        else:
            self.font = font
textstim.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def setStimFont(self, font=None, refresh=True):
        """Set the stimulus font.

        Args:
            font:   A wx.Font object specifying the font for the stimulus
                    text.  If None (default) then the font will be set to
                    a reasonable default.
        """
        if font is None:
            self.stimFont = self.defaultStimFont
        else:
            self.stimFont = font

        if refresh:
            self.refresh()


问题


面经


文章

微信
公众号

扫码关注公众号