Skip to content

Commit 7b2330b

Browse files
committed
all logic done
1 parent b6335cd commit 7b2330b

File tree

2 files changed

+33
-14
lines changed

2 files changed

+33
-14
lines changed

Emoji Dictionary/QT_GUI.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@
66
from PyQt5.QtGui import *
77
from PyQt5.QtWidgets import *
88
from PyQt5 import uic
9+
from emoji import demojize
10+
import os
911

1012
class MainWindow(QMainWindow):
1113
def __init__(self):
1214
super(MainWindow, self).__init__()
1315

1416
# Load the UI file
15-
uic.loadUi('Emoji Dictionary/QT_GUI.ui', self)
17+
uic.loadUi(os.path.join(os.path.dirname(__file__),'QT_GUI.ui'),self)
1618
self.pushButton_4.clicked.connect(self.close)
19+
self.pushButton_2.clicked.connect(lambda:search_emoji())
20+
self.pushButton_3.clicked.connect(lambda:clear_text())
1721
cells = [
1822

1923
["🐒", "🐕", "🐎", "🐪", "🐁", "🐘", "🦘", "🦈", "🐓", "🐝", "👀", "🦴", "👩🏿", "‍🤝", "🧑", "🏾", "👱🏽", "‍♀", "🎞", "🎨", "⚽"],
@@ -28,12 +32,20 @@ def emoji_wight_btn():
2832
self.emoji_widget.show()
2933

3034
def search_emoji():
31-
word = self.lineEdit.text()
35+
word = self.lineEdit.text()
36+
print(f"Field Text: {word}")
3237
if word == "":
3338
self.textEdit.setText("You have entered no emoji.")
3439
else:
35-
means = emoji.demojize(word)
36-
self.textEdit.setText("Meaning of Emoji : " + str(word) + "\n\n" + means)
40+
means = demojize(word)
41+
self.textEdit.setText("Meaning of Emoji : " + str(word) + "\n\n" + means.replace("::", ":\n: "))
42+
43+
def add_input_emoji(emoji):
44+
self.lineEdit.setText(self.lineEdit.text() + emoji)
45+
46+
def clear_text():
47+
self.lineEdit.setText("")
48+
self.textEdit.setText("")
3749

3850
self.emoji_buttons = []
3951
self.emoji_layout = QGridLayout()
@@ -60,7 +72,7 @@ def search_emoji():
6072
background-color: #f0f0f0;
6173
}
6274
""")
63-
# button.clicked.connect(lambda checked, e=emoji: self.emoji_clicked(e))
75+
button.clicked.connect(lambda checked, e=emoji: add_input_emoji(e))
6476
self.emoji_layout.addWidget(button, row_idx, col_idx)
6577
self.emoji_buttons.append(button)
6678

Emoji Dictionary/QT_GUI.ui

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>948</width>
9+
<width>944</width>
1010
<height>638</height>
1111
</rect>
1212
</property>
@@ -159,7 +159,9 @@
159159
<widget class="QLineEdit" name="lineEdit">
160160
<property name="font">
161161
<font>
162-
<pointsize>14</pointsize>
162+
<pointsize>-1</pointsize>
163+
<weight>50</weight>
164+
<bold>false</bold>
163165
</font>
164166
</property>
165167
<property name="styleSheet">
@@ -175,6 +177,9 @@
175177
background-color: #ffffff;
176178
}</string>
177179
</property>
180+
<property name="text">
181+
<string/>
182+
</property>
178183
</widget>
179184
</item>
180185
<item>
@@ -184,7 +189,7 @@
184189
</property>
185190
<property name="font">
186191
<font>
187-
<pointsize>14</pointsize>
192+
<pointsize>-1</pointsize>
188193
<weight>62</weight>
189194
<bold>true</bold>
190195
</font>
@@ -229,7 +234,7 @@
229234
<widget class="QPushButton" name="pushButton_2">
230235
<property name="font">
231236
<font>
232-
<pointsize>14</pointsize>
237+
<pointsize>-1</pointsize>
233238
<weight>62</weight>
234239
<bold>true</bold>
235240
</font>
@@ -259,7 +264,7 @@
259264
<widget class="QPushButton" name="pushButton_3">
260265
<property name="font">
261266
<font>
262-
<pointsize>14</pointsize>
267+
<pointsize>-1</pointsize>
263268
<weight>62</weight>
264269
<bold>true</bold>
265270
</font>
@@ -332,11 +337,13 @@
332337
<widget class="QTextEdit" name="textEdit">
333338
<property name="font">
334339
<font>
335-
<pointsize>14</pointsize>
340+
<pointsize>-1</pointsize>
336341
</font>
337342
</property>
338343
<property name="styleSheet">
339-
<string notr="true"> QTextEdit {
344+
<string notr="true">
345+
346+
QTextEdit {
340347
border: 1px solid #dcdcdc;
341348
border-radius: 5px;
342349
padding: 10px;
@@ -353,7 +360,7 @@
353360
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
354361
p, li { white-space: pre-wrap; }
355362
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:14px; font-weight:400; font-style:normal;&quot;&gt;
356-
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:20pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
363+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:7.8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
357364
</property>
358365
</widget>
359366
</item>
@@ -367,7 +374,7 @@ p, li { white-space: pre-wrap; }
367374
</property>
368375
<property name="font">
369376
<font>
370-
<pointsize>14</pointsize>
377+
<pointsize>-1</pointsize>
371378
<weight>62</weight>
372379
<bold>true</bold>
373380
</font>

0 commit comments

Comments
 (0)