コード例 #1
0
def create_bitmap_dropdown_menu(panel, available_columns, df):
    dropdown_menu = BitmapComboBox(panel, style=wx.CB_READONLY)
    for column in available_columns:
        n_distinct = df[column].nunique()

        path = Path(__file__).parent.parent.absolute()
        if n_distinct <= 9:
            filename = os.path.join(path, "media", f"{n_distinct}.png")
        else:
            filename = os.path.join(path, "media", "forest.png")

        if os.path.exists(filename):
            image = wx.Image(filename)
            image.Rescale(16, 16, quality=wx.IMAGE_QUALITY_HIGH)
            icon = wx.Bitmap(image)
            dropdown_menu.Append(column, bitmap=icon)
        else:
            dropdown_menu.Append(column)

    return dropdown_menu
コード例 #2
0
    def crt_bitmap_combobox(self, choices, size=(-1, -1), event_handler=None):
        combobox = BitmapComboBox(self, size=size, style=wx.CB_READONLY)

        for item in choices:
            lang_code, lang_name = item

            _, country = lang_code.split('_')

            if country in flagart.catalog:
                flag_bmp = flagart.catalog[country].GetBitmap()
            else:
                flag_bmp = flagart.catalog["BLANK"].GetBitmap()

            combobox.Append(lang_name, flag_bmp)

        if event_handler is not None:
            combobox.Bind(wx.EVT_COMBOBOX, event_handler)

        return combobox
コード例 #3
0
class Panel_Gieldowy ( wx.Panel ):
	
	def __init__( self, parent ):
		wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 1260,800 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
		
		self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
		global sbSizer122
		bSizer18 = wx.BoxSizer( wx.VERTICAL )
		
		bSizer22 = wx.BoxSizer( wx.HORIZONTAL )
		
		sbSizer14 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Chart" ), wx.VERTICAL )
		self.m_notebook2 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_panel5 = wx.Panel( self.m_notebook2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		bSizer25 = wx.BoxSizer( wx.VERTICAL )
		self.wykres_htmlWin4 = wx.html2.WebView.New( self.m_panel5)
		bSizer25.Add( self.wykres_htmlWin4, 1, wx.ALL|wx.EXPAND, 5 )
		self.m_panel5.SetSizer( bSizer25 )
		self.m_panel5.Layout()
		bSizer25.Fit( self.m_panel5 )
		self.m_notebook2.AddPage( self.m_panel5, u"Wykres", False )
		
		sbSizer14.Add( self.m_notebook2, 1, wx.EXPAND |wx.ALL, 5 )


		bSizer22.Add( sbSizer14, 1, wx.EXPAND, 5 )
		
		bSizer18.Add( bSizer22, 1, wx.EXPAND, 5 )
		
		self.bSizer63 = wx.BoxSizer( wx.HORIZONTAL )
		
		self.info_label = wx.StaticText( self, wx.ID_ANY, u"", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.info_label.Wrap( -1 )
		self.bSizer63.Add( self.info_label, 1, wx.ALL, 5 )

		self.gielda_choice_box = BitmapComboBox( self, wx.ID_ANY, 'bitfinex', wx.DefaultPosition, wx.Size( 150,-1 ))

		image = wx.Image(u''+application_path+"/ikony_dashboard/vvalid.png")
		valid_bmp = wx.Bitmap(image)
		image = wx.Image(u''+application_path+"/ikony_dashboard/vinvalid.png")
		invalid_bmp = wx.Bitmap(image)
		for i in valid_list:
		    self.gielda_choice_box.Append(i, bitmap=valid_bmp)
		for i in invalid_list:
		    self.gielda_choice_box.Append(i, bitmap=invalid_bmp)
		self.bSizer63.Add( self.gielda_choice_box, 0, wx.ALL, 5 )


		#gielda_choice_boxChoices = gielda_choice_boxChoices_lista_b()
		#self.gielda_choice_box = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, gielda_choice_boxChoices, 0 )
		self.gielda_choice_box.SetSelection( 2 )
		#self.bSizer63.Add( self.gielda_choice_box, 0, wx.ALL, 5 )
		
		rynek_choice_boxChoices = [ 'BTC/USD']
		self.rynek_choice_box = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, rynek_choice_boxChoices, 0 )
		self.rynek_choice_box.SetSelection( 0 )
		self.bSizer63.Add( self.rynek_choice_box, 0, wx.ALL, 5 )
		
		#self.portfel1 = wx.StaticText( self, wx.ID_ANY, u"portfel1", wx.DefaultPosition, wx.DefaultSize, 0 )
		#self.portfel1.Wrap( -1 )
		#self.bSizer63.Add( self.portfel1, 0, wx.ALL, 5 )
		
		#self.m_staticText22 = wx.StaticText( self, wx.ID_ANY, u"/", wx.DefaultPosition, wx.DefaultSize, 0 )
		#self.m_staticText22.Wrap( -1 )
		#self.bSizer63.Add( self.m_staticText22, 0, wx.ALL, 5 )
		
		#self.portfel2 = wx.StaticText( self, wx.ID_ANY, u"portfel2", wx.DefaultPosition, wx.DefaultSize, 0 )
		#self.portfel2.Wrap( -1 )
		#self.bSizer63.Add( self.portfel2, 0, wx.ALL, 5 )
		
		bSizer18.Add( self.bSizer63, 0, wx.ALIGN_RIGHT|wx.EXPAND, 5 )
		
		bSizer23 = wx.BoxSizer( wx.HORIZONTAL )
		
		sbSizer122 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Wystawione oferty" ), wx.VERTICAL )
		
		self.m_staticText25 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText25.Wrap( -1 )
		sbSizer122.Add( self.m_staticText25, 0, wx.ALL, 5 )
		
		self.m_staticText26 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText26.Wrap( -1 )
		sbSizer122.Add( self.m_staticText26, 0, wx.ALL, 5 )
		
		self.m_staticText27 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText27.Wrap( -1 )
		sbSizer122.Add( self.m_staticText27, 0, wx.ALL, 5 )
		
		self.m_staticText28 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText28.Wrap( -1 )
		sbSizer122.Add( self.m_staticText28, 0, wx.ALL, 5 )
		
		self.m_staticText29 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText29.Wrap( -1 )
		sbSizer122.Add( self.m_staticText29, 0, wx.ALL, 5 )
		
		self.m_staticText30 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText30.Wrap( -1 )
		sbSizer122.Add( self.m_staticText30, 0, wx.ALL, 5 )
		
		self.m_staticText31 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText31.Wrap( -1 )
		sbSizer122.Add( self.m_staticText31, 0, wx.ALL, 5 )
		
		self.m_staticText32 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText32.Wrap( -1 )
		sbSizer122.Add( self.m_staticText32, 0, wx.ALL, 5 )
		
		bSizer23.Add( sbSizer122, 1, wx.BOTTOM|wx.EXPAND, 5 )
		
		self.transakcyjny = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.panel_market = wx.Panel( self.transakcyjny, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		bSizer14 = wx.BoxSizer( wx.VERTICAL )
		
		sizer_opcje = wx.BoxSizer( wx.HORIZONTAL )
		
		bSizer14.Add( sizer_opcje, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sizer_kup_sprzedaj = wx.BoxSizer( wx.HORIZONTAL )
		
		box_kup2 = wx.StaticBoxSizer( wx.StaticBox( self.panel_market, wx.ID_ANY, u"kup" ), wx.VERTICAL )
		
		bSizer17 = wx.BoxSizer( wx.HORIZONTAL )
		
		self.m_staticText133 = wx.StaticText( self.panel_market, wx.ID_ANY, u"ilość", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText133.Wrap( -1 )
		bSizer17.Add( self.m_staticText133, 0, wx.ALL, 5 )
		
		self.pole_ilosc_market_kup = wx.TextCtrl( self.panel_market, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer17.Add( self.pole_ilosc_market_kup, 0, wx.ALL, 5 )
		
		self.market_kup = wx.Button( self.panel_market, wx.ID_ANY, u"ZAKUP", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer17.Add( self.market_kup, 0, wx.ALL, 5 )
		
		box_kup2.Add( bSizer17, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sizer_kup_sprzedaj.Add( box_kup2, 1, wx.EXPAND, 5 )
		
		box_sprzedaj2 = wx.StaticBoxSizer( wx.StaticBox( self.panel_market, wx.ID_ANY, u"sprzedaj" ), wx.VERTICAL )
		
		bSizer181 = wx.BoxSizer( wx.HORIZONTAL )
		
		self.m_staticText134 = wx.StaticText( self.panel_market, wx.ID_ANY, u"ilość", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText134.Wrap( -1 )
		bSizer181.Add( self.m_staticText134, 0, wx.ALL, 5 )
		
		self.pole_ilosc_market_sprzedaj = wx.TextCtrl( self.panel_market, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer181.Add( self.pole_ilosc_market_sprzedaj, 0, wx.ALL, 5 )
		
		self.m_button14 = wx.Button( self.panel_market, wx.ID_ANY, u"SPRZEDAŻ", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer181.Add( self.m_button14, 0, wx.ALL, 5 )
		
		box_sprzedaj2.Add( bSizer181, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sizer_kup_sprzedaj.Add( box_sprzedaj2, 1, wx.EXPAND, 5 )
		
		bSizer14.Add( sizer_kup_sprzedaj, 1, 0, 5 )
		
		self.panel_market.SetSizer( bSizer14 )
		self.panel_market.Layout()
		bSizer14.Fit( self.panel_market )
		self.transakcyjny.AddPage( self.panel_market, u"MARKET", False )
		self.panel_limit = wx.Panel( self.transakcyjny, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		bSizer141 = wx.BoxSizer( wx.VERTICAL )
		
		sizer_opcje1 = wx.BoxSizer( wx.HORIZONTAL )
		
		self.opcja_limit_ukryty = wx.CheckBox( self.panel_limit, wx.ID_ANY, u"hidden", wx.DefaultPosition, wx.DefaultSize, 0 )
		sizer_opcje1.Add( self.opcja_limit_ukryty, 0, wx.ALL, 5 )
		
		self.opcja_limit_OCO = wx.CheckBox( self.panel_limit, wx.ID_ANY, u"OCO", wx.DefaultPosition, wx.DefaultSize, 0 )
		sizer_opcje1.Add( self.opcja_limit_OCO, 0, wx.ALL, 5 )
		
		self.opcja_limit_post = wx.CheckBox( self.panel_limit, wx.ID_ANY, u"post", wx.DefaultPosition, wx.DefaultSize, 0 )
		sizer_opcje1.Add( self.opcja_limit_post, 0, wx.ALL, 5 )
		
		bSizer141.Add( sizer_opcje1, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sizer_kup_sprzedaj1 = wx.BoxSizer( wx.HORIZONTAL )
		
		box_kup1 = wx.StaticBoxSizer( wx.StaticBox( self.panel_limit, wx.ID_ANY, u"kup" ), wx.VERTICAL )
		
		bSizer171 = wx.BoxSizer( wx.VERTICAL )
		
		sbSizer19 = wx.StaticBoxSizer( wx.StaticBox( self.panel_limit, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText1331 = wx.StaticText( self.panel_limit, wx.ID_ANY, u"ilość", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText1331.Wrap( -1 )
		sbSizer19.Add( self.m_staticText1331, 0, wx.ALL, 5 )
		
		self.pole_ilosc_limit_kup = wx.TextCtrl( self.panel_limit, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer19.Add( self.pole_ilosc_limit_kup, 0, wx.ALL, 5 )
		
		bSizer171.Add( sbSizer19, 1, wx.EXPAND, 5 )
		
		sbSizer191 = wx.StaticBoxSizer( wx.StaticBox( self.panel_limit, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText13311 = wx.StaticText( self.panel_limit, wx.ID_ANY, u"cena", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText13311.Wrap( -1 )
		sbSizer191.Add( self.m_staticText13311, 0, wx.ALL, 5 )
		
		self.pole_cena_limit_kup = wx.TextCtrl( self.panel_limit, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer191.Add( self.pole_cena_limit_kup, 0, wx.ALL, 5 )
		
		bSizer171.Add( sbSizer191, 1, wx.EXPAND, 5 )
		
		sbSizer23 = wx.StaticBoxSizer( wx.StaticBox( self.panel_limit, wx.ID_ANY, wx.EmptyString ), wx.VERTICAL )
		
		self.button_limit_zakup = wx.Button( self.panel_limit, wx.ID_ANY, u"ZAKUP", wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer23.Add( self.button_limit_zakup, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 )
		
		bSizer171.Add( sbSizer23, 1, wx.EXPAND, 5 )
		
		box_kup1.Add( bSizer171, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sizer_kup_sprzedaj1.Add( box_kup1, 1, wx.EXPAND, 5 )
		
		box_sprzedaj1 = wx.StaticBoxSizer( wx.StaticBox( self.panel_limit, wx.ID_ANY, u"sprzedaj" ), wx.VERTICAL )
		
		bSizer1711 = wx.BoxSizer( wx.VERTICAL )
		
		sbSizer192 = wx.StaticBoxSizer( wx.StaticBox( self.panel_limit, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText13312 = wx.StaticText( self.panel_limit, wx.ID_ANY, u"ilość", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText13312.Wrap( -1 )
		sbSizer192.Add( self.m_staticText13312, 0, wx.ALL, 5 )
		
		self.pole_ilosc_limit_sprzedaj = wx.TextCtrl( self.panel_limit, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer192.Add( self.pole_ilosc_limit_sprzedaj, 0, wx.ALL, 5 )
		
		bSizer1711.Add( sbSizer192, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sbSizer1911 = wx.StaticBoxSizer( wx.StaticBox( self.panel_limit, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText133111 = wx.StaticText( self.panel_limit, wx.ID_ANY, u"cena", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText133111.Wrap( -1 )
		sbSizer1911.Add( self.m_staticText133111, 0, wx.ALL, 5 )
		
		self.pole_cena_limit_sprzedaj = wx.TextCtrl( self.panel_limit, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer1911.Add( self.pole_cena_limit_sprzedaj, 0, wx.ALL, 5 )
		
		bSizer1711.Add( sbSizer1911, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sbSizer231 = wx.StaticBoxSizer( wx.StaticBox( self.panel_limit, wx.ID_ANY, wx.EmptyString ), wx.VERTICAL )
		
		self.button_limit_sprzedaz = wx.Button( self.panel_limit, wx.ID_ANY, u"SPRZEDAŻ", wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer231.Add( self.button_limit_sprzedaz, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 )
		
		bSizer1711.Add( sbSizer231, 1, wx.EXPAND, 5 )
		
		box_sprzedaj1.Add( bSizer1711, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sizer_kup_sprzedaj1.Add( box_sprzedaj1, 1, wx.EXPAND, 5 )
		
		bSizer141.Add( sizer_kup_sprzedaj1, 0, wx.EXPAND, 5 )
		
		self.panel_limit.SetSizer( bSizer141 )
		self.panel_limit.Layout()
		bSizer141.Fit( self.panel_limit )
		self.transakcyjny.AddPage( self.panel_limit, u"LIMIT", False )
		self.panel_stop = wx.Panel( self.transakcyjny, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		bSizer1411 = wx.BoxSizer( wx.VERTICAL )
		
		sizer_opcje11 = wx.BoxSizer( wx.HORIZONTAL )
		
		self.opcja_stop_ukryty = wx.CheckBox( self.panel_stop, wx.ID_ANY, u"hidden", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.opcja_stop_ukryty.SetValue(True) 
		sizer_opcje11.Add( self.opcja_stop_ukryty, 0, wx.ALL, 5 )
		
		self.opcja_stop_OCO = wx.CheckBox( self.panel_stop, wx.ID_ANY, u"OCO", wx.DefaultPosition, wx.DefaultSize, 0 )
		sizer_opcje11.Add( self.opcja_stop_OCO, 0, wx.ALL, 5 )
		
		self.opcja_stop_post = wx.CheckBox( self.panel_stop, wx.ID_ANY, u"post", wx.DefaultPosition, wx.DefaultSize, 0 )
		sizer_opcje11.Add( self.opcja_stop_post, 0, wx.ALL, 5 )
		
		bSizer1411.Add( sizer_opcje11, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sizer_kup_sprzedaj11 = wx.BoxSizer( wx.HORIZONTAL )
		
		box_kup11 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stop, wx.ID_ANY, u"kup" ), wx.VERTICAL )
		
		bSizer1712 = wx.BoxSizer( wx.VERTICAL )
		
		sbSizer193 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stop, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText13313 = wx.StaticText( self.panel_stop, wx.ID_ANY, u"ilość", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText13313.Wrap( -1 )
		sbSizer193.Add( self.m_staticText13313, 0, wx.ALL, 5 )
		
		self.pole_ilosc_stop_kup = wx.TextCtrl( self.panel_stop, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer193.Add( self.pole_ilosc_stop_kup, 0, wx.ALL, 5 )
		
		bSizer1712.Add( sbSizer193, 1, wx.EXPAND, 5 )
		
		sbSizer1912 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stop, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText133112 = wx.StaticText( self.panel_stop, wx.ID_ANY, u"cena", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText133112.Wrap( -1 )
		sbSizer1912.Add( self.m_staticText133112, 0, wx.ALL, 5 )
		
		self.pole_cena_stop_kup = wx.TextCtrl( self.panel_stop, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer1912.Add( self.pole_cena_stop_kup, 0, wx.ALL, 5 )
		
		bSizer1712.Add( sbSizer1912, 1, wx.EXPAND, 5 )
		
		sbSizer232 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stop, wx.ID_ANY, wx.EmptyString ), wx.VERTICAL )
		
		self.button_stop_zakup = wx.Button( self.panel_stop, wx.ID_ANY, u"ZAKUP", wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer232.Add( self.button_stop_zakup, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 )
		
		bSizer1712.Add( sbSizer232, 1, wx.EXPAND, 5 )
		
		box_kup11.Add( bSizer1712, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sizer_kup_sprzedaj11.Add( box_kup11, 1, wx.EXPAND, 5 )
		
		box_sprzedaj11 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stop, wx.ID_ANY, u"sprzedaj" ), wx.VERTICAL )
		
		bSizer17111 = wx.BoxSizer( wx.VERTICAL )
		
		sbSizer1921 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stop, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText133121 = wx.StaticText( self.panel_stop, wx.ID_ANY, u"ilość", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText133121.Wrap( -1 )
		sbSizer1921.Add( self.m_staticText133121, 0, wx.ALL, 5 )
		
		self.pole_ilosc_stop_sprzedaj = wx.TextCtrl( self.panel_stop, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer1921.Add( self.pole_ilosc_stop_sprzedaj, 0, wx.ALL, 5 )
		
		bSizer17111.Add( sbSizer1921, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sbSizer19111 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stop, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText1331111 = wx.StaticText( self.panel_stop, wx.ID_ANY, u"cena", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText1331111.Wrap( -1 )
		sbSizer19111.Add( self.m_staticText1331111, 0, wx.ALL, 5 )
		
		self.pole_cena_stop_sprzedaj = wx.TextCtrl( self.panel_stop, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer19111.Add( self.pole_cena_stop_sprzedaj, 0, wx.ALL, 5 )
		
		bSizer17111.Add( sbSizer19111, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sbSizer2311 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stop, wx.ID_ANY, wx.EmptyString ), wx.VERTICAL )
		
		self.button_stop_sprzedaz = wx.Button( self.panel_stop, wx.ID_ANY, u"SPRZEDAŻ", wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer2311.Add( self.button_stop_sprzedaz, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 )
		
		bSizer17111.Add( sbSizer2311, 1, wx.EXPAND, 5 )
		
		box_sprzedaj11.Add( bSizer17111, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sizer_kup_sprzedaj11.Add( box_sprzedaj11, 1, wx.EXPAND, 5 )
		
		bSizer1411.Add( sizer_kup_sprzedaj11, 0, wx.EXPAND, 5 )
		
		self.panel_stop.SetSizer( bSizer1411 )
		self.panel_stop.Layout()
		bSizer1411.Fit( self.panel_stop )
		self.transakcyjny.AddPage( self.panel_stop, u"STOP", False )
		self.panel_stoplimit = wx.Panel( self.transakcyjny, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		bSizer1412 = wx.BoxSizer( wx.VERTICAL )
		
		sizer_opcje12 = wx.BoxSizer( wx.HORIZONTAL )
		
		self.opcja_stoplimit_ukryty = wx.CheckBox( self.panel_stoplimit, wx.ID_ANY, u"hidden", wx.DefaultPosition, wx.DefaultSize, 0 )
		sizer_opcje12.Add( self.opcja_stoplimit_ukryty, 0, wx.ALL, 5 )
		
		self.opcja_stoplimit_OCO = wx.CheckBox( self.panel_stoplimit, wx.ID_ANY, u"OCO", wx.DefaultPosition, wx.DefaultSize, 0 )
		sizer_opcje12.Add( self.opcja_stoplimit_OCO, 0, wx.ALL, 5 )
		
		self.opcja_stoplimit_post = wx.CheckBox( self.panel_stoplimit, wx.ID_ANY, u"post", wx.DefaultPosition, wx.DefaultSize, 0 )
		sizer_opcje12.Add( self.opcja_stoplimit_post, 0, wx.ALL, 5 )
		
		bSizer1412.Add( sizer_opcje12, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sizer_kup_sprzedaj12 = wx.BoxSizer( wx.HORIZONTAL )
		
		box_kup = wx.StaticBoxSizer( wx.StaticBox( self.panel_stoplimit, wx.ID_ANY, u"kup" ), wx.VERTICAL )
		
		bSizer1713 = wx.BoxSizer( wx.VERTICAL )
		
		sbSizer68 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText162 = wx.StaticText( self.panel_stoplimit, wx.ID_ANY, u"cena min.   ", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText162.Wrap( -1 )
		sbSizer68.Add( self.m_staticText162, 0, wx.ALL, 5 )
		
		self.pole_cenamin_stoplimit_kup = wx.TextCtrl( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer68.Add( self.pole_cenamin_stoplimit_kup, 0, wx.ALL|wx.EXPAND, 5 )
		
		bSizer1713.Add( sbSizer68, 1, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sbSizer194 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText13314 = wx.StaticText( self.panel_stoplimit, wx.ID_ANY, u"ilość           ", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText13314.Wrap( -1 )
		sbSizer194.Add( self.m_staticText13314, 1, wx.ALL, 5 )
		
		self.pole_ilosc_stoplimit_kup = wx.TextCtrl( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer194.Add( self.pole_ilosc_stoplimit_kup, 0, wx.ALL, 5 )
		
		bSizer1713.Add( sbSizer194, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 )
		
		sbSizer1913 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText133113 = wx.StaticText( self.panel_stoplimit, wx.ID_ANY, u"cena maks  ", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText133113.Wrap( -1 )
		sbSizer1913.Add( self.m_staticText133113, 0, wx.ALL, 5 )
		
		self.pole_cenamax_stoplimit_kup = wx.TextCtrl( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer1913.Add( self.pole_cenamax_stoplimit_kup, 0, wx.ALL, 5 )
		
		bSizer1713.Add( sbSizer1913, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 )
		
		sbSizer233 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString ), wx.VERTICAL )
		
		self.button_stoplimit_zakup = wx.Button( self.panel_stoplimit, wx.ID_ANY, u"ZAKUP", wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer233.Add( self.button_stoplimit_zakup, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 )
		
		bSizer1713.Add( sbSizer233, 1, wx.EXPAND, 5 )
		
		box_kup.Add( bSizer1713, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sizer_kup_sprzedaj12.Add( box_kup, 1, wx.EXPAND, 5 )
		
		box_sprzedaj = wx.StaticBoxSizer( wx.StaticBox( self.panel_stoplimit, wx.ID_ANY, u"kup" ), wx.VERTICAL )
		
		bSizer17131 = wx.BoxSizer( wx.VERTICAL )
		
		sbSizer681 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText1621 = wx.StaticText( self.panel_stoplimit, wx.ID_ANY, u"cena min.   ", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText1621.Wrap( -1 )
		sbSizer681.Add( self.m_staticText1621, 0, wx.ALL, 5 )
		
		self.pole_cenamin_stoplimit_sprzedaj = wx.TextCtrl( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer681.Add( self.pole_cenamin_stoplimit_sprzedaj, 0, wx.ALL|wx.EXPAND, 5 )
		
		bSizer17131.Add( sbSizer681, 1, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sbSizer1941 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText133141 = wx.StaticText( self.panel_stoplimit, wx.ID_ANY, u"ilość           ", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText133141.Wrap( -1 )
		sbSizer1941.Add( self.m_staticText133141, 1, wx.ALL, 5 )
		
		self.pole_ilosc_stoplimit_sprzedaj = wx.TextCtrl( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer1941.Add( self.pole_ilosc_stoplimit_sprzedaj, 0, wx.ALL, 5 )
		
		bSizer17131.Add( sbSizer1941, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 )
		
		sbSizer19131 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString ), wx.HORIZONTAL )
		
		self.m_staticText1331131 = wx.StaticText( self.panel_stoplimit, wx.ID_ANY, u"cena maks  ", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText1331131.Wrap( -1 )
		sbSizer19131.Add( self.m_staticText1331131, 0, wx.ALL, 5 )
		
		self.pole_cenamax_stoplimit_sprzedaj = wx.TextCtrl( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer19131.Add( self.pole_cenamax_stoplimit_sprzedaj, 0, wx.ALL, 5 )
		
		bSizer17131.Add( sbSizer19131, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 )
		
		sbSizer2331 = wx.StaticBoxSizer( wx.StaticBox( self.panel_stoplimit, wx.ID_ANY, wx.EmptyString ), wx.VERTICAL )
		
		self.button_stoplimit_sprzedaz = wx.Button( self.panel_stoplimit, wx.ID_ANY, u"SPRZEDAŻ", wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer2331.Add( self.button_stoplimit_sprzedaz, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 )
		
		bSizer17131.Add( sbSizer2331, 1, wx.EXPAND, 5 )
		
		box_sprzedaj.Add( bSizer17131, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
		
		sizer_kup_sprzedaj12.Add( box_sprzedaj, 1, wx.EXPAND, 5 )
		
		bSizer1412.Add( sizer_kup_sprzedaj12, 0, wx.EXPAND, 5 )
		
		self.panel_stoplimit.SetSizer( bSizer1412 )
		self.panel_stoplimit.Layout()
		bSizer1412.Fit( self.panel_stoplimit )
		self.transakcyjny.AddPage( self.panel_stoplimit, u"STOP LIMIT", False )
		
		bSizer23.Add( self.transakcyjny, 0, wx.EXPAND|wx.TOP|wx.RIGHT|wx.LEFT|wx.ALIGN_BOTTOM, 5 )
		
		sbSizer1222 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Portfele" ), wx.VERTICAL )
		
		self.m_staticText34 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText34.Wrap( -1 )
		sbSizer1222.Add( self.m_staticText34, 0, wx.ALL, 5 )
		
		self.m_staticText35 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText35.Wrap( -1 )
		sbSizer1222.Add( self.m_staticText35, 0, wx.ALL, 5 )
		
		self.m_staticText36 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText36.Wrap( -1 )
		sbSizer1222.Add( self.m_staticText36, 0, wx.ALL, 5 )
		
		self.m_staticText37 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText37.Wrap( -1 )
		sbSizer1222.Add( self.m_staticText37, 0, wx.ALL, 5 )
		
		self.m_staticText38 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText38.Wrap( -1 )
		sbSizer1222.Add( self.m_staticText38, 0, wx.ALL, 5 )
		
		self.m_staticText39 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText39.Wrap( -1 )
		sbSizer1222.Add( self.m_staticText39, 0, wx.ALL, 5 )
		
		self.m_staticText40 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText40.Wrap( -1 )
		sbSizer1222.Add( self.m_staticText40, 0, wx.ALL, 5 )
		
		self.m_staticText41 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText41.Wrap( -1 )
		sbSizer1222.Add( self.m_staticText41, 0, wx.ALL, 5 )
		
		self.m_staticText42 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText42.Wrap( -1 )
		sbSizer1222.Add( self.m_staticText42, 0, wx.ALL, 5 )
		
		self.m_staticText43 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText43.Wrap( -1 )
		sbSizer1222.Add( self.m_staticText43, 0, wx.ALL, 5 )
		
		self.m_staticText44 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText44.Wrap( -1 )
		sbSizer1222.Add( self.m_staticText44, 0, wx.ALL, 5 )
		
		bSizer23.Add( sbSizer1222, 1, wx.TOP|wx.EXPAND, 5 )
		
		bSizer18.Add( bSizer23, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 )
		
		self.SetSizer( bSizer18 )
		self.Layout()
		
		self.Centre( wx.BOTH )
		
		# Connect Events
		self.gielda_choice_box.Bind( wx.EVT_COMBOBOX, self.zmiana_waluty1 )
		self.rynek_choice_box.Bind( wx.EVT_CHOICE, self.zmiana_waluty2 )
		self.market_kup.Bind( wx.EVT_BUTTON, self.info_box )
		self.m_button14.Bind( wx.EVT_BUTTON, self.info_box )
		self.button_limit_zakup.Bind( wx.EVT_BUTTON, self.info_box )
		self.button_limit_sprzedaz.Bind( wx.EVT_BUTTON, self.info_box )
		self.button_stop_zakup.Bind( wx.EVT_BUTTON, self.info_box )
		self.button_stop_sprzedaz.Bind( wx.EVT_BUTTON, self.info_box )
		self.button_stoplimit_zakup.Bind( wx.EVT_BUTTON, self.info_box )
		self.button_stoplimit_sprzedaz.Bind( wx.EVT_BUTTON, self.info_box )
	
	def __del__( self ):
		pass
	
	
	# Virtual event handlers, overide them in your derived class
	def zmiana_waluty1( self, event ):
		event.Skip()
	
	def zmiana_waluty2( self, event ):
		event.Skip()
	
	def market_zakup_button( self, event ):
		event.Skip()
	
	def market_sprzedaz_button( self, event ):
		event.Skip()
	
	def limit_zakup_button( self, event ):
		event.Skip()
	
	def limit_sprzedaz_button( self, event ):
		event.Skip()
	
	def stop_zakup_button( self, event ):
		event.Skip()
	
	def stop_sprzedaz_button( self, event ):
		event.Skip()
	
	def stoplimit_zakup_button( self, event ):
		event.Skip()
	
	def stoplimit_sprzedaz_button( self, event ):
		event.Skip()
コード例 #4
0
class MyDialog(wx.Dialog):
    """ Saisie d'une prévision pour un scénario """
    def __init__(self,
                 parent,
                 IDscenario=None,
                 IDpersonne=0,
                 IDcategorie=0,
                 report=None,
                 mode_heure=0):
        wx.Dialog.__init__(self,
                           parent,
                           id=-1,
                           title=_(u"Saisie d'un report"),
                           size=(440, 420),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
                           | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX)
        self.IDscenario = IDscenario
        self.IDpersonne = IDpersonne
        self.report = report
        self.mode_heure = mode_heure
        self.typeReport = "M"
        self.IDcategorie = IDcategorie

        # Label
        self.label_intro = wx.StaticText(self, -1, _(u"Saisissez un report :"))

        self.staticbox_periode = wx.StaticBox(self, -1, u"")

        # Manuel
        self.radio_1 = wx.RadioButton(self,
                                      -1,
                                      _(u"Manuel"),
                                      style=wx.RB_GROUP)

        # Type
        self.label_type = wx.StaticText(self, -1, _(u"Type :"))
        self.ctrl_type = wx.Choice(self,
                                   -1,
                                   choices=[
                                       _(u"Heures à réaliser (+)"),
                                       _(u"Heures déjà réalisées (-)")
                                   ])
        self.ctrl_type.SetSelection(0)

        # Temps
        self.label_temps = wx.StaticText(self, -1, _(u"Temps :"))
        self.ctrl_temps_heures = wx.TextCtrl(self,
                                             -1,
                                             u"0",
                                             size=(50, -1),
                                             style=wx.TE_RIGHT)
        self.label_temps_signe = wx.StaticText(self, -1, u"h")
        self.ctrl_temps_minutes = wx.TextCtrl(self, -1, u"00", size=(30, -1))

        # Mode Heure/décimal
        self.label_mode = wx.StaticText(self, -1, _(u"Mode :"))
        self.ctrl_modeHeure = wx.Choice(self,
                                        -1,
                                        choices=[_(u"Heure"),
                                                 _(u"Décimal")])
        self.ctrl_modeHeure.SetSelection(self.mode_heure)

        # Automatique
        self.radio_2 = wx.RadioButton(self, -1, _(u"Automatique"))

        # ListView Scenarios
        self.label_scenario = wx.StaticText(self, -1, _(u"Scénario :"))
        self.listview_scenarios = ListView(self,
                                           -1,
                                           IDscenario=self.IDscenario,
                                           IDpersonne=self.IDpersonne,
                                           style=wx.LC_REPORT
                                           | wx.SUNKEN_BORDER)
        self.bouton_apercu = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Loupe.png"),
                      wx.BITMAP_TYPE_ANY))
        self.bouton_apercu.Enable(False)
        self.listview_scenarios.SetMinSize((50, 50))

        # Choix catégorie
        self.label_categorie = wx.StaticText(self, -1, _(u"Catégorie :"))
        self.ctrl_categorie = BitmapComboBox(self, style=wx.CB_READONLY)
        self.InitCombo(IDscenario=None)

        # Boutons
        self.bouton_ok = CTRL_Bouton_image.CTRL(
            self,
            texte=_(u"Ok"),
            cheminImage=Chemins.GetStaticPath("Images/32x32/Valider.png"))
        self.bouton_annuler = CTRL_Bouton_image.CTRL(
            self,
            id=wx.ID_CANCEL,
            texte=_(u"Annuler"),
            cheminImage=Chemins.GetStaticPath("Images/32x32/Annuler.png"))
        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok)
        self.Bind(wx.EVT_CHOICE, self.OnChoiceModeHeure, self.ctrl_modeHeure)
        self.ctrl_temps_heures.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocusHeures)
        self.ctrl_temps_minutes.Bind(wx.EVT_KILL_FOCUS,
                                     self.OnKillFocusMinutes)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton, self.radio_1)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton, self.radio_2)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonApercu, self.bouton_apercu)

        if self.report != None and report[0] == "M":
            self.SetReport(self.report)
            self.typeReport = "M"
            self.OnRadioButton(None)

        if self.report != None and report[0] == "A":
            self.radio_2.SetValue(1)
            self.typeReport = "A"
            self.OnRadioButton(None)
            IDscenario, IDcategorie = self.report[1:].split(";")
            IDscenario, IDcategorie = int(IDscenario), int(IDcategorie)
            self.listview_scenarios.MAJ(IDscenario)
            self.InitCombo(IDscenario=IDscenario,
                           IDcategorieSelection=IDcategorie)

        if self.report == None:
            self.radio_1.SetValue(1)
            self.OnRadioButton(None)

        if self.mode_heure == 1:
            self.ConvertModeHeure(self.ctrl_temps_minutes.GetValue(), 1)
            self.ctrl_modeHeure.SetSelection(1)
            self.ctrl_temps_minutes.SetToolTip(
                wx.ToolTip(
                    _(u"Saisissez un nombre de minutes au format décimal (entre 0 et 99)"
                      )))

        if self.IDpersonne == None:
            self.radio_2.Enable(False)

    def __set_properties(self):
        self.bouton_ok.SetSize(self.bouton_ok.GetBestSize())
        self.bouton_annuler.SetSize(self.bouton_annuler.GetBestSize())
        self.ctrl_temps_heures.SetToolTip(
            wx.ToolTip(_(u"Saisissez un nombre d'heures")))
        self.ctrl_temps_minutes.SetToolTip(
            wx.ToolTip(_(u"Saisissez un nombre de minutes (entre 0 et 59)")))
        self.SetMinSize((510, 460))

    def __do_layout(self):
        grid_sizer_base = wx.FlexGridSizer(rows=3, cols=1, vgap=10, hgap=10)
        grid_sizer_base.Add(self.label_intro, 0, wx.TOP | wx.RIGHT | wx.LEFT,
                            10)

        sizerStaticBox = wx.StaticBoxSizer(self.staticbox_periode,
                                           wx.HORIZONTAL)

        grid_sizer_box = wx.FlexGridSizer(rows=10, cols=3, vgap=0, hgap=0)

        # Manuel
        grid_sizer_box.Add(self.radio_1, 0, wx.ALL, 5)
        grid_sizer_box.Add((5, 5), 0, wx.ALL, 5)
        grid_sizer_box.Add((0, 0), 0, wx.ALL, 0)

        grid_sizer_box.Add(self.label_type, 0,
                           wx.ALIGN_RIGHT | wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                           5)
        grid_sizer_box.Add(self.ctrl_type, 0,
                           wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
        grid_sizer_box.Add((0, 0), 0, wx.ALL, 0)

        grid_sizer_box.Add(self.label_temps, 0,
                           wx.ALIGN_RIGHT | wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                           5)

        grid_sizer_1 = wx.FlexGridSizer(rows=1, cols=6, vgap=0, hgap=0)
        grid_sizer_1.Add(self.ctrl_temps_heures, 0,
                         wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
        grid_sizer_1.Add(self.label_temps_signe, 0,
                         wx.ALL | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_1.Add(self.ctrl_temps_minutes, 0,
                         wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
        grid_sizer_1.Add((10, 5), 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
        grid_sizer_1.Add(self.label_mode, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                         5)
        grid_sizer_1.Add(self.ctrl_modeHeure, 0,
                         wx.ALL | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_box.Add(grid_sizer_1, 0, wx.ALL, 0)

        grid_sizer_box.Add((5, 5), 0, wx.ALL, 5)
        grid_sizer_box.Add((5, 5), 0, wx.ALL, 5)
        grid_sizer_box.Add((5, 5), 0, wx.ALL, 5)
        grid_sizer_box.Add((5, 5), 0, wx.ALL, 5)

        # Automatique
        grid_sizer_box.Add(self.radio_2, 0, wx.ALL, 0)
        grid_sizer_box.Add((5, 5), 0, wx.ALL, 10)
        grid_sizer_box.Add((0, 0), 0, wx.ALL, 0)

        grid_sizer_box.Add(self.label_scenario, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
        grid_sizer_box.Add(self.listview_scenarios, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_box.Add(self.bouton_apercu, 1, wx.TOP, 5)

        grid_sizer_box.Add(self.label_categorie, 0,
                           wx.ALIGN_RIGHT | wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                           5)
        grid_sizer_box.Add(self.ctrl_categorie, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_box.Add((0, 0), 0, wx.ALL, 0)

        grid_sizer_box.AddGrowableCol(1)
        grid_sizer_box.AddGrowableRow(5)

        sizerStaticBox.Add(grid_sizer_box, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_base.Add(sizerStaticBox, 1, wx.LEFT | wx.RIGHT | wx.EXPAND,
                            10)

        # Boutons
        grid_sizer_boutons = wx.FlexGridSizer(rows=1, cols=3, vgap=10, hgap=10)
        grid_sizer_boutons.Add((20, 20), 0, 0, 0)
        grid_sizer_boutons.Add(self.bouton_ok, 0, 0, 0)
        grid_sizer_boutons.Add(self.bouton_annuler, 0, 0, 0)
        grid_sizer_boutons.AddGrowableCol(0)
        grid_sizer_base.Add(grid_sizer_boutons, 1, wx.ALL | wx.EXPAND, 10)

        self.SetSizer(grid_sizer_base)
        grid_sizer_base.AddGrowableCol(0)
        grid_sizer_base.AddGrowableRow(1)
        self.Layout()
        self.CenterOnScreen()

    def OnBoutonApercu(self, event):
        IDscenario = self.listview_scenarios.GetSelection()
        if IDscenario == None: return
        dlg = DLG_Scenario.Dialog(self, IDscenario)
        dlg.ShowModal()
        dlg.Destroy()

    def FormateCouleur(self, texte):
        pos1 = texte.index(",")
        pos2 = texte.index(",", pos1 + 1)
        r = int(texte[1:pos1])
        v = int(texte[pos1 + 2:pos2])
        b = int(texte[pos2 + 2:-1])
        return (r, v, b)

    def CreationImage(self, tailleImages, r, v, b):
        """ Création des images pour le TreeCtrl """
        if 'phoenix' in wx.PlatformInfo:
            bmp = wx.Image(tailleImages[0], tailleImages[1], True)
            bmp.SetRGB((0, 0, 16, 16), r, v, b)
        else:
            bmp = wx.EmptyImage(tailleImages[0], tailleImages[1], True)
            bmp.SetRGBRect((0, 0, 16, 16), r, v, b)
        return bmp.ConvertToBitmap()

    def InitCombo(self, IDscenario=None, IDcategorieSelection=None):
        # Get catégories
        DB = GestionDB.DB()
        req = "SELECT IDcategorie, nom_categorie, IDcat_parent, ordre, couleur FROM cat_presences ORDER BY IDcategorie"
        DB.ExecuterReq(req)
        listeCategories = DB.ResultatReq()
        DB.Close()
        dictCategories = {}
        for valeurs in listeCategories:
            dictCategories[valeurs[0]] = valeurs

        if IDscenario != None:
            dictColonnes, dictColonneTotal = self.GetDictColonnes(IDscenario)
            if len(dictColonnes) == 0 and len(dictColonneTotal) == 0:
                return

        # Catégories prévues dans le scénario
        if IDscenario != None:
            listeCategoriesPrevues = self.GetCategoriesPrevues(IDscenario)
        else:
            listeCategoriesPrevues = []

        # Catégories utilisées dans le scénario
        if IDscenario != None:
            listeCategoriesUtilisees = []
            listeCategoriesUtiliseesTmp = self.GetCategoriesUtilisees(
                IDscenario)
            for ID in listeCategoriesUtiliseesTmp:
                if ID not in listeCategoriesPrevues:
                    listeCategoriesUtilisees.append(ID)
        else:
            listeCategoriesUtilisees = []

        # Autres catégories
        listeAutresCategories = []
        for valeurs in listeCategories:
            ID = valeurs[0]
            if ID not in listeCategoriesPrevues and ID not in listeCategoriesUtilisees:
                listeAutresCategories.append(ID)
        listeAutresCategories.sort()

        # Liste de groupes de catégories
        listeGroupes = [
            (10000, _(u"Catégories scénarisées"), listeCategoriesPrevues),
            (10001, _(u"Catégories utilisées"), listeCategoriesUtilisees),
            (10002, _(u"Autres catégories"), listeAutresCategories),
        ]

        # Images pour le bitmapComboBox
        tailleImages = (16, 16)
        self.ctrl_categorie.Clear()
        index = 0
        for IDgroupe, nomGroupe, listeCatGroupe in listeGroupes:
            bmp = self.CreationImage(tailleImages, 255, 255, 255)
            self.ctrl_categorie.Append(
                "----------- %s (%d) -----------" %
                (nomGroupe, len(listeCatGroupe)), bmp, IDgroupe)
            index += 1

            for IDcategorie in listeCatGroupe:
                if IDcategorie == 999:
                    IDcategorie, nom_categorie, IDcat_parent, ordre, couleur = 999, _(
                        u"Sans catégorie"), 0, 0, "(255, 255, 255)"
                elif IDcategorie == 1000:
                    IDcategorie, nom_categorie, IDcat_parent, ordre, couleur = 1000, _(
                        u"Total"), 0, 0, "(255, 255, 255)"
                else:
                    IDcategorie, nom_categorie, IDcat_parent, ordre, couleur = dictCategories[
                        IDcategorie]
                couleur = self.FormateCouleur(couleur)
                r, v, b = couleur
                bmp = self.CreationImage(tailleImages, r, v, b)
                # Ajout du nbre d'heures :
                if IDscenario != None:
                    if IDcategorie in dictColonnes:
                        nom_categorie = u"%s (%s)" % (
                            nom_categorie,
                            self.FormateHeure(dictColonnes[IDcategorie]
                                              ["total_reste_heures"]))
                    if IDcategorie == 1000:
                        nom_categorie = u"%s (%s)" % (
                            nom_categorie,
                            self.FormateHeure(
                                dictColonneTotal["total_reste_heures"]))
                self.ctrl_categorie.Append(nom_categorie, bmp, IDcategorie)
                if IDcategorieSelection == None:
                    IDcategorieSelection = self.IDcategorie
                if IDcategorie == IDcategorieSelection:
                    self.ctrl_categorie.SetSelection(index)
                index += 1

    def FormateHeure(self, label):
        if label == None or label == "": return ""
        signe = label[0]
        hr, mn = label[1:].split(":")
        if signe == "+":
            signe = ""
        else:
            signe = "- "
        if self.mode_heure == 0:
            # Mode Heure
            texte = _(u"%s%sh%s") % (signe, hr, mn)
        else:
            # Mode décimal
            minDecimal = int(mn) * 100 // 60
            texte = u"%s%s.%s" % (signe, hr, minDecimal)
        return texte

    def GetDictColonnes(self, IDscenario):
        DB = GestionDB.DB()
        req = "SELECT IDscenario, IDpersonne, date_debut, date_fin, toutes_categories FROM scenarios WHERE IDscenario=%d;" % IDscenario
        DB.ExecuterReq(req)
        listeDonnees = DB.ResultatReq()
        DB.Close()
        if len(listeDonnees) == 0: return [], []

        IDpersonne = listeDonnees[0][1]
        date_debut = listeDonnees[0][2]
        date_fin = listeDonnees[0][3]
        detail_mois = 0
        toutes_categories = listeDonnees[0][4]

        # GetValeursColonnes
        valeurs = DLG_Scenario.GetDictColonnes(IDscenario, IDpersonne,
                                               detail_mois, date_debut,
                                               date_fin, toutes_categories)
        dictColonnes = valeurs.GetDictColonnes()
        dictColonneTotal = valeurs.GetDictColonneTotal()
        return dictColonnes, dictColonneTotal

    def GetCategoriesPrevues(self, IDscenario):
        DB = GestionDB.DB()
        req = "SELECT IDscenario_cat, IDscenario, IDcategorie, prevision, report, date_debut_realise, date_fin_realise FROM scenarios_cat WHERE IDscenario=%d;" % IDscenario
        DB.ExecuterReq(req)
        listeDonnees = DB.ResultatReq()
        DB.Close()
        listeCategories = []
        for valeurs in listeDonnees:
            IDcategorie = valeurs[2]
            listeCategories.append(IDcategorie)
        listeCategories.append(1000)  # Colonne total
        listeCategories.sort()
        return listeCategories

    def GetCategoriesUtilisees(self, IDscenario):
        DB = GestionDB.DB()
        req = "SELECT IDscenario, IDpersonne, date_debut, date_fin FROM scenarios WHERE IDscenario=%d;" % IDscenario
        DB.ExecuterReq(req)
        listeDonnees = DB.ResultatReq()
        DB.Close()
        if len(listeDonnees) == 0: return []

        IDpersonne = listeDonnees[0][1]
        date_debut = listeDonnees[0][2]
        date_fin = listeDonnees[0][3]

        DB = GestionDB.DB()
        req = "SELECT IDcategorie FROM presences WHERE (IDpersonne=%d AND '%s'<=date AND date<='%s') GROUP BY IDcategorie ORDER BY IDcategorie;" % (
            IDpersonne, date_debut, date_fin)
        DB.ExecuterReq(req)
        listeDonnees = DB.ResultatReq()
        DB.Close()
        if len(listeDonnees) == 0: return []
        listeCategoriesUtilisees = []
        for IDcategorie, in listeDonnees:
            listeCategoriesUtilisees.append(IDcategorie)
        return listeCategoriesUtilisees

    def OnRadioButton(self, event):
        if self.radio_1.GetValue() == True:
            etat_radio_1 = True
            etat_radio_2 = False
        else:
            etat_radio_1 = False
            etat_radio_2 = True
        # Manuel
        self.typeReport = "M"
        self.label_type.Enable(etat_radio_1)
        self.ctrl_type.Enable(etat_radio_1)
        self.label_temps.Enable(etat_radio_1)
        self.ctrl_temps_heures.Enable(etat_radio_1)
        self.label_temps_signe.Enable(etat_radio_1)
        self.ctrl_temps_minutes.Enable(etat_radio_1)
        self.label_mode.Enable(etat_radio_1)
        self.ctrl_modeHeure.Enable(etat_radio_1)

        # Automatique
        self.typeReport = "A"
        self.label_scenario.Enable(etat_radio_2)
        self.listview_scenarios.Enable(etat_radio_2)
        self.label_categorie.Enable(etat_radio_2)
        self.ctrl_categorie.Enable(etat_radio_2)

        if etat_radio_2 == True and self.listview_scenarios.GetSelection(
        ) == None:
            self.ctrl_categorie.Enable(False)
            self.bouton_apercu.Enable(False)

    def OnKillFocusHeures(self, event):
        heures = self.ctrl_temps_heures.GetValue()
        erreur = False
        try:
            heures = int(heures)
        except:
            erreur = True

        if heures < 0:
            erreur = True

        if erreur == True:
            self.ctrl_temps_heures.SetValue("0")
##            dlg = wx.MessageDialog(self, _(u"Le nombre d'heures semble inexact. Veuillez vérifier votre saisie."), _(u"Erreur de saisie"), wx.OK | wx.ICON_ERROR)
##            dlg.ShowModal()
##            dlg.Destroy()
##            self.ctrl_temps_heures.SetFocus()
##            return

    def OnKillFocusMinutes(self, event):
        minutes = self.ctrl_temps_minutes.GetValue()
        erreur = False
        try:
            minutes = int(minutes)
        except:
            erreur = True

        if self.mode_heure == 0:
            if minutes < 0 or minutes > 59:
                erreur = True

        if self.mode_heure == 1:
            if minutes < 0 or minutes > 99:
                erreur = True

        if erreur == True:
            self.ctrl_temps_minutes.SetValue("00")
            minutes = 0
##            dlg = wx.MessageDialog(self, _(u"Le nombre de minutes semble inexact. Veuillez vérifier votre saisie."), _(u"Erreur de saisie"), wx.OK | wx.ICON_ERROR)
##            dlg.ShowModal()
##            dlg.Destroy()
##            self.ctrl_temps_minutes.SetFocus()
##            return

        if self.mode_heure == 0:
            self.ctrl_temps_minutes.SetValue("%02d" % minutes)

    def SetReport(self, report):
        """ Renvoie la prévision """
        if report[1] == "+":
            self.ctrl_type.SetSelection(0)
        else:
            self.ctrl_type.SetSelection(1)
        heures, minutes = report[2:].split(":")
        self.ctrl_temps_heures.SetValue(str(heures))
        self.ctrl_temps_minutes.SetValue(str(minutes))

    def OnChoiceModeHeure(self, event):
        if self.ctrl_modeHeure.GetSelection() == self.mode_heure: return
        self.ConvertModeHeure(self.ctrl_temps_minutes.GetValue(),
                              self.ctrl_modeHeure.GetSelection())

    def ConvertModeHeure(self, min="", mode=0):
        try:
            min = int(min)
        except:
            return
        if mode == 0:
            resultat = min * 60 // 100
            self.label_temps_signe.SetLabel(u"h")
            self.ctrl_temps_minutes.SetValue("%02d" % resultat)
            self.ctrl_temps_minutes.SetToolTip(
                wx.ToolTip(
                    _(u"Saisissez un nombre de minutes (entre 0 et 59)")))
        if mode == 1:
            resultat = min * 100 // 60
            self.label_temps_signe.SetLabel(u".")
            self.ctrl_temps_minutes.SetValue(str(resultat))
            self.ctrl_temps_minutes.SetToolTip(
                wx.ToolTip(
                    _(u"Saisissez un nombre de minutes au format décimal (entre 0 et 99)"
                      )))
        self.mode_heure = mode

    def GetReport(self):
        """ Renvoie le report """
        if self.radio_1.GetValue() == True:
            # Mode manuel
            if self.ctrl_type.GetSelection() == 0:
                signe = "+"
            else:
                signe = "-"
            heures = int(self.ctrl_temps_heures.GetValue())
            minutes = int(self.ctrl_temps_minutes.GetValue())
            if self.mode_heure == 1:
                minutes = minutes * 60 // 100
            report = _(u"M%s%02d:%02d") % (signe, heures, minutes)

        else:
            # Mode Auto
            IDscenario = self.listview_scenarios.GetSelection()
            indexCategorie = self.ctrl_categorie.GetSelection()
            IDCategorie = self.ctrl_categorie.GetClientData(indexCategorie)
            report = _(u"A%d;%d") % (IDscenario, IDCategorie)

        return report

    def OnBoutonOk(self, event):
        """ Validation des données saisies """
        if self.radio_1.GetValue() == True:
            # Mode manuel
            pass

        else:
            # Mode Auto
            IDscenario = self.listview_scenarios.GetSelection()
            if IDscenario == None:
                dlg = wx.MessageDialog(
                    self,
                    _(u"Vous devez obligatoirement sélectionner un scénario dans la liste proposée"
                      ), _(u"Erreur de saisie"), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return

            index = self.ctrl_categorie.GetSelection()
            if index == -1:
                dlg = wx.MessageDialog(
                    self,
                    _(u"Vous devez obligatoirement sélectionner une catégorie dans la liste proposée"
                      ), _(u"Erreur de saisie"), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return

            IDCategorie = self.ctrl_categorie.GetClientData(index)
            if IDCategorie >= 10000:
                dlg = wx.MessageDialog(
                    self,
                    _(u"Vous devez obligatoirement sélectionner une catégorie dans la liste proposée"
                      ), _(u"Erreur de saisie"), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return

        self.EndModal(wx.ID_OK)
コード例 #5
0
class Dialog(wx.Dialog):
    def __init__(self, parent, listePersonnes=[]):
        wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX)
        self.parent = parent
        self.panel_base = wx.Panel(self, -1)
        self.listePersonnes = listePersonnes

        self.dictAffichage = {
            "nom_police" : "Arial",
            "nom_style" : wx.FONTWEIGHT_BOLD,
            "nom_taille" : 10,
            "nom_couleur" : (255, 0, 0),
            "type_nom" : 0,

            "texte_perso_police" : "Arial",
            "texte_perso_style" : wx.NORMAL,
            "texte_perso_taille" : 10,
            "texte_perso_couleur" : (255, 0, 0),

            "disposition_page" : 0,
            "nbre_copies" : 1,
            "bordure" : True,
            #"couleur_fond" : None,
            }

        # Données
        self.ImportationDonnees()
        
        # Paramètres de la page
        self.staticbox_page = wx.StaticBox(self.panel_base, -1, _(u"Paramètres de la page"))
        self.ctrl_disposition = BitmapComboBox(self.panel_base, size=(320,-1), style=wx.CB_READONLY)
        
        # Images pour le bitmapComboBox
        listePhotos = [ (0, _(u"Pleine page (15.9cm x 15.9cm)")), (1, _(u"2 photos par page (10.9cm x 10.9cm)")), (2, _(u"4 photos par page (8.1cm x 8.1cm)")), (3, _(u"12 photos par page (5.3cm x 5.3cm)")), (4, _(u"20 photos par page (3.8cm x 3.8cm)")), (5, _(u"35 photos par page (3.1cm x 3.1cm)"))]
        for ID, nom in listePhotos :
            bmp = wx.Bitmap(Chemins.GetStaticPath("Images/80x80/photo" + str(ID) + ".png"), wx.BITMAP_TYPE_PNG)
            self.ctrl_disposition.Append(nom, bmp, ID)
        self.ctrl_disposition.Select(self.dictAffichage["disposition_page"])
        
        # Paramètres de l'impression
        self.staticbox_param = wx.StaticBox(self.panel_base, -1, _(u"Paramètres de l'impression"))

        self.label_bordure = wx.StaticText(self.panel_base, -1, _(u"Bordures :"), style=wx.ALIGN_RIGHT)
        self.bordure = wx.CheckBox(self.panel_base, -1, u"")
        self.bordure.SetValue(self.dictAffichage["bordure"])
        self.label_nbre_copies = wx.StaticText(self.panel_base, -1, _(u"Nbre de copies :"), style=wx.ALIGN_RIGHT)
        self.nbre_copies = wx.SpinCtrl(self.panel_base, -1, "", size=(60, -1))
        self.nbre_copies.SetRange(1,100)
        self.nbre_copies.SetValue(self.dictAffichage["nbre_copies"])
        
        # Liste des photos
        self.sizer_grid_staticbox = wx.StaticBox(self.panel_base, -1, _(u"Paramètres des photos"))
        self.label_intro = wx.StaticText(self.panel_base, -1, _(u"Sélectionnez les paramètres de votre choix et cliquez sur 'Aperçu'."))
        self.listBook = ListBookPhotos(self.panel_base)
        
        # Boutons
        self.bouton_aide = CTRL_Bouton_image.CTRL(self.panel_base, texte=_(u"Aide"), cheminImage=Chemins.GetStaticPath("Images/32x32/Aide.png"))
        self.bouton_ok = CTRL_Bouton_image.CTRL(self.panel_base, texte=_(u"Aperçu"), cheminImage=Chemins.GetStaticPath("Images/32x32/Apercu.png"))
        self.bouton_annuler = CTRL_Bouton_image.CTRL(self.panel_base, texte=_(u"Fermer"), cheminImage=Chemins.GetStaticPath("Images/32x32/Fermer.png"))
        
        self.bouton_ok.SetFocus()
        
        self.__set_properties()
        self.__do_layout()
        
        self.Bind(wx.EVT_BUTTON, self.Onbouton_aide, self.bouton_aide)
        self.Bind(wx.EVT_BUTTON, self.Onbouton_ok, self.bouton_ok)
        self.Bind(wx.EVT_BUTTON, self.Onbouton_annuler, self.bouton_annuler)

        self.Bind(wx.EVT_COMBOBOX, self.OnComboDisposition, self.ctrl_disposition)

            
    def __set_properties(self):
        self.SetTitle(_(u"Impression des photos"))
        if 'phoenix' in wx.PlatformInfo:
            _icon = wx.Icon()
        else :
            _icon = wx.EmptyIcon()
        _icon.CopyFromBitmap(wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"), wx.BITMAP_TYPE_ANY))
        self.SetIcon(_icon)
        self.bouton_aide.SetToolTip(wx.ToolTip("Cliquez ici pour obtenir de l'aide"))
        self.bouton_ok.SetToolTip(wx.ToolTip("Cliquez ici pour visualiser le document au format PDF"))
        self.bouton_annuler.SetToolTip(wx.ToolTip("Cliquez ici pour annuler et fermer"))
        self.SetMinSize((570, 500))

    def __do_layout(self):
        sizer_base = wx.BoxSizer(wx.VERTICAL)
        grid_sizer_base = wx.FlexGridSizer(rows=6, cols=1, vgap=10, hgap=10)
        grid_sizer_base.Add(self.label_intro, 0, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, 10)
        
        grid_sizer_haut = wx.FlexGridSizer(rows=1, cols=2, vgap=10, hgap=10)
        
        # Liste des personnes
        sizer_page = wx.StaticBoxSizer(self.staticbox_page, wx.VERTICAL)
        sizer_page.Add(self.ctrl_disposition, 1, wx.ALL|wx.EXPAND, 5) 
        grid_sizer_haut.Add(sizer_page, 1, wx.LEFT|wx.RIGHT|wx.EXPAND, 0)
        
        # Paramètres de l'impression
        sizer_param = wx.StaticBoxSizer(self.staticbox_param, wx.VERTICAL)
        grid_sizer_param = wx.FlexGridSizer(rows=4, cols=2, vgap=5, hgap=5)
        
        grid_sizer_param.Add(self.label_bordure, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_param.Add(self.bordure, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_param.Add(self.label_nbre_copies, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_param.Add(self.nbre_copies, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 0)

        grid_sizer_haut.AddGrowableCol(1)
        sizer_param.Add(grid_sizer_param, 1, wx.ALL|wx.EXPAND, 5) 
        grid_sizer_haut.Add(sizer_param, 1, wx.LEFT|wx.RIGHT|wx.EXPAND, 0)
        
        grid_sizer_base.Add(grid_sizer_haut, 1, wx.LEFT|wx.RIGHT|wx.EXPAND, 10)
        
        # Liste des photos
        sizer_grid = wx.StaticBoxSizer(self.sizer_grid_staticbox, wx.VERTICAL)
        sizer_grid.Add(self.listBook, 1, wx.ALL|wx.EXPAND, 5)
        grid_sizer_base.Add(sizer_grid, 1, wx.LEFT|wx.RIGHT|wx.EXPAND, 10)
        
        grid_sizer_boutons = wx.FlexGridSizer(rows=1, cols=4, vgap=10, hgap=10)
        grid_sizer_boutons.Add(self.bouton_aide, 0, 0, 0)
        grid_sizer_boutons.Add((20, 20), 0, wx.EXPAND, 0)
        grid_sizer_boutons.Add(self.bouton_ok, 0, 0, 0)
        grid_sizer_boutons.Add(self.bouton_annuler, 0, 0, 0)
        grid_sizer_boutons.AddGrowableCol(1)
        grid_sizer_base.Add(grid_sizer_boutons, 1, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.EXPAND, 10)
        
        self.panel_base.SetSizer(grid_sizer_base)
        grid_sizer_base.AddGrowableRow(1)
        grid_sizer_base.AddGrowableCol(0)
        sizer_base.Add(self.panel_base, 1, wx.EXPAND, 0)
        self.SetSizer(sizer_base)
        self.Layout()
        self.CenterOnScreen()
    
    def OnComboDisposition(self, evt):
        bcb = evt.GetEventObject()
        idx = evt.GetInt()
        st  = bcb.GetString(idx)
        cd  = bcb.GetClientData(idx)
        self.dictAffichage["disposition_page"] = cd
        
    def OnBoutonCouleurNom(self, event):
        reponse = event.GetValue()
        self.nom_couleur = (reponse[0], reponse[1], reponse[2])
        self.MajBoutonPoliceNom()
        
    def MajBoutonPoliceNom(self):
        font = wx.Font(9, wx.DEFAULT, wx.NORMAL, self.dictAffichage["nom_style"], False, self.dictAffichage["nom_police"])
        self.bouton_nom_police.SetFont(font)
        self.bouton_nom_police.SetLabel(self.dictAffichage["nom_police"] + ", " + str(self.dictAffichage["nom_taille"]) + " points")

    def OnBoutonPoliceNom(self, event):
        font = wx.Font(self.dictAffichage["nom_taille"], wx.DEFAULT, wx.NORMAL, self.dictAffichage["nom_style"], False, self.dictAffichage["nom_police"])
        data = wx.FontData()
        data.EnableEffects(False)
        data.SetInitialFont(font)
        dlg = wx.FontDialog(self, data)
        if dlg.ShowModal() == wx.ID_OK:
            data = dlg.GetFontData()
            font = data.GetChosenFont()
            self.dictAffichage["nom_taille"] = font.GetPointSize()
            self.dictAffichage["nom_police"] = font.GetFaceName()
            self.dictAffichage["nom_style"] = font.GetWeight()
            self.MajBoutonPoliceNom()

    def OnBoutonCouleurTextePerso(self, event):
        reponse = event.GetValue()
        self.texte_perso_couleur = (reponse[0], reponse[1], reponse[2])
        self.MajBoutonPoliceTextePerso()
        
    def MajBoutonPoliceTextePerso(self):
        font = wx.Font(9, wx.DEFAULT, wx.NORMAL, self.dictAffichage["texte_perso_style"], False, self.dictAffichage["texte_perso_police"])
        self.bouton_texte_perso_police.SetFont(font)
        self.bouton_texte_perso_police.SetLabel(self.dictAffichage["texte_perso_police"] + ", " + str(self.dictAffichage["texte_perso_taille"]) + " points")

    def OnBoutonPoliceTextePerso(self, event):
        font = wx.Font(self.dictAffichage["texte_perso_taille"], wx.DEFAULT, wx.NORMAL, self.dictAffichage["texte_perso_style"], False, self.dictAffichage["texte_perso_police"])
        data = wx.FontData()
        data.EnableEffects(False)
        data.SetInitialFont(font)
        dlg = wx.FontDialog(self, data)
        if dlg.ShowModal() == wx.ID_OK:
            data = dlg.GetFontData()
            font = data.GetChosenFont()
            self.dictAffichage["texte_perso_taille"] = font.GetPointSize()
            self.dictAffichage["texte_perso_police"] = font.GetFaceName()
            self.dictAffichage["texte_perso_style"] = font.GetWeight()
            self.MajBoutonPoliceTextePerso()
            
    def ImportationDonnees(self):
        """ Importation de la liste des personnes """
        # Récupération de la liste des personnes
        DB = GestionDB.DB()        
        req = """SELECT IDpersonne, nom, prenom FROM personnes ORDER BY nom, prenom; """
        DB.ExecuterReq(req)
        listePersonnes = DB.ResultatReq()
        DB.Close()
        # Création de la liste pour le listBox et du dict de données
        self.listeDonnees = []
        self.dictDonnees = {}
        index = 0
        for IDpersonne, nom, prenom in listePersonnes :
            label = nom + " " + prenom
            self.listeDonnees.append(label)
            self.dictDonnees[index] = (IDpersonne, nom, prenom, None)
            index += 1

    def Build_Hyperlink(self) :
        """ Construit un hyperlien """
        self.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False))
        hyper = hl.HyperLinkCtrl(self.panel_base, -1, _(u"Sélectionner les présents d'une période"), URL="")
        hyper.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLeftLink)
        hyper.AutoBrowse(False)
        hyper.SetColours("BLACK", "BLACK", "BLUE")
        hyper.EnableRollover(True)
        hyper.SetUnderlines(False, False, True)
        hyper.SetBold(False)
        hyper.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour sélectionner les personnes présentes sur une période donnée")))
        hyper.UpdateLink()
        hyper.DoPopup(False)
        return hyper
        
    def OnLeftLink(self, event):
        """ Sélectionner les personnes présentes sur une période donnée """
        dlg = DLG_Selection_periode.SelectionPeriode(self)
        if dlg.ShowModal() == wx.ID_OK:
            listePersonnesPresentes = dlg.GetPersonnesPresentes()
            dlg.Destroy()
        else:
            dlg.Destroy()
            return False
        # Sélection dans la listBox
        for index, valeurs in self.dictDonnees.items():
            IDpersonne = valeurs[0]
            if IDpersonne in listePersonnesPresentes :
                self.checkListBox.Check(index, True)
            else:
                self.checkListBox.Check(index, False)
        # S'il n'y a aucune personne présente sur la période sélectionnée
        if len(listePersonnesPresentes) == 0 :
            dlg = wx.MessageDialog(self, _(u"Il n'y a aucune personne présente sur la période que vous avez sélectionné."), _(u"Erreur de saisie"), wx.OK | wx.ICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return
        
    def Onbouton_aide(self, event):
        from Utils import UTILS_Aide
        UTILS_Aide.Aide("Imprimerdesphotosdepersonnes")

    def Onbouton_annuler(self, event):
        self.EndModal(wx.ID_CANCEL)

    def Onbouton_ok(self, event):
        """ Affichage du PDF """
        self.dictAffichage["nbre_copies"] = self.nbre_copies.GetValue()
        self.dictAffichage["bordure"] = self.bordure.GetValue()
        pdf = CreationPDF(self.listePersonnes, self.dictAffichage)