2020년 10월 25일 일요일

python excel(tableDefineDto.py)

 class MyTableDefineDto:

    def __init__(selftable_name,column_name,logical_name,is_nullable,data_type,key_position):
        self.table_name = table_name
        self.column_name = column_name
        self.logical_name = logical_name
        self.is_nullable = is_nullable
        self.data_type = data_type
        self.key_position = key_position

python excel(makeDataBookTest.py)

 import openpyxl

import readTableDefine
import searchTableName
import datetime

###############################################################################################
# 対象テーブルリスト
###############################################################################################
tableNameList = ["table_a","table_b","table_c"]
###############################################################################################
# ファイルパス定義
###############################################################################################
temp = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
saveBookPath = "makeData_{}.xlsx".format(temp)
srchTableNamePath = 'a5m2_TABLES.xlsx'
tableDefineFilePath = "a5m2_COLUMNS.xlsx"
domainFilePath = "a5m2_DOMAINS.xlsx"
###############################################################################################
# 背景色定義
fill = openpyxl.styles.PatternFill(patternType='solid',
                                   start_color='ccdfff'end_color='ccdfff')
###############################################################################################
# 保存Excelファイルのワークシートの設定行番号定義
###############################################################################################
TABLE_NAME = 3
COLUMN_NAME = 4
LOGICAL_NAME = 5 
IS_NULLABLE = 6
DATA_TYPE = 7
KEY_POSITION = 8 # PK
###############################################################################################
# 1.ワークブックオブジェクト取得
# 2.テーブル定義読取処理を呼び出し、検索テーブル(リスト)に該当する項目定義(リスト)取得
# 3.取得結果のキー:テーブル名(物理名)を元に該当項目定義を取得し、
#   保存ブックパスのワークシートに該当項目定義を設定
# 4.ワークブック保存
###############################################################################################
# 1.ワークブックオブジェクト取得
wb = openpyxl.Workbook()
wb.active
# 2.テーブル定義読取処理を呼び出し、検索テーブル(リスト)に該当する項目定義(リスト)取得
dic = readTableDefine.MyReadTableDefine(tableNameList, tableDefineFilePath, domainFilePath).read() 
# 3.取得結果のキー:テーブル名(物理名)を元に該当項目定義を取得し、保存ブックパスのワークシートに該当項目定義を設定
for idx, key in enumerate(dic):
    start_colNo = 3
    ws = []
    if idx == 0:
        ws = wb.worksheets[idx]
        ws.title = key[0:30# 桁超えしないように 
    else:
        wb.create_sheet(title=key, index=idx)    
        ws = wb[key]
    
    # 項目定義(リスト)から項目定義を取得
    for colInfo in dic[key]:
        start_rowNo = 3
        #ws.cell(row=TABLE_NAME, column=start_colNo).value = colInfo.table_name
        # 行3、列3にテーブル名(物理名)設定
        if start_rowNo == 3 and start_colNo == 3:
            ws.cell(row=TABLE_NAME, column=start_colNo).value = colInfo.table_name
            # 論理名検索処理を呼び出し、行3、列4にテーブル名(論理名)設定
            ws.cell(row=TABLE_NAME, column=start_colNo+1).value = searchTableName.MySearchTableName(
                                                                    srchTableNamePath, colInfo.table_name).searchJp() 
        # 項目名(物理名)設定(行:4,列:該当start_colNo)                                                                    
        ws.cell(row=COLUMN_NAME, column=start_colNo).value = colInfo.column_name
        # 項目名(論理名)設定(行:5,列:該当start_colNo)                                                                    
        ws.cell(row=LOGICAL_NAME, column=start_colNo).value = colInfo.logical_name
        # NULL許可フラグ設定(行:6,列:該当start_colNo)                                                                    
        ws.cell(row=IS_NULLABLE, column=start_colNo).value = colInfo.is_nullable
        # データ型設定(行:7,列:該当start_colNo)                                                                    
        ws.cell(row=DATA_TYPE, column=start_colNo).value = colInfo.data_type
        # キーポジション設定(行:8,列:該当start_colNo)                                                                    
        ws.cell(row=KEY_POSITION, column=start_colNo).value = colInfo.key_position
        # 背景設定(行3~9の該当列)、中央揃え
        if start_rowNo >= 3 and start_rowNo <=9:
            ws.cell(row=start_rowNo, column=start_colNo).fill = fill
            ws.cell(row=start_rowNo, column=start_colNo).alignment = openpyxl.styles.Alignment(horizontal='center')
        start_rowNo += 1
        start_colNo += 1      
    
# 4.ワークブック保存
wb.save(saveBookPath)
###############################################################################################

python excel(searchTableName.py, searchTableNameTest.py)

 import openpyxl


class MySearchTableName:
    def __init__(selffilePathsrchName):
        self.__filePath = filePath
        self.__srchName = srchName
        self.ENG_TABLE_NAME = 3-1
        self.JP_TABLE_NAME = 4-1
    ######################################################################
    # テーブル論理名検索
    ######################################################################    
    def searchJp(self):
        wb = openpyxl.load_workbook(self.__filePath)
        ws = wb.worksheets[0]
        for row in ws.rows:
            if row[self.ENG_TABLE_NAME].value == self.__srchName:
                return row[self.JP_TABLE_NAME].value
    ######################################################################
    # テーブル物理名検索
    ######################################################################                    
    def searchEng(self):
        wb = openpyxl.load_workbook(self.__filePath)
        ws = wb.worksheets[0]
        for row in ws.rows:
            if row[self.JP_TABLE_NAME].value == self.__srchName:
                return row[self.ENG_TABLE_NAME].value                
                
                
#############################################################################
import searchTableName

searchFilePath = 'a5m2_TABLES.xlsx'
tableNameList = ['table_a','table_b']


result = []
for tableName in tableNameList:
    result.append(searchTableName.MySearchTableName(searchFilePath, tableName).searchEng())
    
print(result)  

2020년 10월 11일 일요일

html div media screen

 <!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        :root{--text-color:#f0f4f5--background-color:#263343--accent-color:pink;}
        body{font-familyVerdana, Geneva, Tahomasans-serif;font-size15px;margin0px;}
        a {text-decorationnone;colorvar(--text-color);}
        .navbar {background-color#26282b;font-size15px;color#e1e2e3;displayflex;justify-contentspace-between;align-itemscenter;padding:5px 20px;}
        .logo{font-size24px;color:var(--accent-color);}
        .logo a:hover{color:peru;}
        .menu-bar{list-stylenone;displayflex;padding-left0pxborder0px solid;}
        .menu-bar li:hover {background-colorperu;}
        .menu-bar li{padding8px 15px;}
        .right-menu{border0px solid;displayflex;list-stylenone;}
        .right-menu li {padding:8px 10px;}
        .main{background-color#f4edf5;color:#474747}
        @media screen and (max-width:768px){
            .navbar{flex-directioncolumn;align-itemsflex-start;padding10px;}
            .logo{}
            .menu-bar{flex-directioncolumn;width100%;align-items:center}
            .menu-bar li{width100%;text-aligncenter;}
            .right-menu{justify-contentcenter;width100%;}
        }

    </style>
    <script src="http://kit.fontawesome.com/2d323a629b.js"></script>
</head>
<body>
    <!-- justify-content: space-between;align-items: center;  @media screen and (max-width:768px)-->
    <nav class="navbar">
        <div class="logo">
            <i class="fab fa-accusoft"></i>
            <a href="">DreamCoding</a>
        </div>
        <ul class="menu-bar">
            <li><a href="">menu1</a></li>
            <li><a href="">menu2</a></li>
            <li><a href="">menu3</a></li>
            <li><a href="">menu4</a></li>
            <li><a href="">menu5</a></li>
        </ul>
        <nav class="right-menu">
            <li><i class="fab fa-android"></i></li>
            <li><i class="fab fa-apple"></i></li>
        </nav>
    </nav>
    <div class="main"></div>
</body>
</html>

2020년 10월 10일 토요일

html div test

 <!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{margin0pxwidth100%;font-size16px;font-familyVerdana, Geneva, Tahomasans-serif;color#333333;}
        .space{padding-left:10px;padding-top10px;}
        .top {background-coloraqua;height50px;displayflex;}        
        .top-menus {background-color:bisque;width200px;margin:auto 0px 0px auto;displayflex;}        
        .top-menu {background-color:blueviolet;width100%;padding-left:10px}        
        .main{displayflex;}
        .left {background-colorbluevioletwidth:20%;}
        .left-menus {background-colorburlywood;width:90%height:30pxmargin:20px auto auto auto ;}
        .left-menu{background-colorchocolateheight100%;}
        .center{background-colordarkolivegreen;width:70%;height:500px}
        .center-top{background-colordarksalmon;}
        .center-main{background-colordarkviolet;}
        .right{background-colorforestgreen;width:10%}
        .bottom{background-colorgray;height50px;}

    </style>
</head>
<body>
    <div class="all">
        <div class="top space">  
            <div style="border: 1px solid;">top</div>      
            <div class="top-menus ">
                <div class="top-menu">top1</div>
                <div class="top-menu">top2</div>
                <div class="top-menu">top3</div>
            </div>
        </div>
        <div class="main">
            <div class="left space">left
                <div class="left-menus">
                    <div class="left-menu">menu1</div>
                    <div class="left-menu">menu2</div>
                    <div class="left-menu">menu3</div>
                </div>
            </div>
            <div class="center space">center</div>
            <div class="right space">right</div>
        </div>
        <div class="bottom space">botoom</div>
    </div>
</body>
</html>

wpf test

MainWindow.xaml 

<Window x:Class="WpfApplication1.MainWindow"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

        xmlns:local="clr-namespace:WpfApplication1"

        mc:Ignorable="d"

        Title="MainWindow" Height="150" Width="900">

    <Window.Resources>

        <local:MYViewModel x:Key="myVM"/>

    </Window.Resources>

    <Grid  DataContext="{Binding Source={StaticResource myVM}}" Width="500" HorizontalAlignment="Left">

        <ItemsControl ItemsSource="{Binding ThingsList, Mode= OneWay}"  >

            <ItemsControl.ItemsPanel>

                <ItemsPanelTemplate>

                    <WrapPanel/>

                </ItemsPanelTemplate>

            </ItemsControl.ItemsPanel>

            <ItemsControl.ItemTemplate >

                <DataTemplate>

                    <!--<TextBlock Text="{Binding Name}" Foreground="{Binding Color}" TextAlignment="Left"/>-->

                    <TextBlock TextAlignment="Left">

                        <Run Text="{Binding Name}" Foreground="{Binding Color}" />

                    </TextBlock>

                </DataTemplate>

            </ItemsControl.ItemTemplate>

        </ItemsControl>

    </Grid>

</Window>

-----------------------------------------------

MainWindow .xaml.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Navigation;

using System.Windows.Shapes;


namespace WpfApplication1

{

    /// <summary>

    /// MainWindow.xaml の相互作用ロジック

    /// </summary>

    public partial class MainWindow : Window

    {

        public MainWindow()

        {

            InitializeComponent();

        }

    }

}

------------------------------------------------

MainWindow.cs


using System;

using System.Collections.Generic;

using System.Collections.ObjectModel;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace WpfApplication1

{

    public class NamedThing

    {

        public string Name { get; set; }

        public string Color { get; set; }

    }


    public class MYViewModel

    {

        public List<NamedThing> ThingsList { get; set; }

             = new List<NamedThing>

            {

            new NamedThing {Name = "Short1",Color= "#FF0000"},

            new NamedThing {Name = ", ", Color ="black"},

            new NamedThing {Name = "Short2", Color= "red"},

            new NamedThing {Name = ", ", Color ="black"},

            new NamedThing {Name = "Short3", Color= "blue"},

            new NamedThing {Name = ", ", Color ="black"},

            new NamedThing {Name = "Short4", Color= "red"}

            };

    }

}




2018년 5월 27일 일요일

Canvas

こちらのタグがサポートされない場合、こちらの文字が表示されます
こちらのタグがサポートされない場合、こちらの文字が表示されます